/* Ridgebotics To-Do — team app. One layout that becomes a sidebar app on wide screens. */
:root{
  --ground:#F4F5F2; --surface:#FFFFFF; --ink:#17201A; --muted:#5B665E; --line:#E2E5DF; --line-soft:#EEF0EC;
  --brand:#0B7A0B; --brand-ink:#0B6E0B; --brand-soft:#E8F5E8;
  --radius:10px; --tab-h:64px;
  --safe-b:env(safe-area-inset-bottom,0px); --safe-t:env(safe-area-inset-top,0px);
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--ground);color:var(--ink);font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;font-size:15px;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
a{color:var(--brand-ink)}
.label-caps{font-family:"Barlow Semi Condensed",Inter,sans-serif;font-weight:700;letter-spacing:.06em;text-transform:uppercase}
.muted{color:var(--muted)}
.sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.boot{min-height:100vh;display:flex;align-items:center;justify-content:center;opacity:.6}

/* ---------- Buttons ---------- */
.btn{height:44px;padding:0 16px;border-radius:10px;border:1px solid var(--line);background:var(--surface);font-weight:600;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn-primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn-danger{color:#B91C1C}
.btn-ghost{border-color:transparent;background:transparent}
.btn-sm{height:34px;padding:0 12px;font-size:13px;border-radius:8px}
.link-btn{background:none;border:0;color:var(--brand-ink);font-weight:600;padding:10px 4px}
.chip{height:36px;padding:0 12px;border-radius:999px;border:1.5px solid var(--line);background:var(--surface);font-size:14px;font-weight:500;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.chip[aria-pressed="true"]{border-color:var(--ink);background:#F7F8F5;font-weight:600}
.chip.dark[aria-pressed="true"]{background:var(--ink);color:#fff}
.dot{width:8px;height:8px;border-radius:50%;flex:none;display:inline-block}
.sq{width:10px;height:10px;border-radius:2px;flex:none;display:inline-block}

/* ---------- PIN + name picker ---------- */
.gate{min-height:100vh;display:flex;flex-direction:column;align-items:center;padding:calc(48px + var(--safe-t)) 24px 32px;background:var(--surface)}
.gate h1{margin:24px 0 6px;font-size:22px}
.gate p{margin:0;color:var(--muted);text-align:center;max-width:300px}
.pin-dots{display:flex;gap:16px;margin:28px 0 8px}
.pin-dots span{width:16px;height:16px;border-radius:50%;border:2px solid #9AA39C}
.pin-dots span.on{background:var(--brand);border-color:var(--brand)}
.pin-error{min-height:22px;color:#B91C1C;font-size:14px;margin-bottom:10px}
.keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;width:100%;max-width:280px}
.keypad button{height:60px;border-radius:14px;border:1px solid var(--line);background:var(--ground);font-size:24px;font-weight:600}
.keypad button.plain{background:transparent;border:0;color:var(--muted);display:flex;align-items:center;justify-content:center}
.keypad button:active{background:#E4E7E1}
.names{min-height:100vh;background:var(--ground)}
.names header{background:var(--surface);padding:calc(24px + var(--safe-t)) 20px 16px;border-bottom:1px solid var(--line)}
.names header h1{margin:16px 0 4px;font-size:24px}
.names-list{padding:12px 16px 32px;display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));max-width:1100px}
.name-btn{display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px 14px;text-align:left;min-height:60px;width:100%}
.name-btn:hover{border-color:#B9C0B5}
.search{display:flex;align-items:center;gap:8px;background:var(--ground);border:1px solid var(--line);border-radius:10px;padding:0 12px;height:44px}
.search input{border:0;background:transparent;flex:1;outline:none;font-size:15px;min-width:0}
.avatar{width:40px;height:40px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-weight:700;flex:none;font-size:15px}
.avatar.sm{width:24px;height:24px;font-size:11px}
.avatar.xs{width:22px;height:22px;font-size:10px;border:2px solid var(--surface);margin-left:-6px}
.avatar.xs:first-child{margin-left:0}

/* ---------- App shell ---------- */
.shell{display:flex;min-height:100vh}
.sidebar{display:none}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{background:var(--surface);border-bottom:1px solid var(--line);padding:calc(10px + var(--safe-t)) 16px 10px;position:sticky;top:0;z-index:5}
.topbar-row{display:flex;align-items:center;gap:10px}
.topbar h1{margin:0;font-size:20px;flex:1;min-width:0}
.me-btn{display:flex;align-items:center;gap:8px;background:none;border:0;padding:4px;border-radius:999px}
.toolbar{display:flex;gap:6px;margin-top:10px;overflow-x:auto;scrollbar-width:none;padding-bottom:2px}
.toolbar::-webkit-scrollbar{display:none}
.content{flex:1;padding:4px 0 calc(var(--tab-h) + 96px + var(--safe-b))}
.tabs{position:fixed;left:0;right:0;bottom:0;background:var(--surface);border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(5,1fr);padding:4px 0 calc(6px + var(--safe-b));z-index:10}
.tabs button{background:none;border:0;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 0;font-size:11px;font-weight:600;color:var(--muted)}
.tabs button[aria-current="page"]{color:var(--brand-ink);font-weight:700}
.fab{position:fixed;right:16px;bottom:calc(var(--tab-h) + 20px + var(--safe-b));width:56px;height:56px;border-radius:16px;background:var(--brand);border:0;color:#fff;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 14px rgba(11,122,11,.35);z-index:9}

/* ---------- Stats strip ---------- */
.stats{display:flex;gap:8px;padding:12px 16px 2px}
.stat{flex:1;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:10px 12px}
.stat b{display:block;font-size:22px}
.stat span{font-size:12px;color:var(--muted)}

/* ---------- Task list ---------- */
.group-h{display:flex;align-items:center;gap:8px;padding:16px 16px 6px}
.group-h .label-caps{font-size:15px}
.group-h .count{font-size:13px;color:var(--muted)}
.group-h .hint{font-size:12px;color:var(--muted)}
.list{background:var(--surface);border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.row{display:flex;align-items:center;gap:4px;padding:4px 12px 4px 4px;border-bottom:1px solid var(--line-soft);min-height:56px}
.row:last-child{border-bottom:0}
.check{width:44px;height:44px;flex:none;border:0;background:transparent;display:flex;align-items:center;justify-content:center;border-radius:50%}
.check span{width:24px;height:24px;border-radius:50%;border:2px solid #9AA39C;display:flex;align-items:center;justify-content:center;transition:background .12s,border-color .12s}
.check:hover span{border-color:var(--brand)}
.check.done span{background:var(--brand);border-color:var(--brand)}
.check svg{opacity:0}
.check.done svg{opacity:1}
.row-main{flex:1;min-width:0;padding:6px 0;cursor:pointer}
.row-title{display:block;width:100%;background:none;border:0;padding:0;text-align:left;cursor:pointer;font-size:15px;font-weight:500;line-height:1.3;word-wrap:break-word}
.row.is-done .row-title{text-decoration:line-through;color:#7A847C}
.row-meta{display:flex;align-items:center;gap:6px;margin-top:4px;font-size:12px;color:var(--muted);flex-wrap:wrap}
.row-note{font-size:12px;color:var(--muted);margin-top:2px;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.pill{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font-weight:600;font-size:12px;border:0;line-height:1.5}
button.pill{cursor:pointer}
.ptag{font-size:11px;font-weight:700;padding:3px 7px;border-radius:6px;flex:none}
.people-stack{display:inline-flex;align-items:center}
.take{flex:none;height:32px;padding:0 10px;border-radius:8px;border:1px dashed #9AA39C;background:none;color:var(--brand-ink);font-size:12px;font-weight:600;margin-left:4px}
.row-side{display:flex;align-items:center;gap:6px;flex:none}
.empty{margin:32px 16px;padding:28px 20px;background:var(--surface);border:1px dashed #C9CFC5;border-radius:12px;text-align:center}
.empty h2{margin:0 0 6px;font-size:17px}
.empty p{margin:0 0 14px;color:var(--muted)}
.more-btn{width:100%;height:44px;border:0;border-top:1px solid var(--line-soft);background:var(--surface);color:var(--brand-ink);font-weight:600}

/* Status menu */
.menu{position:fixed;z-index:40;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.14);padding:6px;min-width:180px}
.menu button{display:flex;align-items:center;gap:10px;width:100%;height:42px;padding:0 10px;border:0;background:none;border-radius:8px;font-size:14px;text-align:left}
.menu button:hover,.menu button:focus-visible{background:var(--ground)}
.menu button[aria-checked="true"]{font-weight:700}

/* ---------- Sheet (add/edit) ---------- */
.overlay{position:fixed;inset:0;background:rgba(23,32,26,.45);z-index:30;display:flex;align-items:flex-end;justify-content:center}
.sheet{background:var(--surface);width:100%;max-height:94vh;overflow-y:auto;border-radius:18px 18px 0 0;padding:10px 20px calc(20px + var(--safe-b));display:flex;flex-direction:column;gap:16px}
.grab{width:40px;height:5px;border-radius:3px;background:#D5D9D2;align-self:center}
.sheet-head{display:flex;align-items:center;gap:8px}
.sheet-head h2{margin:0;font-size:20px;flex:1}
.field{display:flex;flex-direction:column;gap:6px}
.field > span,.field-label{font-size:13px;font-weight:600;color:var(--muted)}
.input,.textarea{border:1px solid var(--line);border-radius:10px;padding:0 12px;height:46px;font-size:16px;background:var(--surface);outline:none;width:100%}
.textarea{height:auto;padding:10px 12px;resize:vertical;min-height:70px;font-size:15px}
.input:focus,.textarea:focus{border-color:var(--brand);box-shadow:0 0 0 3px rgba(11,122,11,.12)}
.seg{display:grid;gap:6px}
.seg button{height:44px;border-radius:10px;border:1.5px solid var(--line);background:var(--surface);font-size:14px;font-weight:600;display:flex;align-items:center;justify-content:center;gap:6px;padding:0 6px}
.seg button[aria-pressed="true"]{border-color:var(--ink)}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.person-chip{height:36px;padding:0 2px 0 4px;border-radius:999px;border:1.5px solid var(--ink);display:inline-flex;align-items:center;gap:6px;font-size:14px;font-weight:600}
.person-chip button{width:30px;height:30px;border:0;background:none;color:var(--muted);font-size:18px;line-height:1;border-radius:50%}
.picker{border:1px solid var(--line);border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:8px}
.picker-list{max-height:220px;overflow-y:auto;display:flex;flex-direction:column}
.picker-list button{display:flex;align-items:center;gap:10px;min-height:44px;border:0;background:none;text-align:left;padding:4px 6px;border-radius:8px;font-size:14px}
.picker-list button:hover{background:var(--ground)}
.sheet-foot{display:flex;gap:8px;align-items:center;padding-top:4px}
.sheet-foot .grow{flex:1}
.sheet-meta{font-size:12px;color:var(--muted)}
.form-error{color:#B91C1C;font-size:14px;min-height:0}

/* ---------- Toast ---------- */
.toast{position:fixed;left:12px;right:12px;bottom:calc(var(--tab-h) + 16px + var(--safe-b));background:var(--ink);color:#fff;border-radius:10px;padding:6px 6px 6px 16px;display:flex;align-items:center;justify-content:space-between;font-size:14px;z-index:50;max-width:480px;margin:0 auto}
.toast button{background:none;border:0;color:#8EE08E;font-weight:700;padding:12px 14px}
.toast[hidden]{display:none}

/* ---------- Dashboard ---------- */
.dash{padding:12px 16px;display:flex;flex-direction:column;gap:14px;max-width:1200px}
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}
.tile{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px 16px}
.tile .t-label{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:6px}
.tile b{display:block;font-size:30px;margin-top:4px;letter-spacing:-.02em}
.card{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:16px 18px}
.card h2{margin:0 0 12px;font-size:16px}
.cards-row{display:flex;flex-wrap:wrap;gap:14px;align-items:flex-start}
.cards-row > .card{flex:1 1 320px;min-width:0}
.bar-row{display:grid;grid-template-columns:110px minmax(0,1fr) 30px;gap:10px;align-items:center;font-size:14px;margin-bottom:10px}
.bar{display:flex;height:20px;gap:2px;background:var(--ground);border-radius:4px;overflow:hidden}
.bar span{display:block;height:100%}
.legend{display:flex;gap:12px;flex-wrap:wrap;font-size:12px;color:var(--muted);margin:-4px 0 12px}
.legend span{display:inline-flex;align-items:center;gap:5px}
.who-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--line-soft);font-size:14px}
.callout{margin-top:12px;background:#FFF7ED;border:1px solid #FED7AA;border-radius:10px;padding:12px 14px;font-size:14px;color:#7C2D12}

/* ---------- Desktop ---------- */
@media (min-width:900px){
  .shell{flex-direction:row}
  .sidebar{display:flex;flex-direction:column;gap:2px;width:252px;flex:none;background:var(--surface);border-right:1px solid var(--line);padding:18px 14px;position:sticky;top:0;height:100vh;overflow-y:auto}
  .brand{display:flex;align-items:center;gap:10px;padding:0 6px 16px}
  .side-link{display:flex;align-items:center;gap:10px;height:40px;padding:0 10px;border-radius:8px;border:0;background:none;width:100%;text-align:left;font-size:14px;font-weight:500}
  .side-link:hover{background:var(--ground)}
  .side-link[aria-current="page"]{background:var(--brand-soft);color:var(--brand-ink);font-weight:700}
  .side-link .n{margin-left:auto;font-size:12px;color:var(--muted);font-weight:500}
  .side-h{padding:18px 10px 6px;font-size:13px;color:var(--muted)}
  .side-me{margin-top:auto;border-top:1px solid var(--line);padding:14px 6px 0;display:flex;align-items:center;gap:10px}
  .tabs,.fab,.mobile-only{display:none!important}
  .topbar{position:static;border-bottom:0;background:transparent;padding:22px 32px 4px}
  .topbar h1{font-size:26px}
  .toolbar{flex-wrap:wrap;overflow:visible}
  .content{padding:0 32px 48px;max-width:1180px}
  .stats{padding:12px 0 2px;max-width:640px}
  .group-h{padding:20px 4px 8px}
  .list{border:1px solid var(--line);border-radius:10px;overflow:hidden}
  .row{padding:2px 14px 2px 4px;min-height:48px}
  .row-main{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px}
  .row-meta{margin-top:0;flex-wrap:nowrap}
  .empty{margin:32px 0}
  .overlay{align-items:center;padding:24px}
  .sheet{max-width:580px;border-radius:16px;max-height:90vh;padding:20px 24px 22px}
  .grab{display:none}
  .toast{bottom:24px;left:auto;right:24px;width:360px;margin:0}
  .dash{padding:12px 0 48px}
}

@media (max-width:899px){.desktop-only{display:none!important}}
