/* Vortal brand (vortal-website): Inter 400/500, Vortal blue #00b0e4, ink #141414 on paper #f7f7f7, navy-black #030b12 for dark surfaces, pill buttons. */
/* Vortal Partner Portal. Ported from the approved prototype. */
:root {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --ink: #141414;
  --muted: #737373;
  --line: #e2e2e2;
  --blue: #00b0e4;
  --accent: #008caf;
  --accent-soft: #e3f5fb;
  --on-blue: #03202b;
  --nav: #030b12;
  --nav-ink: #ffffff;
  --nav-muted: #8fa6b3;
  --nav-hover: #0d1c28;
  --ok: #1f7a46; --ok-bg: #e2f3e9;
  --warn: #8a5a00; --warn-bg: #fbf0d9;
  --bad: #c2410c; --bad-bg: #fdece4;
  --grey: #5f6870; --grey-bg: #eef0f2;
  --font: "Vortal Inter", Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050d14; --surface: #0b1620; --surface-2: #0e1b26; --ink: #e8ecef; --muted: #8fa3b0; --line: #1c2b37;
    --accent: #3cc8f0; --accent-soft: #0b2a3a; --on-blue: #03202b;
    --nav: #02080d; --nav-ink: #ffffff; --nav-muted: #7f97a5; --nav-hover: #0c1a25;
    --ok: #7fd3a0; --ok-bg: #12301f; --warn: #f2c26b; --warn-bg: #35290f; --bad: #ff9f7a; --bad-bg: #3a1c10; --grey: #a3adb5; --grey-bg: #1a252e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #050d14; --surface: #0b1620; --surface-2: #0e1b26; --ink: #e8ecef; --muted: #8fa3b0; --line: #1c2b37;
  --accent: #3cc8f0; --accent-soft: #0b2a3a; --on-blue: #03202b;
  --nav: #02080d; --nav-ink: #ffffff; --nav-muted: #7f97a5; --nav-hover: #0c1a25;
  --ok: #7fd3a0; --ok-bg: #12301f; --warn: #f2c26b; --warn-bg: #35290f; --bad: #ff9f7a; --bad-bg: #3a1c10; --grey: #a3adb5; --grey-bg: #1a252e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.02em; text-wrap: balance; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 17px; letter-spacing: -.01em; }
h3 { font-size: 14px; letter-spacing: 0; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* Shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--nav); color: var(--nav-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.brand svg { width: 28px; height: auto; flex: none; }
.brand small { display: block; font-size: 11.5px; font-weight: 400; color: var(--nav-muted); letter-spacing: .02em; }
.navgroup { display: grid; gap: 2px; }
.navgroup .label { font-size: 11px; letter-spacing: .06em; color: var(--nav-muted); padding: 0 10px 6px; }
.navbtn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--nav-ink); padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.navbtn:hover { background: var(--nav-hover); }
.navbtn[aria-current="page"] { background: var(--nav-hover); }
.navbtn svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; opacity: .85; }
.navbtn .count { margin-left: auto; background: var(--blue); color: var(--on-blue); font-size: 11px; font-weight: 600; border-radius: 50px; padding: 0 7px; }
.side .foot { margin-top: auto; display: grid; gap: 10px; padding: 0 8px; font-size: 12.5px; color: var(--nav-muted); }
.who { display: flex; gap: 10px; align-items: center; color: var(--nav-ink); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: var(--on-blue); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.who small { display: block; color: var(--nav-muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; padding-block: 12px; padding-left: 28px; padding-right: max(28px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.proto { font-size: 12px; color: var(--warn); background: var(--warn-bg); border-radius: 50px; padding: 3px 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 50px; padding: 2px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 50px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--nav); color: #fff; }
.content { padding-block: 28px 64px; padding-left: 28px; padding-right: max(28px, env(safe-area-inset-right, 0px)); display: grid; gap: 24px; max-width: 1280px; width: 100%; }
.pagehead { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.pagehead p { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumb button { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); overflow-x: auto; }
  .brand small, .side .foot, .navgroup .label { display: none; }
  .navgroup { display: flex; gap: 2px; }
  .navbtn { white-space: nowrap; padding: 7px 10px; }
  .navbtn[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--blue); }
  .topbar, .content { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}

/* Components */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 50px; padding: 8px 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.dark { background: var(--nav); border-color: var(--nav); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.card > .hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card > .bd { padding: 16px 18px; display: grid; gap: 12px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.cols-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1080px) { .cols-2, .cols-even { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1080px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; display: grid; gap: 4px; }
.tile .k { font-size: 12.5px; color: var(--muted); }
.tile .v { font-size: 26px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12.5px; color: var(--muted); }
.tile.alert { box-shadow: inset 0 3px 0 var(--warn); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 180px; }
th { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .03em; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
tbody tr.sel td { background: var(--accent-soft); }
td .sub { display: block; font-size: 12px; color: var(--muted); }
td.r, th.r { text-align: right; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; border-radius: 50px; padding: 2px 9px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-submitted { color: var(--accent); background: var(--accent-soft); }
.st-review { color: var(--warn); background: var(--warn-bg); }
.st-approved { color: var(--ok); background: var(--ok-bg); }
.st-rejected { color: var(--bad); background: var(--bad-bg); }
.st-won { color: var(--ok); background: var(--ok-bg); }
.st-won::before { border-radius: 1px; }
.st-lost, .st-expired, .st-withdrawn { color: var(--grey); background: var(--grey-bg); }
.flag { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--bad); font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 50px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.chip[aria-pressed="true"] { border-color: var(--nav); background: var(--nav); color: #fff; }

.list { display: grid; }
.list .row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.list .row:last-child { border-bottom: 0; }
.list .row .t { min-width: 0; }
.list .row .t b { font-weight: 500; }
.list .row .t span { display: block; color: var(--muted); font-size: 12.5px; }

.bar { height: 6px; border-radius: 6px; background: var(--grey-bg); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
.bar.warn > i { background: var(--warn); }

/* Forms */
form.reg { display: grid; gap: 16px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin: 0; padding: 0; min-width: 0; }
legend { display: contents; }
fieldset .fh { display: flex; gap: 12px; align-items: baseline; padding: 14px 18px; border-bottom: 1px solid var(--line); }
fieldset .fh .n { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; }
fieldset .fh h2 { font-size: 15px; }
fieldset .fh p { color: var(--muted); font-size: 12.5px; }
.fields { padding: 16px 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
@media (max-width: 640px) { .fields { grid-template-columns: minmax(0, 1fr); } }
.f { display: grid; gap: 5px; min-width: 0; }
.f.full { grid-column: 1 / -1; }
.f label, .f .lbl { font-size: 12.5px; font-weight: 500; }
.f label .req { color: var(--bad); }
.f label .opt { color: var(--muted); font-weight: 400; }
.f .hint { font-size: 12px; color: var(--muted); }
.f .err { font-size: 12px; color: var(--bad); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 8px 10px; font-size: 14px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; min-height: 72px; }
.radios { display: flex; flex-wrap: wrap; gap: 6px; }
.radios label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 50px; padding: 5px 12px; cursor: pointer; font-weight: 400; font-size: 13px; }
.radios input { accent-color: var(--blue); margin: 0; }
.radios label:has(input:checked) { border-color: var(--blue); background: var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.check input { margin-top: 3px; accent-color: var(--blue); }
.notice { border-radius: 8px; padding: 12px 14px; font-size: 13px; display: grid; gap: 4px; }
.notice.warn { background: var(--warn-bg); color: var(--ink); box-shadow: inset 3px 0 0 var(--warn); }
.notice.bad { background: var(--bad-bg); box-shadow: inset 3px 0 0 var(--bad); }
.notice.info { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--blue); }
.formbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }

/* Detail */
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
@media (max-width: 640px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
dl { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 12px; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--line); }
.timeline li:first-child .dot { background: var(--blue); }
.timeline .when { font-size: 12px; color: var(--muted); }
.protect { display: grid; gap: 8px; }
.protect .big { font-size: 28px; font-weight: 500; letter-spacing: -.02em; }

/* Login */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100%; }
.login .art { background: var(--nav); color: #fff; padding-block: 40px; padding-left: max(40px, env(safe-area-inset-left, 0px)); padding-right: 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login .art h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.08; max-width: 14ch; }
.login .art p { color: #c6dce5; max-width: 46ch; margin-top: 14px; font-size: 15px; }
.login .art ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: #c6dce5; }
.login .art li::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); margin-right: 10px; vertical-align: middle; }
.login .panel { padding-block: 40px; padding-left: 40px; padding-right: max(40px, env(safe-area-inset-right, 0px)); display: grid; align-content: center; justify-items: center; }
.login .panel .box { width: 100%; max-width: 380px; display: grid; gap: 16px; }
@media (max-width: 800px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .art, .login .panel { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
}
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Resources */
.res { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.resitem { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 10px; align-content: start; }
.resitem .ty { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.resitem .ty b { font-weight: 500; color: var(--accent); }
.resitem h3 { font-size: 14.5px; font-weight: 500; }
.resitem p { font-size: 13px; color: var(--muted); }
.resitem .ft { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Charts */
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 80px; gap: 12px; align-items: center; font-size: 13px; }
.hbar .track { height: 10px; background: var(--grey-bg); border-radius: 4px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
@media (max-width: 560px) { .hbar { grid-template-columns: 100px minmax(0, 1fr) 64px; } }

.toastbox { position: fixed; right: max(20px, env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--nav); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: 0 6px 24px rgba(0,0,0,.18); max-width: 360px; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .2s ease-out; } @keyframes rise { from { transform: translateY(6px); opacity: .4; } } }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }

/* App additions */
a.navbtn { text-decoration: none; }
.navbtn.as-form { font: inherit; }
form.inline { display: inline; margin: 0; }
.flash { background: var(--nav); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px; }
.auth-error { color: var(--bad); font-size: 13px; }
.page-narrow { max-width: 720px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.login .panel .box form { display: grid; gap: 14px; }
.link-btn { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
[hidden] { display: none !important; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], select { height: 40px; }
