:root {
  color-scheme: light;
  --paper: #f2f2ed;
  --gray: #8d8f96;
  --gold: #e8ac3f;
  --rust: #9e4e2c;
  --ink: #23282e;
  --white: #fff;
  --muted: #5a5f65;
  --border: #dbdcd4;
  --surface-warm: #f3e9d6;
  --shadow: 0 16px 44px rgba(35, 40, 46, 0.07);
  font-family: Inter, Aptos, system-ui, sans-serif;
  font-size: 16px;
  font-synthesis: none;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { display: flex; min-width: 280px; min-height: 100vh; margin: 0; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--rust); text-underline-offset: 0.22em; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--rust); outline-offset: 4px; }

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  transform: translateY(-150%);
  padding: 0.7rem 1rem;
  border-radius: 0.4rem;
  background: var(--white);
}
.skip-link:focus { transform: translateY(0); }

.site-header, .site-footer { background: var(--white); }
.site-header { border-bottom: 1px solid var(--border); }
.site-footer { border-top: 1px solid var(--border); margin-top: auto; }
.site-header-inner, .site-footer-inner, .portal-main { width: min(100% - 3rem, 75rem); margin-inline: auto; }
.site-header-inner, .site-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-header-inner { min-height: 5.1rem; }
.site-footer-inner { min-height: 4.1rem; color: var(--muted); font-size: 0.875rem; }
.site-footer a { font-weight: 650; }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--ink); text-decoration: none; }
.brand img { flex: none; border-radius: 50%; object-fit: cover; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-size: 1.18rem; font-weight: 800; letter-spacing: -0.025em; }
.brand-text span { margin-top: 0.18rem; color: var(--muted); font-size: 0.73rem; font-weight: 650; }
.site-nav { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.35rem; }
.site-nav a { padding: 0.55rem 0.75rem; border-radius: 0.42rem; color: var(--ink); font-size: 0.875rem; font-weight: 650; text-decoration: none; }
.site-nav a:hover { background: var(--paper); }
.site-nav a[aria-current="page"] { background: var(--surface-warm); color: #76381f; }

.portal-main { flex: 1; padding-block: clamp(1.8rem, 4.2vw, 4rem); }
.portal-content { min-width: 0; }
.portal-notice { margin-bottom: 1.25rem; }
.portal-notice[hidden] { margin: 0; }
.loading { margin: 1rem 0; color: var(--muted); }
.notice { padding: 0.85rem 1rem; border: 1px solid #d4c09d; border-radius: 0.5rem; background: #faf4e7; line-height: 1.5; }
.notice-error { border-color: #d8b2a2; background: #fff2ec; color: #743720; }
.notice-success { border-color: #b9d1b9; background: #eef6ee; color: #24532e; }

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  min-height: 34rem;
  overflow: hidden;
  max-width: 65rem;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--white);
  box-shadow: var(--shadow);
}
.auth-aside {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 4.5vw, 4.4rem);
  border-right: 1px solid #e5d8c1;
  background: radial-gradient(ellipse at 12% 8%, #fbf3e3, transparent 80%), var(--surface-warm);
}
.auth-aside img { border-radius: 50%; box-shadow: 0 12px 28px rgba(35, 40, 46, 0.17); }
.auth-aside h2 { max-width: 11ch; margin: 1.25rem 0 0.8rem; font-size: clamp(1.8rem, 3.7vw, 3.05rem); line-height: 1.09; letter-spacing: -0.045em; }
.auth-aside p, .panel-header p, .workspace-hero p { margin: 0; color: var(--muted); line-height: 1.58; }
.auth-panel { display: flex; padding: clamp(1.6rem, 4.5vw, 4rem); flex-direction: column; justify-content: center; min-width: 0; }
.panel-header { margin-bottom: 1.65rem; }
.panel-header h1, .workspace-hero h1 { margin: 0 0 0.45rem; font-size: clamp(1.9rem, 3.7vw, 2.9rem); line-height: 1.1; letter-spacing: -0.045em; overflow-wrap: anywhere; }
.panel-header .eyebrow, .eyebrow { display: block; margin-bottom: 0.7rem; color: var(--rust); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.115em; text-transform: uppercase; }
.auth-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem 1rem; margin-top: 1.3rem; }
.text-link { padding: 0; border: 0; background: transparent; color: var(--rust); font-weight: 650; text-decoration: underline; text-underline-offset: 0.23em; }

.form { display: grid; gap: 1rem; }
.field { display: grid; min-width: 0; gap: 0.4rem; }
.field label { font-size: 0.89rem; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.85rem;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--gray);
  border-radius: 0.45rem;
  background: #fff;
}
.field textarea { resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.field-hint { color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem; margin-top: 0.1rem; }
.auth-panel .form-actions .button-primary { width: 100%; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.55rem 0.8rem;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 0.48rem;
  font-weight: 730;
  line-height: 1.25;
  text-decoration: none;
}
.button-primary { background: var(--gold); color: var(--ink); }
.button-primary:hover:not(:disabled) { background: #dfa135; }
.button-outline { border-color: var(--border); background: var(--white); color: var(--ink); }
.button-outline:hover:not(:disabled) { border-color: var(--gray); background: var(--paper); }
.button:disabled { opacity: 0.65; cursor: default; }
.site-nav .button { min-height: 2.3rem; font-size: 0.88rem; }

.workspace { display: grid; gap: 1.15rem; }
.workspace-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.1rem;
  padding: clamp(1.35rem, 3vw, 2.2rem);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--white);
  box-shadow: var(--shadow);
}
.workspace-hero h1 { font-size: clamp(1.6rem, 3.35vw, 2.6rem); }
.workspace-hero .eyebrow { margin-bottom: 0.5rem; }
.workspace-hero .field { width: min(100%, 20rem); }
.workspace-hero .hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.28rem 0.55rem;
  border-radius: 2rem;
  background: #ebede9;
  color: #444b43;
  font-size: 0.77rem;
  font-weight: 700;
  line-height: 1.25;
}
.status-positive { background: #eaf4e8; color: #2f5633; }
.status-attention { background: #faeed4; color: #704a0d; }

.workspace-grid { display: grid; grid-template-columns: 12.1rem minmax(0, 1fr); align-items: start; gap: 1.15rem; }
.workspace-nav { display: grid; gap: 0.28rem; padding: 0.65rem; border: 1px solid var(--border); border-radius: 0.7rem; background: var(--white); }
.workspace-nav a { display: block; padding: 0.67rem 0.74rem; border-radius: 0.42rem; color: var(--ink); font-size: 0.9rem; font-weight: 650; text-decoration: none; }
.workspace-nav a:hover { background: var(--paper); }
.workspace-nav a[aria-current="location"] { background: var(--surface-warm); color: #76381f; }
.admin-nav { display: flex; flex-wrap: wrap; }
.workspace-view { display: grid; min-width: 0; gap: 1.05rem; }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.7rem; padding: 0 0.2rem; }
.section-header h2, .data-card h2, .data-card h3 { margin: 0; letter-spacing: -0.026em; }
.section-header h2, .data-card h2 { font-size: 1.43rem; }
.data-card h3 { font-size: 1.08rem; }
.section-header p { margin: 0.25rem 0 0; color: var(--muted); line-height: 1.5; }
.data-card { min-width: 0; padding: clamp(1rem, 2.1vw, 1.45rem); border: 1px solid var(--border); border-radius: 0.68rem; background: var(--white); }
.data-card > :first-child { margin-top: 0; }
.data-card > :last-child { margin-bottom: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.metric { display: grid; gap: 0.3rem; }
.metric strong { font-size: clamp(1.55rem, 3vw, 2.35rem); line-height: 1.1; letter-spacing: -0.035em; }
.metric span { color: var(--muted); font-size: 0.88rem; font-weight: 660; }
.empty-state { margin: 0; color: var(--muted); line-height: 1.55; }
.data-card h2 + .empty-state, .data-card h3 + .empty-state { margin-top: 0.7rem; }

.record-table { width: 100%; margin-top: 0.8rem; border-collapse: collapse; text-align: left; }
.table-scroll { overflow-x: auto; overscroll-behavior-inline: contain; }
.record-table th, .record-table td { padding: 0.72rem 0.65rem; border-bottom: 1px solid #e9eae4; vertical-align: top; font-size: 0.86rem; }
.record-table th { color: var(--muted); font-size: 0.8rem; font-weight: 730; white-space: nowrap; }
.record-table tbody tr:last-child td { border-bottom: 0; }
.record-table td:first-child, .record-table th:first-child { padding-left: 0.1rem; }
.record-table td:last-child, .record-table th:last-child { padding-right: 0.1rem; }
.cell-title { display: block; font-weight: 710; overflow-wrap: anywhere; }
.cell-detail { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.81rem; line-height: 1.45; overflow-wrap: anywhere; }
.account-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; margin: 0.8rem 0 0; }
.account-details div { min-width: 0; }
.account-details dt { color: var(--muted); font-size: 0.81rem; font-weight: 680; }
.account-details dd { margin: 0.22rem 0 0; overflow-wrap: anywhere; }
.pagination { display: flex; justify-content: flex-end; margin-top: 0.95rem; }

.completion-center { display: grid; gap: 0.85rem; }
.completion-card { display: grid; gap: 1rem; }
.completion-card > .field, .completion-card .form { max-width: 47rem; }
.completion-card .account-details { margin-top: 0; }
.completion-help { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
.completion-confirmation { display: flex; gap: 0.65rem; align-items: flex-start; }
.completion-confirmation input { flex: none; width: 1.1rem; height: 1.1rem; margin: 0.16rem 0 0; accent-color: var(--rust); }
.completion-confirmation label { line-height: 1.5; }

.customer-identity { margin: 0; overflow-wrap: anywhere; }
.customer-hero p { overflow-wrap: anywhere; }
.customer-hero strong { color: var(--ink); }
.customer-plans { display: grid; gap: 1rem; padding-top: 0.5rem; }
.customer-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  align-items: stretch;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.customer-plan { display: flex; flex-direction: column; gap: 0.7rem; border-top: 3px solid var(--gold); }
.customer-plan h3 { font-size: 1.04rem; line-height: 1.3; }
.customer-plan-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem; margin: 0; }
.customer-plan-price strong { color: var(--rust); font-size: clamp(1.55rem, 2.8vw, 2.1rem); line-height: 1.1; letter-spacing: -0.04em; }
.customer-plan-price span, .customer-plan-term { color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.customer-plan-allowance { margin: 0; font-size: 0.9rem; font-weight: 650; }
.customer-plan-term { margin: 0; }
.customer-plan-contact { display: flex; justify-content: flex-start; }

.mfa-setup { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.mfa-setup img { width: 9.5rem; height: 9.5rem; flex: none; padding: 0.35rem; border: 1px solid var(--border); border-radius: 0.4rem; background: var(--white); }
.mfa-key { max-width: 100%; padding: 0.55rem 0.65rem; border: 1px solid var(--border); border-radius: 0.4rem; background: var(--paper); overflow-wrap: anywhere; user-select: all; }

@media (max-width: 56rem) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .workspace-nav { display: flex; flex-wrap: wrap; }
  .workspace-nav a { white-space: nowrap; }
}

@media (max-width: 42rem) {
  .site-header-inner, .site-footer-inner, .portal-main { width: min(100% - 2rem, 75rem); }
  .site-header-inner { align-items: flex-start; flex-direction: column; gap: 0.6rem; padding-block: 0.8rem; }
  .site-nav { justify-content: flex-start; }
  .auth-layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-aside { flex-direction: row; align-items: center; justify-content: flex-start; gap: 0.85rem; padding: 1.05rem 1.2rem; border: 0; border-bottom: 1px solid #e5d8c1; }
  .auth-aside img { width: 3.1rem; height: 3.1rem; box-shadow: none; }
  .auth-aside h2 { max-width: none; margin: 0 0 0.2rem; font-size: 1.2rem; }
  .auth-aside p { font-size: 0.83rem; }
  .auth-panel { padding-block: 1.6rem 1.5rem; }
  .workspace-hero { align-items: flex-start; flex-direction: column; }
  .workspace-nav { overflow-x: auto; flex-wrap: nowrap; }
  .metric-grid { gap: 0.5rem; }
  .metric { padding: 0.85rem 0.7rem; }
  .metric span { font-size: 0.75rem; }
  .site-footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 0.4rem; padding-block: 0.85rem; }
}

@media (max-width: 26rem) {
  .form-row, .account-details { grid-template-columns: minmax(0, 1fr); }
}
