/* Bature Client Portal. Brand tokens and rules: see DESIGN.md (derived from the Bature Digital website). */
:root {
  --ground: #FAF9FC; --surface: #FFFFFF; --surface-2: #F2F0F5; --ink: #14101C; --ink-2: #322B42; --muted: #524A63; --line: #E6E3EA;
  --accent: #3B0E6A; --accent-btn: #3B0E6A; --accent-hover: #4A0E85; --accent-ink: #FFFFFF; --accent-soft: #ECE2F5; --brand-deep: #1E0438;
  --highlight: #F1C518; --highlight-ink: #1E0438; --highlight-soft: #FEF7DC; --warn: #8A6E06;
  --danger: #B5302A; --danger-soft: #FBE5E3; --success: #167A4B; --success-soft: #E1F4E9;
  --shadow-sm: 0 2px 6px rgba(30, 4, 56, 0.08); --shadow-md: 0 8px 20px rgba(30, 4, 56, 0.10); --shadow-brand: 0 16px 40px rgba(59, 14, 106, 0.30);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --radius: 10px; --radius-lg: 16px; --ease: cubic-bezier(0.22, 1, 0.36, 1); --dur: 140ms;
  --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif; --font-display: Quicksand, var(--font);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #14101C; --surface: #1F1A2A; --surface-2: #322B42; --ink: #F2F0F5; --ink-2: #CAC6CF; --muted: #A39DAC; --line: #322B42;
    --accent: #A77FD0; --accent-btn: #5B14A0; --accent-hover: #7B3DB8; --accent-ink: #FFFFFF; --accent-soft: #2D0A52; --brand-deep: #0B0613;
    --highlight-soft: #3A2E12; --warn: #F5D24A; --danger: #F28B82; --danger-soft: #3B1F1D; --success: #7BD88F; --success-soft: #173A22;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4); --shadow-brand: 0 8px 24px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 18px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
h1 { font-size: 32px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--s3); text-wrap: balance; }
h2 { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; margin: 0 0 var(--s3); text-wrap: balance; }
p { margin: 0 0 var(--s3); max-width: 64ch; }
.lede { font-size: 20px; color: var(--ink-2); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
code, .mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 16px; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: var(--s1); overflow-wrap: anywhere; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: var(--s3) var(--s4); z-index: 10; }
.skip:focus { left: var(--s4); top: var(--s4); }

/* top bar: brand strip, logo, nav */
.strip { height: 4px; background: linear-gradient(90deg, var(--brand-deep) 0%, #3B0E6A 55%, var(--highlight) 100%); }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: var(--s3) var(--s6); padding: var(--s3) var(--s6); background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--ink); }
.brand img { height: 40px; width: auto; display: block; }
.brand .logo-dark { display: none; }
.brand .tag { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--accent); padding-left: var(--s3); border-left: 1px solid var(--line); line-height: 1.2; }
@media (prefers-color-scheme: dark) { .brand .logo-light { display: none; } .brand .logo-dark { display: block; } }
.top nav { display: flex; gap: var(--s2) var(--s6); align-items: center; flex-wrap: wrap; }
.top nav a { color: var(--ink); text-decoration: none; font-weight: 500; padding: var(--s2) 0; position: relative; }
.top nav a::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--accent); transition: width var(--dur) var(--ease); }
.top nav a:hover, .top nav a[aria-current] { color: var(--accent); }
.top nav a:hover::after, .top nav a[aria-current]::after { width: 100%; }
main { max-width: 1040px; margin: 0 auto; padding: var(--s8) var(--s6) 80px; }
@media (max-width: 480px) { main { padding: var(--s5) var(--s4) 64px; } .top { padding: var(--s3) var(--s4); } .brand img { height: 34px; } .brand .tag { display: none; } }
footer { display: flex; justify-content: center; align-items: center; gap: var(--s2); color: var(--muted); font-size: 15px; padding: var(--s6) var(--s4) var(--s8); }
footer img { height: 18px; width: auto; opacity: .8; }
section { margin-bottom: var(--s10); }
.narrow { max-width: 560px; }
.crumb { font-size: 16px; color: var(--muted); margin-bottom: var(--s2); }
.eyebrow { font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.titlebar { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.count { display: inline-block; background: var(--surface-2); color: var(--ink-2); border-radius: 999px; font-size: 15px; padding: 1px 10px; margin-left: var(--s2); vertical-align: middle; font-weight: 600; }

.flash { background: var(--accent-soft); color: var(--ink); border-left: 5px solid var(--accent); padding: var(--s3) var(--s4); border-radius: var(--radius); margin-bottom: var(--s6); font-weight: 600; }
.devbox { background: var(--highlight-soft); border-left: 5px solid var(--highlight); padding: var(--s3) var(--s4); border-radius: var(--radius); margin-top: var(--s5); word-break: break-all; font-size: 16px; }

/* forms */
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack.compact { margin-top: var(--s3); }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; margin-top: var(--s3); }
.row input { flex: 1 1 180px; }
.field label { display: block; font-weight: 600; margin-bottom: var(--s1); font-size: 17px; }
.field .req { font-weight: 400; color: var(--muted); font-size: 15px; }
.help { color: var(--muted); font-size: 16px; margin-top: var(--s1); }
.error { color: var(--danger); font-weight: 600; margin-top: var(--s1); }
.has-error input, .has-error textarea { border-color: var(--danger); }
label.check { display: flex; align-items: center; gap: var(--s3); font-weight: 600; min-height: 48px; }
input[type=text], input[type=email], input[type=number], input[type=url], input[type=date], textarea, input:not([type]) {
  width: 100%; min-height: 48px; font: inherit; padding: var(--s3) 14px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent-btn); }
input[type=file] { font: inherit; }
button, .button { font: inherit; font-weight: 600; min-height: 48px; padding: var(--s3) var(--s6); border-radius: 999px; border: 1.5px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
button:hover, .button:hover { background: var(--accent); color: var(--accent-ink); }
button:active, .button:active { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--accent-btn); color: var(--accent-ink); border-color: var(--accent-btn); box-shadow: var(--shadow-sm); }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: var(--shadow-brand); transform: translateY(-2px); }
button.linklike { background: none; border: none; padding: var(--s2) var(--s1); min-height: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; border-radius: var(--s1); }
button.linklike:hover { background: none; color: var(--accent-hover); }
button.linklike.danger { color: var(--danger); }
button.linklike.danger:hover { color: var(--danger); }
form.inline { display: inline; margin-left: var(--s2); }
@media (prefers-reduced-motion: reduce) { button, .button, .tile, .top nav a::after { transition: none; } button.primary:hover { transform: none; } }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); }
.tile { display: flex; flex-direction: column; gap: var(--s2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5); text-decoration: none; color: var(--ink); min-height: 48px; box-shadow: var(--shadow-sm); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.tile:hover, .tile:focus-visible { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tile:active { transform: translateY(0); }
.tile-name { font-weight: 600; font-size: 20px; line-height: 1.25; color: var(--accent); }
.tile-desc { color: var(--ink-2); font-size: 16px; }
.tile-meta { color: var(--muted); font-size: 15px; font-weight: 500; margin-top: var(--s1); }
.tile.small { padding: var(--s4) var(--s5); justify-content: center; }
.tile.add { border-style: dashed; box-shadow: none; }

/* cards and lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5) var(--s6); box-shadow: var(--shadow-sm); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); margin-bottom: var(--s5); }
@media (max-width: 720px) { .cols { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: var(--s3); } }
.note { background: var(--highlight-soft); border-left: 5px solid var(--highlight); padding: var(--s3) 14px; border-radius: var(--radius); margin-top: 14px; }

.reqlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.reqlist li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s4) var(--s5); display: grid; grid-template-columns: 1fr auto; gap: var(--s2) var(--s4); align-items: center; box-shadow: var(--shadow-sm); }
.reqlist .t { font-weight: 600; font-size: 19px; }
.reqlist .m { color: var(--muted); font-size: 16px; }
.reqlist .pill { justify-self: end; }
@media (max-width: 480px) { .reqlist li { grid-template-columns: 1fr; } .reqlist .pill { justify-self: start; } }

.files, .activity, .plain { list-style: none; padding: 0; margin: 0; }
.files li, .plain li { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.files li:last-child, .plain li:last-child { border-bottom: none; }
.files a { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 16px; overflow-wrap: anywhere; }
.activity li { padding: var(--s2) 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.activity li:last-child { border-bottom: none; }
.activity .when { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: var(--s2); }
.activity .detail { color: var(--ink-2); }
.approve { display: flex; gap: var(--s5); align-items: flex-start; flex-wrap: wrap; margin-top: var(--s5); }
.approve details { flex: 1 1 280px; }
.approve summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: var(--s3); min-height: 48px; display: flex; align-items: center; }

/* tables */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: var(--s3) 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: none; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: var(--s2) 0; }
  table.stack tr:last-child { border-bottom: none; }
  table.stack td { display: block; position: relative; border: none; padding: var(--s1) 14px var(--s1) 118px; min-height: 32px; }
  table.stack td::before { content: attr(data-label); position: absolute; left: 14px; top: 7px; width: 96px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
}

/* status */
.pill { display: inline-block; padding: var(--s1) var(--s3); border-radius: 999px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill.big { font-size: 15px; padding: var(--s2) 14px; }
.pill.s-running { background: var(--accent-soft); color: var(--accent); }
.pill.s-delivered { background: var(--highlight-soft); color: var(--warn); }
.pill.s-approved { background: var(--success-soft); color: var(--success); }
.pill.s-failed { background: var(--danger-soft); color: var(--danger); }
.met { color: var(--success); font-weight: 700; }
.missed { color: var(--danger); font-weight: 700; }

/* deadline bar: the signature */
.deadline { display: flex; flex-direction: column; gap: var(--s1); min-width: 140px; }
.deadline .t { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deadline .track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.deadline .fill { height: 100%; background: var(--accent-btn); border-radius: 999px; }
.deadline.amber .t { color: var(--warn); } .deadline.amber .fill { background: var(--highlight); }
.deadline.red .t, .deadline.over .t { color: var(--danger); } .deadline.red .fill, .deadline.over .fill { background: var(--danger); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s4) var(--s5); box-shadow: var(--shadow-sm); }
.stat-n { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--accent); }
.stat-l { color: var(--muted); font-size: 16px; margin-top: var(--s2); }

/* sign-in */
.signin { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 80px); }
.signin-brand { background: var(--brand-deep); color: #FFFFFF; padding: var(--s12) var(--s10); display: flex; flex-direction: column; justify-content: center; gap: var(--s6); }
.signin-brand img { width: min(320px, 70%); height: auto; }
.signin-brand p { color: rgba(255, 255, 255, 0.82); font-size: 20px; max-width: 30ch; }
.signin-brand .tag { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--highlight); }
.signin-form { padding: var(--s12) var(--s10); display: flex; flex-direction: column; justify-content: center; }
.signin-form .stack { max-width: 440px; }
@media (max-width: 760px) {
  .signin { grid-template-columns: 1fr; min-height: 0; }
  .signin-brand { padding: var(--s8) var(--s6); }
  .signin-brand img { width: 200px; }
  .signin-brand p { font-size: 18px; }
  .signin-form { padding: var(--s8) var(--s6); }
}
body.plain main { max-width: none; padding: 0; }
