/* ==========================================================================
   Bearing Digital — Client Portal
   Cool, restrained agency palette. Mobile-first. Light + dark.
   ========================================================================== */
:root {
  --ground: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --ink: #101418;
  --body: #4a5560;
  --muted: #77848f;
  --line: #e1e7ec;
  --accent: #2f6f8f;
  --accent-dark: #215169;
  --accent-soft: #e6f0f5;
  --danger: #b3392c;
  --danger-soft: #fbeae7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,20,24,.04), 0 8px 26px rgba(16,20,24,.07);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0f1418; --surface: #171e24; --surface-2: #1e272e;
    --ink: #e9eef2; --body: #aab6c0; --muted: #7d8b96; --line: #28333b;
    --accent: #6aaecb; --accent-dark: #8cc4dc; --accent-soft: #16262f;
    --danger: #e08379; --danger-soft: #2a1512;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.42);
  }
}
:root[data-theme="light"] {
  --ground:#f6f8fa; --surface:#ffffff; --surface-2:#eef2f5; --ink:#101418; --body:#4a5560;
  --muted:#77848f; --line:#e1e7ec; --accent:#2f6f8f; --accent-dark:#215169;
  --accent-soft:#e6f0f5; --danger:#b3392c; --danger-soft:#fbeae7;
  --shadow:0 1px 2px rgba(16,20,24,.04), 0 8px 26px rgba(16,20,24,.07);
}
:root[data-theme="dark"] {
  --ground:#0f1418; --surface:#171e24; --surface-2:#1e272e; --ink:#e9eef2; --body:#aab6c0;
  --muted:#7d8b96; --line:#28333b; --accent:#6aaecb; --accent-dark:#8cc4dc;
  --accent-soft:#16262f; --danger:#e08379; --danger-soft:#2a1512;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.42);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--ground); color: var(--body);
  font-family: var(--sans); font-size: 16.5px; line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -.015em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: 54rem; margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2rem); }
.eyebrow {
  font-size: .68rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent);
}

/* ---- brand lockup ---- */
.lockup { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.lockup-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .95rem;
  letter-spacing: -.03em; flex: none;
}
.lockup-text { font-weight: 700; color: var(--ink); font-size: 1rem; letter-spacing: -.01em; line-height: 1.1; }
.lockup-text span { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); }

/* ---- top bar (signed in) ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .75rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; font-size: .88rem; }
.who { color: var(--muted); }
.who b { color: var(--ink); font-weight: 650; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 650; font-size: .95rem; padding: .72rem 1.2rem;
  border-radius: 9px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-quiet { background: transparent; color: var(--body); border-color: var(--line); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-block { width: 100%; }

/* ---- login ---- */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 2rem 0 3rem; }
.login-card {
  width: min(24rem, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: clamp(1.4rem, 4vw, 2rem); box-shadow: var(--shadow);
}
.login-head { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.5rem; }
.login-head h1 { font-size: 1.35rem; }
.login-head p { color: var(--muted); font-size: .93rem; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field label { font-size: .84rem; font-weight: 650; color: var(--ink); }
.field input {
  font: inherit; padding: .75rem .85rem; border: 1.5px solid var(--line);
  border-radius: 9px; background: var(--ground); color: var(--ink); width: 100%;
}
.field input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.field .hint { font-size: .78rem; color: var(--muted); }
.alert {
  background: var(--danger-soft); color: var(--danger); border: 1px solid currentColor;
  border-radius: 9px; padding: .7rem .85rem; font-size: .88rem; margin-bottom: 1.1rem;
}
.login-foot { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line);
  font-size: .82rem; color: var(--muted); text-align: center; }

/* ---- dashboard ---- */
.page-head { padding-block: clamp(1.75rem, 5vw, 2.75rem) 1.25rem; }
.page-head .eyebrow { display: block; margin-bottom: .45rem; }
.page-head p.sub { color: var(--muted); margin-top: .5rem; }

.doc-list { display: flex; flex-direction: column; gap: .85rem; padding-bottom: 4rem; }
.doc-card {
  display: flex; align-items: center; gap: 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.05rem 1.15rem;
  text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.doc-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.doc-icon {
  width: 40px; height: 40px; border-radius: 9px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; flex: none;
}
.doc-icon svg { width: 19px; height: 19px; }
.doc-meta { flex: 1; min-width: 0; }
.doc-kind { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.doc-title { color: var(--ink); font-weight: 650; font-size: 1.02rem; margin-top: .1rem; }
.doc-sum { color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.doc-date { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.doc-card .chev { color: var(--muted); flex: none; }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 2rem 1.25rem; text-align: center; color: var(--muted); }

/* ---- document view ---- */
.doc-bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.doc-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .7rem; }
.back { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; text-decoration: none; color: var(--body); }
.back:hover { color: var(--accent); }
.doc-frame { padding-bottom: 5rem; }

/* ---- footer ---- */
.portal-foot { border-top: 1px solid var(--line); padding-block: 1.4rem 2.5rem; color: var(--muted); font-size: .82rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
