/* Advargo Partner Portal — white-label */
:root {
  --ink: #141634;
  --indigo: #3E4097;
  --indigo-deep: #262A6B;
  --mist: #EDEFF7;
  --mist-2: #F7F8FC;
  --paper: #FFFFFF;
  --signal: #FFC642;
  --muted: #5C5F7E;
  --line: #DDE0EE;
  --field: #C9CCE0;
  --ok: #1F8A5B;
  --warn: #B8541A;
  --err: #B42318;
  --brand: #3E4097;
  --on-brand: #FFFFFF;
  --display: 'Figtree', system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --r: 12px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); color: var(--ink); background: var(--mist-2); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
a:hover { color: var(--indigo-deep); }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.3px; }
h1 { font-weight: 800; font-size: clamp(26px, 3vw, 34px); }
h2 { font-weight: 700; font-size: 22px; }
h3 { font-weight: 700; font-size: 17px; }
p { margin: 0; }
img { max-width: 100%; }
.mono { font-family: var(--mono); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent; font: 700 15px var(--display); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { filter: brightness(0.92); color: var(--on-brand); }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--field); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-outline { background: var(--paper); color: var(--brand); border-color: var(--brand); }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.field input, .field select, .field textarea {
  min-height: 46px; border: 1px solid var(--field); border-radius: 8px; padding: 10px 14px;
  font: 400 15px var(--body); color: var(--ink); background: var(--paper); width: 100%;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input[type=color] { padding: 4px; width: 64px; }
.field input[type=file] { padding: 9px 10px; }
.field input:focus, .field select:focus, .field textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.field .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.field .err, .err-text { font-weight: 500; font-size: 13px; color: var(--err); }
.field.has-err input, .field.has-err select { border-color: var(--err); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; }
.input-group { display: flex; align-items: stretch; }
.input-group input { border-radius: 8px 0 0 8px; }
.input-group span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--field); border-left: 0; border-radius: 0 8px 8px 0; background: var(--mist-2); font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; border: 1px solid; }
.alert-ok { background: #E3F4EC; border-color: #B6E0CB; color: #145C3D; }
.alert-warn { background: #FFF4DC; border-color: #F4D58A; color: #6B4A00; }
.alert-error { background: #FDECEA; border-color: #F5C2BC; color: #8A1C12; }

/* ---------- Cards, tables, chips ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); background: var(--mist-2); padding: 12px 20px; }
.tbl td { padding: 14px 20px; border-top: 1px solid var(--mist); vertical-align: middle; }
.tbl td.strong { font-weight: 600; }
.tbl tr.link-row:hover td { background: var(--mist-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--mist); color: #3A3D5C; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi .v { font: 800 36px var(--display); line-height: 1.1; }
.pipe { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--mist); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: #3A3D5C; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ---------- Top bar (plain pages) ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 4vw, 56px); border-bottom: 1px solid var(--line); background: var(--paper); }
.wordmark { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.wordmark b { font: 800 26px var(--display); letter-spacing: -0.5px; }
.wordmark .tag { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; padding: 4px 8px; border: 1px solid var(--indigo); color: var(--indigo); border-radius: 4px; }
.wordmark img { max-height: 40px; width: auto; }
.topnav { display: flex; flex-wrap: wrap; gap: 24px; font-size: 15px; }
.topnav a { text-decoration: none; }

/* ---------- Sign-in split ---------- */
.split { display: flex; flex-wrap: wrap; flex: 1; align-items: stretch; }
.split-dark { flex: 1 1 520px; background: var(--ink); color: #FFF; padding: clamp(32px, 5vw, 72px) clamp(16px, 5vw, 72px); display: flex; flex-direction: column; gap: 40px; }
.split-dark.branded { background: var(--brand); color: var(--on-brand); }
.split-dark .kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; color: var(--signal); }
.split-dark.branded .kicker { color: inherit; opacity: .8; }
.split-dark h1 { font-size: clamp(34px, 4.4vw, 56px); line-height: 1.05; letter-spacing: -1px; max-width: 560px; }
.split-dark .lede { font-size: 17px; line-height: 1.6; color: #C9CBE4; max-width: 520px; }
.split-dark.branded .lede { color: inherit; opacity: .85; }
.track { list-style: none; margin: 0; padding: 0; max-width: 460px; }
.track li { display: flex; gap: 16px; }
.track .rail { display: flex; flex-direction: column; align-items: center; width: 20px; }
.track .node { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; border: 2px solid #6A6DA6; }
.track .node.done { background: var(--signal); border-color: var(--signal); }
.track .node.now { background: var(--ink); border: 3px solid var(--signal); }
.track .line { flex: 1; width: 2px; min-height: 28px; background: #34376E; }
.track .line.done { background: var(--signal); }
.track .txt { padding-bottom: 18px; display: flex; flex-direction: column; gap: 2px; }
.track .txt b { font: 600 16px var(--display); }
.track .txt span { font-size: 13px; color: #A9ACCF; }
.split-dark.branded .track .node { border-color: currentColor; opacity: .7; }
.split-dark.branded .track .line { background: currentColor; opacity: .3; }
.split-dark.branded .track .txt span { color: inherit; opacity: .75; }
.split-form { flex: 1 1 440px; display: flex; align-items: center; justify-content: center; padding: clamp(32px, 5vw, 72px) 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 32px; display: flex; flex-direction: column; gap: 22px; }
.auth-card.wide { max-width: 640px; }
.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--mist); border-radius: 10px; }
.tabs a { display: flex; align-items: center; justify-content: center; height: 44px; border-radius: 8px; font: 600 15px var(--display); text-decoration: none; color: var(--muted); }
.tabs a.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(20,22,52,.12); }
.foot-note { border-top: 1px solid var(--line); padding-top: 18px; font-size: 14px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 20px clamp(16px, 4vw, 56px); font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); background: var(--paper); }

/* ---------- Agent shell ---------- */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--ink); color: #FFF; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.side .who { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.side .badge { width: 40px; height: 40px; border-radius: 10px; background: var(--signal); color: var(--ink); display: flex; align-items: center; justify-content: center; font: 800 15px var(--display); overflow: hidden; flex: none; }
.side .badge img { width: 100%; height: 100%; object-fit: contain; background: #FFF; }
.side .who b { font: 700 16px var(--display); display: block; }
.side .who span { font-size: 12px; color: #A9ACCF; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px; border-radius: 8px; text-decoration: none; font-size: 15px; color: #C9CBE4; }
.side nav a:hover { background: #22255A; color: #FFF; }
.side nav a.on { background: #2C2F66; color: #FFF; font-weight: 600; }
.side .bottom { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.side .bottom a { color: #C9CBE4; }
.main { flex: 999 1 640px; min-width: 0; padding: clamp(20px, 3vw, 40px); display: flex; flex-direction: column; gap: 28px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.addr { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: var(--mist-2); border-radius: 8px; flex-wrap: wrap; }
.addr .mono { font-size: 14px; word-break: break-all; }
.state-live { font-size: 13px; font-weight: 600; color: var(--ok); }
.state-wait { font-size: 13px; font-weight: 600; color: var(--warn); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.money { font: 800 24px var(--display); }
details.drawer > summary { list-style: none; cursor: pointer; }
details.drawer > summary::-webkit-details-marker { display: none; }

/* ---------- Student shell (agent-branded) ---------- */
.s-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px clamp(16px, 4vw, 56px); background: var(--brand); color: var(--on-brand); }
.s-head .logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.s-head .logo .mark { width: 40px; height: 40px; border-radius: 50%; background: #FFF; color: var(--brand); display: flex; align-items: center; justify-content: center; font: 800 15px var(--display); overflow: hidden; flex: none; }
.s-head .logo .mark img { width: 100%; height: 100%; object-fit: contain; }
.s-head .logo b { font: 700 20px var(--display); }
.s-head nav { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; font-size: 15px; }
.s-head nav a { color: inherit; text-decoration: none; }
.s-head nav a:hover { text-decoration: underline; color: inherit; }
.s-head .avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font: 600 13px var(--display); }
.s-main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: clamp(20px, 3vw, 40px) 16px; display: flex; flex-direction: column; gap: 24px; }
.progress { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.progress .step { display: flex; flex-direction: column; gap: 8px; }
.progress .bar { height: 6px; border-radius: 3px; background: #E2E2DE; }
.progress .step.done .bar { background: var(--brand); }
.progress .step.now .bar { background: var(--brand); opacity: .5; }
.progress .step b { font: 600 15px var(--display); }
.progress .step span { font-size: 13px; color: var(--muted); }
.panes { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.panes > * { flex: 1 1 380px; min-width: 0; }
.doclist { list-style: none; margin: 0; padding: 0; }
.doclist li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #EFEFEC; }
.doclist .files { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.doclist .received { font-size: 13px; font-weight: 600; color: var(--ok); }
.upload-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.upload-form input[type=file] { font-size: 13px; max-width: 230px; color: var(--muted); }
input[type=file]::file-selector-button { font: 600 13px var(--display); border: 1px solid var(--field); background: var(--mist-2); color: var(--ink); border-radius: 6px; padding: 7px 10px; margin-right: 8px; cursor: pointer; }
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.bubble { max-width: 85%; border-radius: 12px; padding: 10px 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.bubble.them { align-self: flex-start; background: #F1F1EE; }
.bubble.me { align-self: flex-end; background: var(--brand); color: var(--on-brand); }
.bubble .meta { display: block; font-size: 11px; opacity: .75; margin-top: 4px; }

@media (max-width: 640px) {
  .auth-card { padding: 24px 18px; }
  .side { flex-basis: 100%; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
}
