/* AGELLID CONSULTING tokens, from BRAND.md */
@font-face {
  font-family: "Marcellus";
  src: url("/fonts/marcellus.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --navy: #202C62;
  --midnight: #151E4B;
  --periwinkle: #ACBDE0;

  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #EEF1F8;
  --text: #151E4B;
  --text-muted: #4A5478;
  --border: #DCE2EF;
  --border-input: #7D88AE;
  --focus: #3D55A8;

  --primary-bg: #202C62;
  --primary-fg: #FFFFFF;
  --secondary-bg: #E4EAF6;
  --secondary-fg: #202C62;
  --quiet-fg: #3D55A8;

  --ok-fg: #1E7A4C;   --ok-bg: #E7F5EE;
  --warn-fg: #8A5300; --warn-bg: #FFF6E5; --warn-line: #C77700;
  --err-fg: #B42318;  --err-bg: #FDECEA;

  --shadow: 0 1px 2px rgba(21, 30, 75, .06), 0 8px 24px rgba(21, 30, 75, .08);
  --card-border: transparent;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-display: "Marcellus", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1030;
    --surface: #141B45;
    --surface-2: #1C2556;
    --text: #EEF1FA;
    --text-muted: #A9B3D1;
    --border: #2C3768;
    --border-input: #6E7BAE;
    --focus: #ACBDE0;

    --primary-bg: #ACBDE0;
    --primary-fg: #151E4B;
    --secondary-bg: #1C2556;
    --secondary-fg: #ACBDE0;
    --quiet-fg: #ACBDE0;

    --ok-fg: #6FD3A0;   --ok-bg: #12352A;
    --warn-fg: #F5C46B; --warn-bg: #2A2410; --warn-line: #E0A030;
    --err-fg: #FF8A80;  --err-bg: #3A1418;

    --shadow: none;
    --card-border: #2C3768;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

main { max-width: 560px; margin: 0 auto; padding: 8px 20px 32px; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 12px 20px;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { display: block; height: 36px; width: auto; }
.brandline { font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--text-muted); }

.display { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.15; letter-spacing: .04em; margin: 12px 0 6px; }
.ribbon { width: 56px; height: 3px; border-radius: 3px; background: var(--periwinkle); margin: 0 0 14px; }
.lead { color: var(--text-muted); margin: 0 0 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 20px 16px;
  margin: 0 0 16px;
}

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 52px; padding: 12px 20px; margin: 0 0 12px;
  border: 0; border-radius: 14px;
  font: 600 17px/1.2 var(--font-ui);
  cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-primary { background: var(--primary-bg); color: var(--primary-fg); }
.btn-secondary { background: var(--secondary-bg); color: var(--secondary-fg); }
.btn-quiet { background: transparent; color: var(--quiet-fg); }
.btn-link { background: none; border: 0; color: var(--quiet-fg); font: 600 15px var(--font-ui); min-height: 44px; padding: 0 4px; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1[tabindex="-1"]:focus { outline: none; } /* headings receive focus only to announce the new screen */

/* Forms */
label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.req { font-size: 11px; letter-spacing: .04em; text-transform: none; font-weight: 500; opacity: .85; }
input[type="text"], input[type="password"], input[type="date"] {
  display: block; width: 100%; min-height: 52px; padding: 12px 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-input); border-radius: 14px;
  font: 17px/1.3 var(--font-ui);
  -webkit-appearance: none; appearance: none;
}
input[type="date"] { line-height: 26px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
input:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
input.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

.field { margin: 0 0 16px; }
.fields .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fields .field:last-child { margin-bottom: 0; }
.fields .grid .field:nth-last-child(-n + 2) { margin-bottom: 0; }

.field.missing input { background: var(--warn-bg); border: 2px solid var(--warn-line); }
.field .hint { margin: 6px 0 0; font-size: 13px; color: var(--warn-fg); }
.field.invalid input { border: 2px solid var(--err-fg); }
.field.invalid .hint { color: var(--err-fg); }

/* Messages */
.msg { border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; font-size: 15px; }
.msg-error { background: var(--err-bg); color: var(--err-fg); }
.msg-warn { background: var(--warn-bg); color: var(--warn-fg); }
.msg-ok { background: var(--ok-bg); color: var(--ok-fg); }
.msg strong { font-weight: 650; }

/* Sign in */
.signin { text-align: center; padding-top: 6vh; }
.logo-full { width: 180px; height: auto; display: block; margin: 0 auto 8px; }
.signin .display { margin: 4px 0 24px; }
.signin form { text-align: left; }
.signin input { margin-bottom: 16px; }

/* Home */
.hero { display: flex; flex-direction: column; align-items: center; padding-top: 28px; }
.hero-icon { width: 64px; height: 64px; color: var(--periwinkle); margin-bottom: 20px; }
.hero .btn:last-child { margin-bottom: 0; }

/* Busy */
.busy { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 16px; }
.busy-text { color: var(--text-muted); margin: 16px 0 0; }
.thumb:not([src]) { display: none; }
.thumb { width: 120px; height: 160px; object-fit: cover; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--border); }
.center { display: flex; justify-content: center; padding-top: 30vh; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary-bg);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .btn { transition: none; } }

/* Review */
.invoice-image { padding: 12px; }
.invoice-image figcaption { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 4px 4px 10px; }
.invoice-image img { display: block; width: 100%; height: auto; border-radius: 12px; }
.actions.sticky {
  position: sticky; bottom: 0; z-index: 4;
  margin: 0 -20px; padding: 14px 20px calc(4px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 18px);
}
.actions.sticky .msg { margin-top: 10px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair .btn { margin-bottom: 8px; }

/* Result */
.result { text-align: center; padding: 32px 20px; }
.result .display { margin-top: 16px; }
.result-text { color: var(--text-muted); margin: 0 0 8px; }
.result-icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; }
.result-icon svg { width: 32px; height: 32px; }
.result.ok .result-icon { background: var(--ok-bg); color: var(--ok-fg); }
.result.warn .result-icon { background: var(--warn-bg); color: var(--warn-fg); }
.result.err .result-icon { background: var(--err-bg); color: var(--err-fg); }
.result-details { text-align: left; margin: 16px 0 0; font-size: 15px; }
.result-details div { padding: 10px 0; border-top: 1px solid var(--border); }
.result-details dt { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.result-details dd { margin: 2px 0 0; overflow-wrap: anywhere; }

@media (min-width: 600px) { main { padding-top: 24px; } }
