/* Humai brand v1.4 tokens (prototype): white ground, ink actions, firuze focus, Manrope, radius 4/8. */
:root {
  --ground: #ffffff;
  --raised: #f4f6f5;
  --ink: #14191a;
  --ink-2: #566260;
  --line: #d8dfdc;
  --focus: #0a686b;
  --firuze: #0a686b;
  --firuze-soft: #e7f2f1;
  --violet: #70509a;
  --violet-soft: #f1ecf7;
  --ok: #12805c;
  --ok-soft: #e6f4ee;
  --warn: #8a5300;
  --warn-soft: #fbf1e1;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --aurora: linear-gradient(100deg, #0b727d 0%, #078d95 34%, #169f79 72%, #4aa262 100%);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.5 Manrope, Arial, sans-serif; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--raised); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.side::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--aurora); } /* brand artwork only */
.logo { height: 30px; width: auto; align-self: flex-start; margin-left: 8px; }
.org-block { padding: 0 8px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.org { font-weight: 600; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { min-height: 44px; padding: 0 12px; border-radius: 8px; display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 600; }
.nav-item[aria-current="page"] { background: var(--firuze-soft); box-shadow: inset 3px 0 0 var(--firuze); color: var(--firuze); }
main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 600; }
.sub { margin: 4px 0 0; color: var(--ink-2); }
.search input { height: 44px; width: 280px; max-width: 100%; padding: 0 12px; border: 1px solid var(--ink); border-radius: 4px; background: var(--ground); }

.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.counts button { background: var(--raised); border: 1px solid transparent; border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; cursor: pointer; min-height: 72px; }
.counts button:hover { border-color: var(--line); }
.counts button[aria-pressed="true"] { background: var(--firuze-soft); border-color: var(--firuze); }
.counts button[aria-pressed="true"] b { color: var(--firuze); }
.counts b { font-size: 24px; font-weight: 600; line-height: 1.2; }
.counts span { color: var(--ink-2); font-size: 13px; }

.toolbar { display: flex; align-items: center; gap: 12px; }
.filter-btn { min-height: 44px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 4px; background: var(--ground); display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.filter-btn:hover { background: var(--raised); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--firuze); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.link { border: 0; background: none; padding: 8px 0; color: var(--firuze); text-decoration: underline; cursor: pointer; }

.table-box { border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--raised); text-align: left; font-weight: 600; font-size: 13px; padding: 0; white-space: nowrap; position: relative; }
th button { width: 100%; min-height: 44px; padding: 0 12px; border: 0; background: none; text-align: left; display: flex; align-items: center; gap: 6px; cursor: pointer; }
th button .mark { color: var(--focus); }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr:focus-visible { background: var(--raised); }
td.date { white-space: nowrap; }
td.id { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
td .muted { color: var(--ink-2); }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 2px 10px 2px 8px; border-radius: 8px; background: var(--raised); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: currentColor; }
.status.s-progress { background: var(--firuze-soft); color: var(--firuze); }
.status.s-review { background: var(--violet-soft); color: var(--violet); }
.status.s-waiting { background: var(--warn-soft); color: var(--warn); }
.status.s-blocked { background: var(--bad-soft); color: var(--bad); }
.status.s-done { background: var(--ok-soft); color: var(--ok); }
.cards { display: none; list-style: none; margin: 0; padding: 0; flex-direction: column; gap: 8px; }
.card { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--ground); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.card:active { background: var(--raised); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .muted { color: var(--ink-2); font-size: 13px; }
.card .id { font-variant-numeric: tabular-nums; }
.empty { padding: 24px; text-align: center; color: var(--ink-2); margin: 0; }
.updated { color: var(--ink-2); font-size: 13px; margin: 0; }

.menu { position: absolute; top: 44px; left: 0; z-index: 10; min-width: 220px; background: var(--ground); border: 1px solid var(--ink); border-radius: 4px; padding: 8px; display: flex; flex-direction: column; gap: 4px; font-weight: 400; box-shadow: 0 8px 24px rgba(20, 25, 26, 0.12); }
.menu button { min-height: 36px; padding: 0 8px; border: 0; border-radius: 4px; background: none; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--raised); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu label { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; cursor: pointer; }
.menu .values { max-height: 220px; overflow-y: auto; }
.menu input[type="text"] { height: 36px; border: 1px solid var(--ink); border-radius: 4px; padding: 0 8px; }

.panel { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100%; background: var(--ground); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(20, 25, 26, 0.08); padding: 20px 24px; overflow-y: auto; z-index: 20; }
.panel-head { display: flex; align-items: center; gap: 8px; }
.panel h2 { margin: 0; font-size: 20px; font-weight: 600; }
.panel h3 { margin: 24px 0 8px; font-size: 14px; font-weight: 600; }
.icon { margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 4px; background: none; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon:hover { background: var(--raised); }
.facts { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 16px 0 0; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }
.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.events li { border-left: 2px solid var(--line); padding-left: 12px; }
.events .when { color: var(--ink-2); font-size: 13px; }

.sheet { position: fixed; inset: 0; background: rgba(20, 25, 26, 0.35); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto; background: var(--ground); border-radius: 8px 8px 0 0; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet-card h2 { margin: 0; font-size: 20px; font-weight: 600; }
.sheet fieldset { border: 0; margin: 0; padding: 8px 0 4px; }
.sheet legend { font-weight: 600; padding: 0 0 4px; color: var(--ink-2); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--firuze); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; border-top: 1px solid var(--line); padding-top: 12px; }
.field select { height: 44px; border: 1px solid var(--ink); border-radius: 4px; padding: 0 10px; background: var(--ground); font: inherit; }
.primary { min-height: 48px; border: 0; border-radius: 4px; background: var(--ink); color: var(--ground); font-weight: 600; cursor: pointer; }
@media (min-width: 721px) { .sheet { align-items: center; } .sheet-card { border-radius: 8px; } }

.notice { max-width: 480px; margin: 64px auto; padding: 0 24px; text-align: center; color: var(--ink-2); }

.pin-screen { position: fixed; inset: 0; background: var(--ground); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.pin-card { width: 320px; max-width: 100%; display: flex; flex-direction: column; gap: 8px; }
.pin-logo { height: 30px; width: auto; align-self: flex-start; margin-bottom: 16px; }
.pin-card label { font-weight: 600; }
.pin-card input { height: 48px; padding: 0 12px; border: 1px solid var(--ink); border-radius: 4px; font-size: 20px; letter-spacing: 6px; }
.pin-card button { height: 48px; border: 0; border-radius: 4px; background: var(--ink); color: var(--ground); font-weight: 600; cursor: pointer; }
.pin-error { color: var(--bad); margin: 0; min-height: 20px; }

@media (max-width: 720px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 15; height: auto; padding: 12px 16px 0; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: column; }
  .side .logo { height: 24px; margin: 0; }
  .org-block { border-bottom: 0; padding: 0; }
  .side nav { flex-direction: row; }
  .nav-item { min-height: 44px; border-radius: 0; box-shadow: none !important; background: none !important; border-bottom: 2px solid var(--firuze); padding: 0 4px; }
  main { padding: 16px; gap: 12px; }
  .head { flex-direction: column; align-items: stretch; }
  .sub { display: none; }
  .search, .search input { width: 100%; }
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-box { display: none; }
  .cards { display: flex; }
  .panel { width: 100%; border-left: 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .facts { grid-template-columns: 96px 1fr; }
}
