/* Mr. Patel's Workday — de-slop design tokens (SPEC, held exactly):
   --bg #090a0c · --surface #121316 · --surface-alt #17181c · --surface-raised #1e1f24
   --text #f2f3f5 · --dim #a3a8b0 · --faint #767c85 · --border rgba(255,255,255,0.08)
   --border-strong rgba(255,255,255,0.15) · --accent #cbd8e6 (semantic only)
   Radius 10px panels / 6px controls · spacing 4/8/12/16/24/32/48 · type 12/13/14/16/20/24 */
:root {
  --bg: #090a0c;
  --surface: #121316;
  --surface-alt: #17181c;
  --surface-raised: #1e1f24;
  --text: #f2f3f5;
  --dim: #a3a8b0;
  --faint: #767c85;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --accent: #cbd8e6;
  --danger: #e5534b;
  --ok: #57ab5a;
  --radius-panel: 10px;
  --radius-ctl: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
.num, .tnum { font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.error { color: var(--danger); font-size: 14px; }
h1 { font-size: 24px; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
button { font: inherit; color: inherit; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: var(--radius-ctl);
  padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { width: 100%; min-height: 140px; resize: vertical; }

/* header */
header#app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { display: block; }
.brand-text { min-width: 0; }
.brand-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand-date { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* buttons */
.btn {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius-ctl); padding: 8px 14px; min-height: 40px; cursor: pointer;
  transition: background 150ms ease-out;
}
.btn:hover { background: var(--surface-alt); }
.btn-primary { background: var(--accent); color: #0b0e13; border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: #dde7f1; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-small { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* tab bar */
nav#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface); border-top: 1px solid var(--border-strong);
  padding-bottom: env(safe-area-inset-bottom);
}
nav#tabbar button {
  flex: 1; background: none; border: none; padding: 12px 4px; font-size: 13px;
  color: var(--dim); cursor: pointer; min-height: 52px; position: relative;
}
nav#tabbar button.active { color: var(--text); font-weight: 600; }
nav#tabbar button.active::before {
  content: ''; position: absolute; top: 0; left: 8px; right: 8px; height: 3px;
  background: var(--accent); border-radius: 0 0 3px 3px;
}

/* layout */
main#view { max-width: 880px; margin: 0 auto; padding: 16px; }
.view-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.quote { color: var(--dim); font-size: 14px; font-style: italic; margin: 4px 0 16px; }
.quote .by { font-style: normal; color: var(--faint); }

.progress { height: 8px; background: var(--surface-alt); border-radius: 4px; overflow: hidden; margin: 8px 0 16px; }
.progress > div { height: 100%; background: var(--accent); transition: width 250ms ease-out; }
.progress-label { font-size: 13px; color: var(--dim); }

/* quick add */
.quickadd {
  position: sticky; top: 65px; z-index: 10; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-panel);
  padding: 12px; margin-bottom: 16px;
}
.quickadd-row { display: flex; gap: 8px; }
.quickadd-row input { flex: 1; }
.quickadd-preview { font-size: 13px; color: var(--dim); margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  display: inline-block; padding: 2px 8px; border: 1px solid var(--border-strong);
  border-radius: 999px; font-size: 12px; color: var(--text); background: var(--surface-alt);
}
.chip.suggest { border-color: var(--accent); color: var(--accent); }
.quickadd-preview select { min-height: 34px; padding: 4px 8px; font-size: 13px; }

/* sections + tasks */
.section-block { margin-bottom: 24px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.section-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.section-name { font-size: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); }
.section-count { font-size: 12px; color: var(--faint); }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel);
  padding: 12px; display: flex; gap: 12px; align-items: flex-start;
}
.task.dragging { opacity: 0.5; }
.task input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 1px; accent-color: var(--accent); }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-size: 16px; }
.task.done .task-title { color: var(--faint); text-decoration: line-through; }
.task-meta { font-size: 13px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.badge-overdue { color: #ffb4ae; border: 1px solid var(--danger); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.badge-carried { color: var(--accent); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.task-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.task-detail label { font-size: 13px; color: var(--dim); display: flex; flex-direction: column; gap: 4px; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.empty { color: var(--faint); font-size: 14px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius-panel); }

/* desk */
.desk-clock { font-size: 24px; font-weight: 600; }
.desk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 16px; margin-bottom: 16px; }
.card h3 { color: var(--dim); font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; }
.upnext { border-color: var(--border-strong); background: var(--surface-alt); }
.upnext .task-title { font-size: 20px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.plain-list li:last-child { border-bottom: none; }

/* player */
.player { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.player audio { width: 100%; }
.player-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.player-controls .rate { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.player-title { font-size: 16px; font-weight: 600; }
.briefing-section { margin-top: 16px; }
.briefing-section h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 16px; }
.briefing-section p { white-space: pre-wrap; color: var(--dim); font-size: 15px; margin: 4px 0 0; }
.archive-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 12px; margin-bottom: 8px; cursor: pointer; }
.archive-item:hover { background: var(--surface-alt); }

/* notes */
.folder-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.folder-chips .chip { cursor: pointer; min-height: 34px; padding: 6px 12px; font-size: 13px; background: var(--surface); color: var(--dim); }
.folder-chips .chip.active { color: var(--text); border-color: var(--accent); }
.note-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 12px; margin-bottom: 8px; cursor: pointer; width: 100%; text-align: left; color: var(--text); }
.note-card:hover { background: var(--surface-alt); }
.note-card .note-title { font-size: 16px; font-weight: 600; }
.note-card .note-snippet { color: var(--dim); font-size: 14px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-editor label { font-size: 13px; color: var(--dim); display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }

/* groceries panel */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 40; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 94vw); z-index: 50;
  background: var(--surface); border-left: 1px solid var(--border-strong);
  padding: 16px; overflow-y: auto;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.grocery-list { margin-bottom: 32px; }
.grocery-list h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 16px; }
.grocery-add { display: flex; gap: 8px; margin-bottom: 8px; }
.grocery-add input { flex: 1; }
.grocery-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.grocery-item input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.grocery-item .g-title { flex: 1; font-size: 15px; }
.grocery-item.done .g-title { color: var(--faint); text-decoration: line-through; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; padding: 24px 16px; text-align: center; }
.login-logo { margin-bottom: 16px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

/* misc */
.offline-banner {
  background: #3a2b12; color: #f5d9a8; font-size: 13px; text-align: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border-strong);
}
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--surface-raised); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: var(--radius-ctl); padding: 10px 16px; font-size: 14px; z-index: 60; max-width: 92vw;
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
@media (min-width: 760px) {
  main#view { padding: 24px; }
  .quickadd { top: 73px; }
}
