/* ============================================================
   Command Center — Claude-inspired design system
   ivory paper · clay accent · serif display + grotesque body
   ============================================================ */
:root {
  --ivory:      #F0EEE6;   /* page */
  --paper:      #FAF9F5;   /* cards / raised surfaces */
  --paper-2:    #F4F2EA;   /* subtle fills */
  --ink:        #141413;   /* primary text */
  --ink-soft:   #46443E;   /* secondary text */
  --muted:      #77746C;   /* captions */
  --line:       #E2DED2;   /* hairlines */
  --line-soft:  #EBE8DE;
  --clay:       #D97757;   /* the accent */
  --clay-deep:  #BF5B3C;   /* accent hover/press */
  --clay-wash:  #F6E7DF;   /* accent tint bg */
  --slate:      #262620;   /* dark surface (sidebar) */
  --slate-soft: #6B6960;

  --ctx-personal:  #6B8E7B;
  --ctx-marketing: #C08A3E;
  --ctx-autodrive: #5B7C9E;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:  ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20,20,19,.04), 0 8px 24px -12px rgba(20,20,19,.14);
  --shadow-lift: 0 2px 4px rgba(20,20,19,.05), 0 18px 40px -18px rgba(20,20,19,.22);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.01em; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 26px;
  padding: 26px 20px;
  background: var(--slate);
  color: #E9E6DD;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background:
    radial-gradient(circle at 30% 30%, #E8926E, var(--clay) 60%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 9px; height: 9px; border-radius: 2px;
  background: var(--slate);
  transform: rotate(45deg);
}
.brand-name { font-family: var(--serif); font-size: 1.18rem; line-height: 1.05; letter-spacing: -.02em; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #C9C5B9; text-decoration: none; font-size: .92rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.is-active { background: var(--clay); color: #fff; }
.nav-link.is-disabled { color: var(--slate-soft); cursor: default; }
.soon {
  margin-left: auto; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--slate-soft); border: 1px solid #3a3a32; border-radius: 999px; padding: 1px 7px;
}

.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 16px; border-top: 1px solid #35352d; font-size: .84rem; }
.who { color: #C9C5B9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { color: var(--slate-soft); text-decoration: none; }
.logout:hover { color: var(--clay); }

/* ---------- Main ---------- */
.main { padding: 44px clamp(24px, 5vw, 64px) 80px; max-width: 1000px; }
.eyebrow { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.page-head { margin-bottom: 30px; }
.greeting { font-family: var(--serif); font-size: clamp(1.9rem, 4vw, 2.7rem); line-height: 1.08; letter-spacing: -.02em; margin: 6px 0 8px; }
.greeting em { font-style: italic; color: var(--clay-deep); }
.subline { color: var(--ink-soft); font-size: 1.02rem; max-width: 52ch; }

/* ---------- Cards grid (overview) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; position: relative;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
}
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: #D9D3C4; }
.card.is-soon { opacity: .62; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-glyph { width: 34px; height: 34px; border-radius: 9px; background: var(--clay-wash); color: var(--clay-deep);
  display: grid; place-items: center; font-family: var(--serif); font-size: 1.1rem; }
.card-metric { font-family: var(--serif); font-size: 2.1rem; line-height: 1; letter-spacing: -.02em; }
.card-metric small { font-family: var(--sans); font-size: .8rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.card-title { font-size: 1.02rem; font-weight: 600; }
.card-sub { color: var(--muted); font-size: .88rem; }

/* ---------- Task app ---------- */
.toolbar { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.h-page { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -.02em; }
.count-pill { font-size: .82rem; color: var(--muted); }

.add-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 26px; }
.add-row { display: grid; grid-template-columns: 1fr 120px 120px 116px 140px 74px auto; gap: 10px; align-items: end; }
@media (max-width: 860px) { .add-row { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 560px) { .add-row { grid-template-columns: 1fr 1fr; } }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: .74rem; color: var(--muted);
  letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
input[type=text], input[type=password], input[type=date], input[type=email], input[type=number], select, textarea {
  font-family: var(--sans); font-size: .95rem; color: var(--ink);
  padding: 9px 11px; background: var(--ivory); border: 1px solid var(--line);
  border-radius: var(--radius-sm); width: 100%; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--clay); box-shadow: 0 0 0 3px var(--clay-wash); }
label.checkfield { flex-direction: column; align-items: flex-start; }
label.checkfield input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--clay); margin-top: 4px; cursor: pointer; }
input::placeholder { color: #A8A499; }

.btn { font-family: var(--sans); font-size: .92rem; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); padding: 9px 16px; border: 1px solid transparent; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--clay); color: #fff; }
.btn-primary:hover { background: var(--clay-deep); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--clay); color: var(--clay-deep); }
.btn-self { align-self: end; }

.section-label { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-label .eyebrow { white-space: nowrap; }
.section-label::after { content: ""; height: 1px; background: var(--line-soft); flex: 1; }

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 13px 16px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.task.is-done { background: transparent; box-shadow: none; border-color: var(--line-soft); }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }

.check { width: 22px; height: 22px; border: 1.6px solid #CFC9BB; border-radius: 999px; background: var(--ivory);
  cursor: pointer; display: grid; place-items: center; padding: 0; transition: border-color .15s, background .15s; }
.check:hover { border-color: var(--clay); }
.check.is-done { background: var(--clay); border-color: var(--clay); color: #fff; }
.check svg { width: 12px; height: 12px; }

.task-body { min-width: 0; }
.task-title { font-weight: 500; font-size: .98rem; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.tag { font-size: .7rem; font-weight: 600; letter-spacing: .03em; padding: 2px 9px; border-radius: 999px;
  text-transform: capitalize; background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line); }
.tag.ctx-personal  { color: var(--ctx-personal);  border-color: color-mix(in srgb, var(--ctx-personal) 35%, var(--line)); }
.tag.ctx-marketing { color: var(--ctx-marketing); border-color: color-mix(in srgb, var(--ctx-marketing) 35%, var(--line)); }
.tag.ctx-autodrive { color: var(--ctx-autodrive); border-color: color-mix(in srgb, var(--ctx-autodrive) 35%, var(--line)); }
.tag.pri-high, .tag.pri-urgent { background: var(--clay-wash); color: var(--clay-deep); border-color: transparent; }
.due { font-size: .78rem; color: var(--muted); }
.due.is-overdue { color: var(--clay-deep); font-weight: 600; }

.task-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 6px;
  border-radius: 7px; line-height: 0; transition: color .15s, background .15s; }
.icon-btn:hover { color: var(--clay-deep); background: var(--clay-wash); }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .empty-glyph { font-family: var(--serif); font-size: 2rem; color: var(--clay); font-style: italic; }

/* ---------- Task: faithful-port extras ---------- */
.task { grid-template-rows: auto; }
.task-check { display: contents; }
.task.is-tonight { border-color: color-mix(in srgb, #E0A23C 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, #E0A23C 22%, transparent), var(--shadow); }

.tag.type-tag { font-family: var(--mono); font-size: .64rem; letter-spacing: .06em; background: var(--paper-2); color: var(--muted); min-width: 18px; text-align: center; }
.tag.tonight-tag { background: #FBEFD6; color: #9A6A1E; border-color: transparent; }
.tag.help-tag { background: #FBEFD6; color: #9A6A1E; border-color: transparent; }
.tag.agent-tag { background: #E7F0EA; color: var(--ctx-personal); border-color: transparent; }
.icon-btn.on { color: #B9832B; background: #FBEFD6; }
.btn-sm { font-size: .82rem; padding: 6px 12px; }
.icon-sm { font-size: 1.1rem; line-height: 1; padding: 2px 7px; }

/* Collapsible detail area spans the full task width (row 2) */
.task-detail { grid-column: 1 / -1; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); }
.task-detail > summary { cursor: pointer; font-size: .78rem; color: var(--muted); font-weight: 600;
  letter-spacing: .02em; list-style: none; user-select: none; padding: 2px 0; }
.task-detail > summary::-webkit-details-marker { display: none; }
.task-detail > summary::before { content: "\25B8"; display: inline-block; margin-right: 7px; transition: transform .15s; color: var(--clay); }
.task-detail[open] > summary::before { transform: rotate(90deg); }
.task-detail > *:not(summary) { margin-top: 12px; }

.subs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.sub { display: flex; align-items: center; gap: 10px; }
.sub-check { display: flex; }
.check-sm { width: 17px; height: 17px; border-width: 1.4px; }
.check-sm svg { width: 9px; height: 9px; }
.sub-text { flex: 1; font-size: .9rem; color: var(--ink-soft); }
.sub.is-done .sub-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }

.sub-add, .help-form { display: flex; gap: 8px; align-items: center; }
.sub-add input, .help-form input { flex: 1; }
.note-form { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.note-form label.field { margin: 0; }
.note-form textarea { width: 100%; }
.note-form .btn, .sub-add .btn { align-self: flex-start; }

.help-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--paper-2);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.agent-answer { border-left: 2px solid var(--ctx-personal); padding-left: 12px; }
.agent-label { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ctx-personal); font-weight: 700; margin-bottom: 3px; }
.agent-text { font-size: .9rem; color: var(--ink-soft); line-height: 1.55; }
.help-echo { font-size: .78rem; color: var(--muted); font-style: italic; margin-top: 6px; }
.help-pending { font-size: .86rem; color: #9A6A1E; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, #F7EFE6, transparent),
    var(--ivory); }
.login-card { width: 100%; max-width: 372px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lift); padding: 34px 30px; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-brand .brand-name { color: var(--ink); }
.login-title { font-family: var(--serif); font-size: 1.5rem; letter-spacing: -.02em; margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: .92rem; margin-bottom: 22px; }
.login-card label.field { margin-bottom: 14px; }
.login-card .btn-primary { width: 100%; margin-top: 6px; padding: 11px; }
.error { background: var(--clay-wash); color: var(--clay-deep); border: 1px solid color-mix(in srgb, var(--clay) 30%, transparent);
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 16px; padding: 14px 18px; }
  .brand-name { display: none; }
  .nav { flex-direction: row; margin: 0; flex: 1; }
  .soon { display: none; }
  .sidebar-foot { margin: 0; padding: 0; border: none; }
  .main { padding: 28px 20px 60px; }
}

:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } a.card:hover { transform: none; } }
