:root {
  --navy: #071f49;
  --navy-2: #0d335f;
  --accent: #e31824;
  --steel: #6d7886;
  --steel-2: #d7dee8;
  --ink: #142033;
  --muted: #5e6a78;
  --surface: #f4f7fa;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(7, 31, 73, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Inter", Arial, sans-serif;
  line-height: 1.5;
  background: var(--surface);
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(7, 31, 73, 0.96), rgba(13, 51, 95, 0.88)),
    url("assets/hero-offshore-welding.png") center / cover;
}

.login-card {
  width: min(460px, 100%);
  padding: clamp(26px, 5vw, 38px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card .brand {
  margin-bottom: 28px;
  color: var(--navy);
}

.login-card h1 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: clamp(1.8rem, 5vw, 2.45rem);
  line-height: 1.05;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.portal-card {
  width: min(620px, 100%);
}

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.client-auth-card {
  width: min(760px, 100%);
}

.client-register-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--steel-2);
  border: 1px solid var(--steel-2);
}

.profile-grid div {
  min-height: 86px;
  padding: 18px;
  background: var(--white);
}

.profile-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--steel);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-grid strong {
  color: var(--navy);
}

.checkbox-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

.checkbox-field span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 700;
}

.checkbox-field input {
  width: auto;
  min-height: auto;
}

.service-choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-choice-grid label {
  min-height: 48px;
  border: 1px solid var(--steel-2);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface);
}

.service-choice-grid .service-option-card {
  align-items: start;
  gap: 10px;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.service-option-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 10px 24px rgba(7, 31, 73, 0.08);
}

.service-option-content {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.service-option-title {
  color: var(--navy);
  font-weight: 900;
}

.service-option-detail {
  display: none;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
}

.service-option-card:has(input:checked) .service-option-detail {
  display: grid;
  gap: 6px;
}

.service-option-detail p,
.service-option-detail ul {
  margin: 0;
}

.service-option-detail ul {
  padding-left: 18px;
}

.service-option-detail strong {
  color: var(--navy);
}

.field-help {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.request-list {
  display: grid;
  gap: 14px;
}

.request-card {
  border: 1px solid var(--steel-2);
  border-radius: 8px;
  padding: 18px;
  background: var(--white);
}

.request-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.request-card h3 {
  margin: 8px 0 4px;
  color: var(--navy);
  font-size: 1.22rem;
}

.request-card p {
  margin: 0;
  color: var(--muted);
}

.status-pill-light {
  display: inline-flex;
  padding: 5px 9px;
  border-left: 3px solid var(--accent);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  background: var(--surface);
}

.status-pill-muted {
  display: inline-flex;
  padding: 5px 9px;
  border-left: 3px solid var(--steel);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  background: var(--surface);
}

.request-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--steel-2);
  border: 1px solid var(--steel-2);
}

.request-details div {
  padding: 12px;
  background: var(--surface);
}

.request-details dt {
  color: var(--steel);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.request-details dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-weight: 700;
}

.request-files {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.request-files strong {
  color: var(--navy);
}

.request-files a {
  border: 1px solid var(--steel-2);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
  background: var(--surface);
}

.login-message {
  min-height: 22px;
  margin: 2px 0 0;
  color: var(--accent);
  font-weight: 800;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px clamp(18px, 4vw, 54px);
  color: var(--navy);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 35px rgba(7, 31, 73, 0.1);
  backdrop-filter: blur(14px);
}

.brand {
  display: grid;
  width: max-content;
  max-width: calc(100vw - 96px);
  font-weight: 900;
}

.brand::before,
.brand::after {
  width: 100%;
  height: 2px;
  background: var(--accent);
  content: "";
}

.brand-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: inherit;
  font-size: clamp(1.28rem, 3vw, 2rem);
  font-style: italic;
  line-height: 0.9;
  text-transform: uppercase;
  transform: skewX(-8deg);
}

.brand-text strong {
  color: var(--accent);
  font-size: 1.62em;
  line-height: 0.65;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 900;
}

.admin-nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: var(--navy);
  cursor: pointer;
  background: transparent;
}

.admin-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 5px auto;
  background: currentColor;
}

.nav-button {
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  background: transparent;
}

.notification-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.notification-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.notification-link strong {
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--white);
  font-size: 0.72rem;
  line-height: 1;
  background: var(--accent);
}

.notification-link strong[hidden] {
  display: none;
}

.admin-shell {
  display: grid;
  gap: 24px;
  width: min(1440px, 100%);
  overflow-x: hidden;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 42px);
}

.admin-hero,
.panel,
.proposal-preview {
  border: 1px solid var(--steel-2);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.admin-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(28px, 5vw, 48px);
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(7, 31, 73, 0.98), rgba(13, 51, 95, 0.9)),
    url("assets/hero-offshore-welding.png") center / cover;
}

.admin-hero h1,
.panel h2,
.proposal-preview h2 {
  max-width: 100%;
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.admin-hero h1 {
  max-width: 780px;
  font-size: clamp(2rem, 4vw, 4.2rem);
  font-weight: 900;
}

.admin-hero p:not(.eyebrow) {
  max-width: 820px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel {
  padding: clamp(20px, 3vw, 30px);
}

.panel-heading,
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel h2,
.proposal-preview h2 {
  color: var(--navy);
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
}

.panel-heading span {
  color: var(--steel);
  font-weight: 800;
}

.admin-form,
.proposal-form {
  display: grid;
  gap: 14px;
}

.admin-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

.admin-form.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--steel-2);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--white);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(227, 24, 36, 0.14);
}

.wide,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
  text-align: center;
}

.button.primary {
  color: var(--white);
  background: var(--accent);
}

.button.secondary {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.32);
  background: var(--navy-2);
}

.button.ghost {
  color: var(--navy);
  border-color: var(--steel-2);
  background: var(--white);
}

.import-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.scope-summary {
  margin-top: 4px;
  color: inherit;
  line-height: 1.25;
}

.scope-title {
  margin: 4px 0;
  font-weight: 700;
}

.scope-label {
  margin-top: 6px;
  font-weight: 400;
  text-decoration: underline;
}

.scope-lines {
  margin-top: 2px;
}

.scope-lines div {
  margin: 1px 0;
}

.proposal-item-description > strong {
  display: block;
  margin-bottom: 2px;
  color: inherit;
  font-weight: 700;
}

.proposal-item-description > p {
  margin: 0 0 4px;
  white-space: pre-wrap;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--steel-2);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

td.actions {
  white-space: nowrap;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-weight: 900;
  background: transparent;
}

.link-button + .link-button {
  margin-left: 12px;
}

.proposal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.34fr);
  gap: 20px;
}

.item-builder {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--steel-2);
  border-radius: 8px;
  padding: 14px;
}

.item-builder legend {
  padding: 0 8px;
  color: var(--navy);
  font-weight: 900;
}

.proposal-side {
  display: grid;
  align-content: start;
  gap: 14px;
}

.proposal-total {
  padding: 20px;
  border-left: 4px solid var(--accent);
  color: var(--white);
  background: var(--navy);
}

.proposal-total span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.proposal-total strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
  line-height: 1;
}

.proposal-list {
  display: grid;
  gap: 10px;
}

.proposal-card {
  border: 1px solid var(--steel-2);
  border-radius: 8px;
  padding: 14px;
  background: var(--white);
}

.proposal-card strong {
  display: block;
  color: var(--navy);
}

.proposal-card span {
  display: block;
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.proposal-preview {
  padding: clamp(18px, 3vw, 30px);
}

.proposal-document {
  width: min(900px, 100%);
  min-height: 1100px;
  margin: 0 auto;
  padding: 34px 38px;
  border: 1px solid var(--steel-2);
  color: #1f2937;
  background: var(--white);
}

.doc-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 4px solid var(--accent);
  padding-bottom: 12px;
}

.doc-brand {
  color: var(--navy);
  font-size: 1.75rem;
  font-style: italic;
  font-weight: 900;
  line-height: 0.95;
}

.doc-meta {
  text-align: right;
}

.doc-meta span,
.doc-section h3,
.doc-total span {
  color: var(--steel);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.doc-title {
  margin: 22px 0 16px;
}

.doc-title h2 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1.48rem;
}

.doc-section {
  margin-top: 16px;
}

.doc-section h3 {
  margin: 0 0 8px;
  color: var(--accent);
}

.doc-section p {
  margin: 0;
  white-space: pre-wrap;
}

.doc-table th,
.doc-table td {
  border: 1px solid #cfd8e3;
  vertical-align: middle;
}

.doc-table th {
  background: #eef3f8;
}

.doc-total {
  display: grid;
  justify-content: end;
  margin-top: 16px;
  text-align: right;
}

.doc-total strong {
  color: var(--navy);
  font-size: 1.6rem;
}

.doc-signature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  margin-top: 36px;
}

.doc-signature div {
  border-top: 1px solid #1f2937;
  padding-top: 8px;
  text-align: center;
}

.welding-process-section {
  break-before: page;
  page-break-before: always;
}

.technical-document {
  min-height: 1100px;
}

.technical-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.technical-grid.single {
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.technical-field {
  display: grid;
  gap: 5px;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid #cfd8e3;
}

.technical-field strong {
  color: var(--navy);
  font-size: 0.78rem;
}

.blank-line {
  display: block;
  min-height: 12px;
  border-bottom: 1px solid #8a94a3;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  margin-top: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  font-size: 0.84rem;
}

.checkbox {
  width: 12px;
  height: 12px;
  border: 1.6px solid var(--navy);
  flex: 0 0 auto;
}

.page-break {
  break-before: auto;
  page-break-before: auto;
}

.repeat-doc-header {
  margin-top: 0;
  break-after: avoid;
  page-break-after: avoid;
}

.print-form-table {
  width: 100%;
  border-collapse: collapse;
}

.print-form-table > thead > tr > td,
.print-form-table > tbody > tr > td {
  padding: 0;
  border: 0;
}

@media (max-width: 920px) {
  .admin-hero,
  .panel-heading,
  .preview-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .admin-form,
  .admin-form.compact,
  .client-register-form,
  .form-row,
  .proposal-grid,
  .request-card-heading,
  .request-details,
  .doc-signature,
  .technical-grid,
  .check-grid,
  .checkbox-row,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .proposal-document {
    padding: 24px;
  }

  .doc-header {
    flex-direction: column;
  }

  .doc-meta {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .admin-header {
    position: sticky;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
  }

  .brand {
    max-width: calc(100% - 58px);
  }

  .brand-text {
    gap: 5px;
    font-size: clamp(1.08rem, 6vw, 1.28rem);
  }

  .admin-hero,
  .panel,
  .proposal-preview {
    overflow: hidden;
  }

  .admin-hero h1,
  .panel h2 {
    font-size: clamp(1.75rem, 9vw, 2.25rem);
  }

  .admin-nav-toggle {
    display: block;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .admin-nav {
    position: absolute;
    top: calc(100% - 1px);
    left: 14px;
    right: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 8px 12px;
    color: var(--navy);
    background: var(--white);
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .admin-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .admin-nav a,
  .admin-nav button {
    min-width: 0;
    padding: 12px 4px;
    border: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }

  .notification-link {
    justify-content: start;
  }
}

@media (max-width: 380px) {
  .admin-nav {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 9mm 10mm 8mm;
  }

  body {
    background: var(--white);
  }

  .admin-header,
  .admin-hero,
  .panel,
  .preview-toolbar {
    display: none !important;
  }

  .admin-shell,
  .proposal-preview {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .proposal-document {
    width: auto;
    min-height: auto;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .technical-document {
    font-size: 0.84rem;
  }

  .print-form-table {
    display: table;
  }

  .print-form-table > thead {
    display: table-header-group;
  }

  .print-form-table > tbody {
    display: table-row-group;
  }

  .doc-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .doc-title {
    margin: 14px 0 10px;
  }

  .doc-section {
    margin-top: 11px;
  }

  .doc-section h3 {
    margin-bottom: 5px;
  }

  .doc-signature {
    grid-template-columns: 1fr 1fr;
    gap: 18mm;
    margin-top: 28mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .technical-grid {
    gap: 6px 8px;
  }

  .technical-field {
    min-height: 40px;
    padding: 5px 7px;
  }

  .technical-field strong {
    font-size: 0.7rem;
  }

  .blank-line {
    min-height: 10px;
  }

  .check-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px 8px;
    margin-top: 6px;
  }

  .check-item {
    min-height: 17px;
    gap: 5px;
    font-size: 0.74rem;
  }

  .checkbox {
    width: 10px;
    height: 10px;
  }
}
