/* StoneLink client portal.
   Deliberately calm and fast — no canvas background, no animation. This is a
   page the client checks between other things, not a landing page. Palette is
   borrowed from the marketing site so the two feel related. */

:root {
  --ink:        #1E293B;
  --ink-muted:  #64748B;
  --line:       #E2E8F0;
  --paper:      #FFFFFF;
  --ground:     #F8FAFC;
  --accent:     #2563EB;
  --accent-ink: #1D4ED8;
  --ok-bg:      #ECFDF5;
  --ok-ink:     #065F46;
  --bad-bg:     #FEF2F2;
  --bad-ink:    #991B1B;
  --radius:     10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ground);
  line-height: 1.55;
}

.wrap { width: min(960px, 100% - 2.5rem); margin-inline: auto; }

/* --- top bar --- */

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }

.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 0;
}

.brand { font-weight: 700; letter-spacing: -0.01em; }
.brand em { font-style: normal; color: var(--accent); }

.tag {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-muted); margin-left: 0.35rem;
}

.whoami { display: flex; align-items: center; gap: 0.9rem; font-size: 0.875rem; }
.whoami .email { color: var(--ink-muted); }
.inline { display: inline; margin: 0; }

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; text-decoration: underline;
}

/* --- layout --- */

.page { padding: 2.5rem 0 4rem; }

h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 0 0 0.5rem; }

.muted { color: var(--ink-muted); }
.small { font-size: 0.85rem; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-top: 1.5rem;
}

.card.narrow { max-width: 26rem; margin-inline: auto; }
.card h1 { margin-top: 0; }

/* --- forms --- */

.stack { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1.25rem; }

label { font-size: 0.85rem; font-weight: 600; }

input[type="email"] {
  font: inherit; padding: 0.7rem 0.85rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}

input[type="email"]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff;
  border: 0; border-radius: 8px; padding: 0.7rem 1.25rem;
  margin-top: 0.4rem;
}

.btn:hover { background: var(--accent-ink); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* --- flashes --- */

.flash {
  padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 1rem;
  font-size: 0.9rem; border: 1px solid transparent;
}

.flash-success { background: var(--ok-bg);  color: var(--ok-ink);  border-color: #A7F3D0; }
.flash-error   { background: var(--bad-bg); color: var(--bad-ink); border-color: #FECACA; }

/* --- footer --- */

.footer {
  border-top: 1px solid var(--line); background: var(--paper);
  padding: 1.5rem 0; font-size: 0.85rem; color: var(--ink-muted);
}

.footer a { color: var(--accent); }

/* --- sub navigation --- */

.subnav { background: var(--paper); border-bottom: 1px solid var(--line); }

.subnav-inner { display: flex; gap: 1.5rem; overflow-x: auto; }

.subnav a {
  padding: 0.85rem 0; font-size: 0.9rem; font-weight: 500; white-space: nowrap;
  color: var(--ink-muted); text-decoration: none;
  border-bottom: 2px solid transparent;
}

.subnav a:hover { color: var(--ink); }
.subnav a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* --- stat tiles ---
   Four numbers a client scans in two seconds. A chart here would add motion
   and axes to values that have no trend worth reading. Numbers wear text
   tokens, never a series colour. */

.tiles {
  display: grid; gap: 1rem; margin-top: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.tiles.two { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); max-width: 34rem; }

.tile {
  display: flex; flex-direction: column; gap: 0.15rem;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
}

.tile-label {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-muted);
}

.tile-value {
  font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.15; font-variant-numeric: tabular-nums;
}

.tile-note { font-size: 0.8rem; color: var(--ink-muted); }

/* --- columns --- */

.cols {
  display: grid; gap: 1.25rem; margin-top: 0.25rem;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
}

.cols .card { margin-top: 1.25rem; }

h2 { font-size: 1rem; margin: 0 0 0.9rem; letter-spacing: -0.01em; }

/* --- tables --- */

.card.flush { padding: 0; overflow: hidden; }
.scroller { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.table th {
  text-align: left; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted);
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}

.table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--ground); }

.table tfoot td {
  font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0;
  background: var(--ground);
}

.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; }

.card.flush .table th:first-child,
.card.flush .table td:first-child { padding-left: 1.25rem; }
.card.flush .table th:last-child,
.card.flush .table td:last-child { padding-right: 1.25rem; }

/* --- list rows --- */

.list { list-style: none; margin: 0; padding: 0; }

.list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--line);
}

.list li:last-child { border-bottom: 0; }
.list.plain li { display: block; color: var(--ink-muted); font-size: 0.875rem; }

.li-main { display: block; }
.li-sub { display: block; font-size: 0.82rem; color: var(--ink-muted); margin-top: 0.15rem; }
.li-meta { color: var(--ink-muted); font-size: 0.82rem; white-space: nowrap; }

.more { margin: 1rem 0 0; font-size: 0.875rem; }
.more a { color: var(--accent); text-decoration: none; }
.more a:hover { text-decoration: underline; }

.empty {
  color: var(--ink-muted); background: var(--paper);
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 2rem; text-align: center; margin-top: 1.5rem;
}

/* --- status badges ---
   The word the client typed is always shown. Colour is a hint layered on top,
   never the only thing distinguishing one state from another. */

.badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}

.badge-ok      { background: var(--ok-bg);  color: var(--ok-ink);  border-color: #A7F3D0; }
.badge-go      { background: #EFF6FF;       color: #1E40AF;        border-color: #BFDBFE; }
.badge-hold    { background: #FFFBEB;       color: #92400E;        border-color: #FDE68A; }
.badge-neutral { background: var(--ground); color: var(--ink-muted); border-color: var(--line); }

.flagged { color: #92400E; font-weight: 600; }

/* --- filter pills --- */

.filters { display: flex; gap: 0.5rem; margin-top: 1.25rem; flex-wrap: wrap; }

.pill {
  padding: 0.4rem 0.85rem; border-radius: 999px; font-size: 0.85rem;
  font-weight: 500; text-decoration: none; color: var(--ink-muted);
  background: var(--paper); border: 1px solid var(--line);
}

.pill:hover { color: var(--ink); }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.notes { border-left: 3px solid #FDE68A; }

/* --- admin write-back controls ---
   Only rendered for the admin role; the client's session never sees them. */

.rowform { display: flex; gap: 0.4rem; align-items: flex-end; margin: 0; }
.wrap-form { flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }

.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field span { font-size: 0.75rem; font-weight: 600; color: var(--ink-muted); }
.field.short { width: 6.5rem; }
.field.grow { flex: 1 1 12rem; }

.rowform input[type="text"],
.rowform input[type="date"],
.rowform select {
  font: inherit; font-size: 0.85rem; padding: 0.4rem 0.5rem;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper); color: var(--ink);
}

.rowform input:focus-visible, .rowform select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.btn-small {
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  background: var(--paper); color: var(--accent);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.7rem;
}

.btn-small:hover { border-color: var(--accent); }

/* --- client picker / switcher --- */

.picker li { padding: 0.9rem 1.25rem; align-items: center; }
.picker a { color: var(--accent); text-decoration: none; font-weight: 600; }
.picker a:hover { text-decoration: underline; }
.picker .li-meta { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

.switch { font-size: 0.85rem; color: var(--accent); text-decoration: none; }
.switch:hover { text-decoration: underline; }

.btn-link {
  display: inline-block; font-weight: 600; text-decoration: none;
  color: var(--accent); border: 1px solid var(--line); background: var(--paper);
  border-radius: 8px; padding: 0.5rem 0.9rem;
}
.btn-link:hover { border-color: var(--accent); }

/* --- task detail --- */

.crumb { margin: 0 0 0.75rem; font-size: 0.875rem; }
.crumb a { color: var(--ink-muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.prose { margin: 0; white-space: pre-wrap; }
.small-value { font-size: 1.2rem; }
.section-head { margin-top: 2rem; }
.statusform { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

a.li-main { color: var(--ink); text-decoration: none; font-weight: 600; }
a.li-main:hover { color: var(--accent); text-decoration: underline; }
a.mono { color: var(--accent); text-decoration: none; }
a.mono:hover { text-decoration: underline; }

.flash-note {
  background: #FFFBEB; color: #92400E; border-color: #FDE68A;
}
.flash-note code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em;
  background: rgba(0,0,0,0.05); padding: 0.1rem 0.3rem; border-radius: 4px;
}
