/*
 * Cleyo Screens — page-level layouts.
 * Sidebar, main content area, page heads, crown, doc page, design system shell.
 */

/* ============================================================
 * APP SHELL
 * ============================================================ */
.app {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.main {
  background: var(--bg);
  overflow-y: auto;
}
.main-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 32px 120px;
  position: relative;
}
/* Plan mode breathes wider — planning is a real surface, not a 760px column. */
.main-inner:has(.is-planning) { max-width: 960px; }

/* ============================================================
 * SIDEBAR
 * ============================================================ */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--l-1);
  padding: 16px 12px;
  gap: 16px;
  height: 100vh; position: sticky; top: 0;
  overflow: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 8px;
}
.sidebar-brand .mark {
  width: 28px; height: 28px;
  border-radius: var(--r-1);
  filter: drop-shadow(0 2px 6px rgba(143, 163, 255, 0.25));
}
.sidebar-brand .name-group { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar-brand .name { font-size: 14.5px; font-weight: 500; color: var(--t-1); letter-spacing: -0.01em; }
.sidebar-brand .tagline { font-size: 10.5px; color: var(--t-4); font-style: italic; margin-top: 2px; white-space: nowrap; }

.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 4px;
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase;
  color: var(--t-4);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-1);
  font-size: 13px; color: var(--t-2); font-weight: 450;
  text-align: left;
  white-space: nowrap;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.nav-item .ico {
  display: grid; place-items: center;
  width: 18px; height: 18px;
  color: var(--t-3);
}
.nav-item:hover { background: var(--s-1); color: var(--t-1); }
.nav-item:hover .ico { color: var(--t-2); }
.nav-item.active { background: var(--s-2); color: var(--t-1); }
.nav-item.active .ico { color: var(--t-1); }
.nav-item .count {
  margin-left: auto;
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--t-3);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .count { color: var(--t-2); }

.sidebar-footer {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 1px;
  border-top: 1px solid var(--l-1);
  padding-top: 10px;
}
.kbd-hint {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-1);
  font-size: 12px; color: var(--t-3);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
.kbd-hint:hover { background: var(--s-1); color: var(--t-2); }

/* ============================================================
 * TODAY CROWN
 * ============================================================ */
.today-halo {
  position: absolute; top: 0; left: -32px; right: -32px;
  height: 320px;
  background: var(--today-warm);
  pointer-events: none;
  z-index: 0;
}
.today-crown {
  position: relative;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  padding: 16px 0 32px;
  z-index: 1;
}
.today-date .day {
  font-size: 32px; font-weight: 500; letter-spacing: -0.025em;
  color: var(--t-1); line-height: 1.05;
}
.today-date .full {
  font-size: 13px; color: var(--t-3); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.today-date .sub {
  font-size: 13px; color: var(--t-3); font-style: italic;
  margin-top: 10px; max-width: 460px;
}
.today-metrics { display: flex; gap: 28px; }
.today-metric { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.today-metric .v {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums;
  font-size: 22px; font-weight: 500;
  color: var(--t-1);
  letter-spacing: -0.02em;
}
.today-metric .v .u { font-size: 11px; color: var(--t-3); margin-left: 4px; font-family: var(--f-sans); letter-spacing: 0; }
.today-metric .v.heavy { color: var(--accent); }
.today-metric .v.overloaded { color: var(--err); }
.today-metric .l { font-size: 11px; color: var(--t-4); }

/* ============================================================
 * PAGE HEAD (Everything, Stream Detail, etc.)
 * ============================================================ */
.page-head {
  padding: 0 0 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.page-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--t-4);
  text-transform: uppercase;
  font-weight: 500;
}
.page-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.page-title {
  font-size: 30px; font-weight: 500; letter-spacing: -0.025em;
  color: var(--t-1); margin: 0;
}
.page-sub {
  font-size: 13.5px; color: var(--t-3); line-height: 1.55;
  max-width: 560px; margin-top: 4px;
}

/* ============================================================
 * EVERYTHING — date spine
 * ============================================================ */
.spine {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--l-1);
}
.spine:first-of-type { border-top: 0; }
.spine-date {
  display: flex; flex-direction: column; align-items: flex-start;
  padding-top: 8px;
}
.spine-date .d {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums;
  font-size: 22px; font-weight: 500; color: var(--t-2);
  letter-spacing: -0.02em; line-height: 1;
}
.spine-date .m { font-size: 11px; color: var(--t-3); text-transform: uppercase; letter-spacing: var(--ls-eyebrow); margin-top: 2px; }
.spine-date .w { font-size: 10.5px; color: var(--t-4); margin-top: 6px; }
.spine-date.today .d { color: var(--accent); }
.spine-date.today .w { color: var(--accent); }
/* Inside the date spine the dates already carry the time signal — the
   left-edge tone bar would double it and visually collide with the spine
   column, so rows here go without it. Overdue stays in the due label. */
.spine .task-row::before { content: none; }

/* ============================================================
 * STREAM HERO
 * ============================================================ */
.stream-hero {
  display: flex; flex-direction: column; gap: 14px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--l-1);
}
.stream-swatch {
  --swatch-bg: var(--hue-indigo);
  --swatch-fg: var(--bg);
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: var(--r-2);
  background: var(--swatch-bg);
  color: var(--swatch-fg);
  font-family: var(--f-mono);
  font-size: 18px; font-weight: 500;
}
.stream-title {
  font-size: 24px; font-weight: 500; letter-spacing: -0.02em;
  color: var(--t-1);
  margin-top: 4px;
}
.stream-desc {
  font-size: 14px; color: var(--t-2); line-height: 1.55;
  max-width: 540px; margin: 4px 0 0;
}

/* ============================================================
 * EMPTY STATE
 * ============================================================ */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 60px 20px;
  text-align: center;
}
.empty .mark {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-2);
  background: var(--s-1);
  border: 1px solid var(--l-2);
  color: var(--t-3);
}
.empty .headline { font-size: 14px; color: var(--t-1); font-weight: 500; letter-spacing: -0.005em; }
.empty .sub { font-size: 12.5px; color: var(--t-3); max-width: 320px; line-height: 1.55; }

/* ============================================================
 * DOC PAGE — "How Cleyo helps"
 *
 * Reading scale (F-06). Five sizes — 38 / 20 / 17 / 14.5 / 13.
 * Scoped to .doc-main descendants. UI scale and reading scale
 * must not mix on the same screen.
 * ============================================================ */
.doc-main {
  /* Reading scale — only valid inside .doc-main descendants. */
  --rs-h1:   38px;
  --rs-h2:   20px;
  --rs-lead: 17px;
  --rs-body: 14.5px;
  --rs-meta: 13px;

  max-width: 640px;
  margin: 0 auto;
  padding: 32px 0 80px;
}
.doc-eyebrow {
  font-size: 11px; font-weight: 500;
  text-transform: uppercase;
  color: var(--t-4);
  margin-bottom: 24px;
}
.doc-h1 {
  font-size: var(--rs-h1); font-weight: 500; letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--t-1);
  margin: 0 0 28px;
}
.doc-lead {
  font-size: var(--rs-lead); line-height: 1.65;
  color: var(--t-2);
  margin: 0 0 40px;
}
.doc-h2 {
  font-size: var(--rs-h2); font-weight: 500; letter-spacing: -0.015em;
  color: var(--t-1);
  margin: 32px 0 12px;
}
.doc-p {
  font-size: var(--rs-body); line-height: 1.7;
  color: var(--t-2);
  margin: 0 0 14px;
}
.doc-p em { font-style: italic; color: var(--t-1); }
.doc-p b { font-weight: 500; color: var(--t-1); }
.doc-figure {
  margin: 48px 0;
  padding: 28px;
  background: var(--s-0);
  border: 1px solid var(--l-1);
  border-radius: var(--r-3);
}
.doc-kicker {
  font-family: var(--f-mono);
  font-size: 11px; color: var(--ai);
  letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  font-weight: 500;
}
.principle {
  display: grid; grid-template-columns: 32px 1fr; gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--l-1);
}
.principle:first-of-type { border-top: 0; }
.principle .num {
  font-family: var(--f-mono); font-size: 11px;
  color: var(--t-4);
  padding-top: 4px;
}
.principle h3 {
  font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
  color: var(--t-1); margin: 0 0 4px;
}
.principle p {
  font-size: var(--rs-meta); color: var(--t-3); line-height: 1.6;
  margin: 0;
}

/* ============================================================
 * DESIGN SYSTEM page layout (TOC + content)
 * ============================================================ */
.ds-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  align-items: start;
}
.ds-toc {
  position: sticky; top: 32px;
  display: flex; flex-direction: column; gap: 1px;
  font-size: 12px;
}
.ds-toc-group {
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase;
  color: var(--t-4);
  padding: 14px 0 6px;
}
.ds-toc a {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r-0);
  color: var(--t-3);
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.ds-toc a:hover { background: var(--s-1); color: var(--t-2); }
.ds-toc a.active { color: var(--t-1); background: var(--s-1); }
.ds-toc a .num {
  font-family: var(--f-mono); font-size: 10px; color: var(--t-4);
  font-variant-numeric: tabular-nums;
}

/* ds support */
.ds-swatch-row { display: flex; gap: 12px; flex-wrap: wrap; }
.ds-swatch-pair {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 80px;
}
.ds-swatch-pair .solid {
  height: 44px; border-radius: var(--r-2);
  border: 1px solid var(--l-1);
}
.ds-swatch-pair .soft {
  height: 22px; border-radius: var(--r-1);
  border: 1px solid var(--l-1);
}
.ds-swatch-pair .meta { font-size: 11.5px; font-weight: 500; color: var(--t-2); margin-top: 4px; }
.ds-swatch-pair .val { font-size: 10px; font-family: var(--f-mono); color: var(--t-4); }

.ds-icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}
.ds-icon-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px;
  background: var(--s-0); border: 1px solid var(--l-1);
  border-radius: var(--r-2);
  color: var(--t-2);
  transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.ds-icon-cell:hover { border-color: var(--l-2); color: var(--t-1); }
.ds-icon-cell .name { font-size: 10px; color: var(--t-4); font-family: var(--f-mono); }

.ds-state-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ds-state { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.ds-state-label { font-size: 10px; font-family: var(--f-mono); color: var(--t-4); }
.ds-overlay-demo {
  position: relative;
  height: 140px;
  background: var(--bg);
  border: 1px solid var(--l-1);
  border-radius: var(--r-3);
  overflow: hidden;
}
