:root {
  --ink: #17211f;
  --muted: #68746f;
  --line: #dce5e1;
  --paper: #f7faf7;
  --panel: #ffffff;
  --brand: #123c3a;
  --brand-2: #2f756f;
  --mint: #dff4ee;
  --gold: #f4d06f;
  --rose: #b94b5f;
  --shadow: 0 20px 50px rgba(18, 60, 58, .12);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

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

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 18%, rgba(244, 208, 111, .22), transparent 28%),
    linear-gradient(135deg, #eef8f4 0%, #f7faf7 42%, #f5f0e4 100%);
}

.access-gate-page {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .9) 0 1px, transparent 1px 100%) 0 0 / 82px 82px,
    linear-gradient(0deg, rgba(255, 255, 255, .88) 0 1px, transparent 1px 100%) 0 0 / 82px 82px,
    radial-gradient(circle at 18% 22%, rgba(56, 189, 248, .2), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(244, 208, 111, .24), transparent 26%),
    linear-gradient(135deg, #eef7f8 0%, #f9fbf8 54%, #f3efe4 100%);
}

.access-gate-shell {
  width: min(1040px, calc(100% - 36px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
  gap: 72px;
  align-items: center;
  padding: 52px 0;
}

.access-gate-card {
  padding: 34px;
  border: 1px solid rgba(18, 60, 58, .16);
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 24px 70px rgba(18, 60, 58, .11);
  backdrop-filter: blur(16px);
}

.access-logo {
  display: inline-flex;
  margin-bottom: 48px;
}

.access-logo img {
  width: 204px;
  height: auto;
}

.access-heading h1 {
  margin: 0;
  color: #123c3a;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
}

.access-heading p {
  margin: 16px 0 0;
  color: #5f706d;
  font-size: 1rem;
  line-height: 1.7;
}

.access-form {
  margin-top: 30px;
}

.access-links {
  padding-top: 18px;
  border-top: 1px solid #dce5e1;
}

.access-route {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 24px 0 24px 34px;
}

.route-line {
  position: absolute;
  top: 38px;
  bottom: 38px;
  left: 0;
  width: 2px;
  background: linear-gradient(180deg, #38bdf8, #f4d06f);
}

.route-step {
  max-width: 520px;
  padding: 22px 24px;
  border: 1px solid rgba(18, 60, 58, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .7);
  box-shadow: 0 14px 42px rgba(18, 60, 58, .06);
}

.route-step span {
  display: inline-flex;
  margin-bottom: 14px;
  color: #0f7897;
  font-size: .78rem;
  font-weight: 860;
}

.route-step strong {
  display: block;
  color: #17211f;
  font-size: 1.2rem;
}

.route-step p {
  margin: 8px 0 0;
  color: #60716d;
  line-height: 1.6;
}

.auth-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 48px;
  align-items: center;
  padding: 48px 0;
}

.auth-shell.compact {
  grid-template-columns: minmax(0, 520px);
  justify-content: center;
}

.brand-logo {
  width: 220px;
  max-width: 78vw;
  height: auto;
  display: block;
}

.brand-logo.small {
  width: 190px;
  margin-bottom: 30px;
}

.auth-brand h1,
.panel-heading h1,
.panel-heading h2,
.content-band h2,
.topbar h1 {
  margin: 0;
  line-height: 1.05;
}

.auth-brand h1 {
  max-width: 720px;
  margin-top: 52px;
  font-size: clamp(2.4rem, 6vw, 5.2rem);
}

.auth-brand p {
  max-width: 620px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 1.14rem;
  line-height: 1.7;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.trust-strip span {
  padding: 10px 14px;
  border: 1px solid rgba(18, 60, 58, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .62);
  color: var(--brand);
  font-weight: 700;
  font-size: .9rem;
}

.auth-panel,
.tool-panel,
.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 34px;
}

.auth-panel.wide {
  padding: 32px;
}

.panel-heading {
  margin-bottom: 24px;
}

.panel-heading h1,
.panel-heading h2 {
  font-size: 2rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-2);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.form-stack,
.form-grid {
  display: grid;
  gap: 16px;
}

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

.span-2 {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: #33413d;
  font-size: .9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cad8d3;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfdfb;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(143, 213, 198, .25);
}

.primary-action,
.secondary-action,
.ghost-action {
  min-height: 46px;
  border-radius: 8px;
  padding: 11px 16px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.primary-action {
  background: var(--brand);
  color: #fff;
}

.secondary-action {
  background: var(--mint);
  color: var(--brand);
}

.ghost-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
  color: var(--brand);
}

.primary-action:disabled,
.secondary-action:disabled,
.ghost-action:disabled {
  cursor: not-allowed;
  opacity: .56;
  filter: grayscale(.2);
}

.compact-action {
  min-height: auto;
  white-space: nowrap;
}

.link-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--brand-2);
  font-weight: 700;
  line-height: 1.4;
}

.form-message.error {
  color: var(--rose);
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  color: var(--brand-2);
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  background: #f3f7f4;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #fbfdfb;
  border-right: 1px solid var(--line);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 900;
  color: var(--brand);
}

.nav-logo img {
  width: 42px;
  height: 42px;
}

.side-nav nav {
  display: grid;
  gap: 8px;
}

.side-nav nav a {
  padding: 12px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: #50605b;
  font-weight: 800;
}

.side-nav nav a.active,
.side-nav nav a:hover {
  background: var(--mint);
  color: var(--brand);
}

#logoutButton {
  margin-top: auto;
}

.workspace-main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar,
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar {
  padding: 18px 0 26px;
}

.topbar h1 {
  font-size: clamp(1.8rem, 4vw, 3.3rem);
}

.content-band {
  padding: 24px 0 42px;
  border-top: 1px solid rgba(18, 60, 58, .1);
}

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

.balance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.balance-card {
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.balance-card h3,
.balance-card p {
  margin: 0;
}

.balance-card strong {
  font-size: 1.35rem;
  color: var(--brand);
}

.balance-card p {
  color: var(--muted);
  line-height: 1.45;
}

.summary-card {
  padding: 22px;
  box-shadow: none;
}

.summary-card.accent {
  background: #123c3a;
  color: #fff;
  border-color: #123c3a;
}

.summary-card p {
  margin: 12px 0 8px;
  color: inherit;
  opacity: .75;
  font-weight: 800;
}

.summary-card strong {
  font-size: 1.8rem;
}

.card-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--gold);
  color: var(--brand);
  font-weight: 900;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(220px, .55fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.tool-panel {
  padding: 22px;
  box-shadow: none;
}

.request-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.request-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.request-item.selectable {
  cursor: pointer;
}

.request-item.selectable:focus,
.request-item.selectable:hover {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(143, 213, 198, .18);
}

.request-item h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.request-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.status-chip {
  align-self: start;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--brand);
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
}

.inline-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, .6fr) auto;
  gap: 10px;
  align-items: center;
}

.inline-filter input,
.inline-filter select,
.inline-filter button {
  min-height: 42px;
}

.service-filter {
  grid-template-columns: minmax(160px, 220px);
}

.profile-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.profile-list div {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.profile-list dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-list dd {
  margin: 0;
  line-height: 1.5;
}

.profile-tools {
  margin-top: 20px;
}

.response-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.response-form textarea {
  min-height: 74px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 33, 31, .42);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-panel {
  width: min(460px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-panel h2,
.modal-panel p {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1100px) {
  .admin-workspace .split-layout {
    grid-template-columns: 1fr;
  }

  .admin-workspace .inline-filter {
    grid-template-columns: minmax(180px, 1fr) minmax(140px, .7fr);
  }

  .admin-workspace .inline-filter button {
    grid-column: 1 / -1;
  }

  .admin-workspace .request-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-workspace .status-chip {
    justify-self: start;
  }
}

@media (max-width: 900px) {
  .auth-shell,
  .access-gate-shell,
  .workspace,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    gap: 28px;
    padding: 28px 0;
  }

  .auth-brand h1 {
    margin-top: 36px;
  }

  .side-nav {
    position: static;
    height: auto;
    padding: 16px;
    max-width: 100vw;
    overflow: hidden;
  }

  .side-nav nav {
    display: flex;
    gap: 8px;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .side-nav nav a {
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
  }

  #logoutButton {
    margin-top: 0;
  }

  .workspace-main {
    min-width: 0;
    max-width: 100%;
    padding: 20px;
  }

  .access-gate-shell {
    gap: 26px;
    align-items: start;
  }

  .access-route {
    padding-left: 24px;
  }
}

@media (max-width: 640px) {
  .auth-shell {
    width: min(100% - 24px, 1120px);
  }

  .access-gate-shell {
    width: min(100% - 24px, 1040px);
    padding: 24px 0;
  }

  .auth-panel,
  .auth-panel.wide,
  .tool-panel,
  .access-gate-card {
    padding: 20px;
  }

  .form-grid,
  .summary-grid,
  .balance-grid,
  .profile-list {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .auth-links,
  .topbar,
  .section-row,
  .request-item,
  .inline-filter {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .summary-card strong {
    font-size: 1.55rem;
  }

  .modal-actions {
    flex-direction: column;
  }
}

/* Global Route Map redesign for customer and operations workspaces */
.workspace {
  background:
    radial-gradient(circle at 82% 10%, rgba(231, 195, 97, .24), transparent 30%),
    linear-gradient(135deg, #f8f5ed 0%, #eef5f2 48%, #f6f4ef 100%);
}

.side-nav {
  background: rgba(255, 253, 248, .92);
  border-right-color: #ddd4c2;
  box-shadow: 12px 0 36px rgba(72, 58, 37, .04);
}

.side-nav nav a.active,
.side-nav nav a:hover {
  background: #f2ead8;
  color: #123c3a;
}

.workspace-main {
  width: min(1220px, 100%);
}

.route-hero,
.ops-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  padding: 28px;
  min-height: 230px;
  align-items: flex-start;
  color: #fff;
  border: 1px solid rgba(231, 195, 97, .28);
  border-radius: 10px;
  background:
    linear-gradient(120deg, rgba(18, 60, 58, .98), rgba(18, 60, 58, .78)),
    radial-gradient(circle at 82% 22%, rgba(231, 195, 97, .62), transparent 38%),
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.08) 75%, transparent 75%);
  background-size: auto, auto, 38px 38px;
  box-shadow: 0 24px 60px rgba(18, 60, 58, .18);
}

.route-hero::after,
.ops-hero::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -150px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(231, 195, 97, .26);
  border-radius: 50%;
}

.route-hero > *,
.ops-hero > * {
  position: relative;
  z-index: 1;
}

.route-hero .eyebrow,
.ops-hero .eyebrow {
  color: #f4d06f;
}

.route-hero h1,
.ops-hero h1 {
  max-width: 760px;
  font-size: clamp(2.35rem, 5vw, 4.85rem);
  line-height: .98;
}

.route-company,
.ops-hero .muted {
  max-width: 640px;
  margin: 18px 0 0;
  color: rgba(255,255,255,.78);
  font-size: 1.04rem;
  font-weight: 760;
  line-height: 1.6;
}

.route-hero .primary-action,
.ops-hero .primary-action {
  background: #f4d06f;
  color: #123c3a;
}

.content-band {
  border-top-color: rgba(104, 83, 42, .14);
}

.summary-card,
.balance-card,
.request-item,
.tool-panel,
.profile-list div {
  border-color: #ddd4c2;
  background: #fffdf8;
}

.summary-card.accent {
  background: #123c3a;
  border-color: #123c3a;
}

.card-icon {
  background: #f4d06f;
}

.route-stage-grid,
.ops-stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.route-stage-grid article,
.ops-stage-grid article {
  min-height: 142px;
  padding: 18px;
  border: 1px solid #ddd4c2;
  border-radius: 8px;
  background: #fffdf8;
}

.route-stage-grid span,
.ops-stage-grid span {
  display: inline-flex;
  margin-bottom: 16px;
  color: #9b7a25;
  font-weight: 950;
}

.route-stage-grid strong,
.ops-stage-grid strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.route-stage-grid p,
.ops-stage-grid p {
  margin: 0;
  color: #6b6251;
  line-height: 1.5;
}

.balance-card {
  position: relative;
  min-height: 165px;
}

.balance-card::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f4d06f 0 68%, #eadfc8 68% 100%);
}

.request-item {
  grid-template-columns: 54px minmax(0, 1fr) auto;
}

.request-item::before {
  content: "RO";
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #f2ead8;
  color: #123c3a;
  font-size: .72rem;
  font-weight: 950;
}

.status-chip {
  background: #f2ead8;
  color: #765d19;
}

.primary-action {
  background: #123c3a;
}

.secondary-action {
  background: #f2ead8;
  color: #123c3a;
}

.ghost-action {
  background: #fffdf8;
  border-color: #ddd4c2;
}

input,
select,
textarea {
  border-color: #d8ceb9;
  background: #fffdf8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #b99632;
  box-shadow: 0 0 0 4px rgba(244, 208, 111, .25);
}

@media (max-width: 900px) {
  .route-hero,
  .ops-hero {
    min-height: auto;
    padding: 24px;
  }

  .side-nav {
    box-shadow: none;
  }
}

@media (max-width: 760px) {
  .route-stage-grid,
  .ops-stage-grid,
  .summary-grid,
  .balance-grid {
    grid-template-columns: 1fr;
  }

  .request-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .request-item::before {
    display: none;
  }
}
