/* ==========================================================================
   Personal Dashboard — stylesheet
   Values ported verbatim from the original "Notion System.dc.html" mockup.
   Nothing here is a redesign: every colour, size and spacing number below
   was lifted from an inline style in the source artboard.
   ========================================================================== */

/* The user picks three base colours (--accent-base, --pos-base, --neg-base)
   and the fonts (--font-ui, --font-num) in settings; App.theme sets them on
   <html>. Every tint below is derived from those with color-mix(), so one
   choice recolours the whole app in both light and dark mode. */

:root {
  color-scheme: light;

  --accent-base:   #1d4ed8;
  --pos-base:      #2f6f4f;
  --neg-base:      #b4453a;
  --font-ui:       "Vazirmatn";
  --font-num:      var(--font-ui);

  --bg:            #f6f6f7;
  --surface:       #ffffff;
  --surface-alt:   #fcfcfd;
  --ink:           #16181d;
  --ink-2:         #3f4451;
  --muted:         #6b7280;
  --placeholder:   #9ca3af;
  --line:          #e6e7eb;
  --line-soft:     #f0f1f4;
  --line-mid:      #eceef1;
  --check:         #c9ccd3;
  --overlay:       rgba(22, 24, 29, .34);
  --shadow:        rgba(22, 24, 29, .14);

  --accent:        var(--accent-base);
  --accent-hover:  color-mix(in srgb, var(--accent) 76%, #000);
  --on-accent:     #ffffff;
  --accent-bg:     color-mix(in srgb, var(--accent) 8%, var(--surface));
  --accent-line:   color-mix(in srgb, var(--accent) 18%, var(--surface));
  --accent-soft:   color-mix(in srgb, var(--accent) 3.5%, var(--surface));

  --pos:           var(--pos-base);
  --neg:           var(--neg-base);
  --neg-bg:        color-mix(in srgb, var(--neg) 7%, var(--surface));
  --neg-line:      color-mix(in srgb, var(--neg) 28%, var(--surface));

  --tint-1:        var(--accent);
  --tint-2:        color-mix(in srgb, var(--accent) 72%, var(--surface));
  --tint-3:        color-mix(in srgb, var(--accent) 38%, var(--surface));
  --tint-4:        color-mix(in srgb, var(--accent) 14%, var(--surface));
  --tint-5:        color-mix(in srgb, var(--accent) 7%, var(--surface));
  --tint-bar:      color-mix(in srgb, var(--accent) 24%, var(--surface));

  /* Persian text and digits always fall back to the UI font, never to a
     random system font — that mix was what made numbers look wrong. */
  --sans: var(--font-ui), Vazirmatn, "Segoe UI", Tahoma, system-ui, sans-serif;
  --num:  var(--font-num), var(--font-ui), Vazirmatn, "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", var(--font-ui), Vazirmatn, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #0f1115;
  --surface:       #171a20;
  --surface-alt:   #1c2027;
  --ink:           #e7e9ee;
  --ink-2:         #c2c7d0;
  --muted:         #8d95a3;
  --placeholder:   #646b78;
  --line:          #2b3039;
  --line-soft:     #232831;
  --line-mid:      #272c35;
  --check:         #4b5261;
  --overlay:       rgba(0, 0, 0, .6);
  --shadow:        rgba(0, 0, 0, .5);

  /* Lift the chosen colours so they stay readable on a dark surface. */
  --accent:        color-mix(in srgb, var(--accent-base) 68%, #ffffff);
  --accent-hover:  color-mix(in srgb, var(--accent) 80%, #ffffff);
  --on-accent:     #0f1115;
  --accent-bg:     color-mix(in srgb, var(--accent) 16%, var(--surface));
  --accent-line:   color-mix(in srgb, var(--accent) 34%, var(--surface));
  --accent-soft:   color-mix(in srgb, var(--accent) 7%, var(--surface));

  --pos:           color-mix(in srgb, var(--pos-base) 62%, #ffffff);
  --neg:           color-mix(in srgb, var(--neg-base) 62%, #ffffff);
  --neg-bg:        color-mix(in srgb, var(--neg) 14%, var(--surface));
  --neg-line:      color-mix(in srgb, var(--neg) 40%, var(--surface));

  --tint-4:        color-mix(in srgb, var(--accent) 22%, var(--surface));
  --tint-5:        color-mix(in srgb, var(--accent) 12%, var(--surface));
  --tint-bar:      color-mix(in srgb, var(--accent) 32%, var(--surface));
}

html, body { margin: 0; padding: 0; background: var(--bg); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
::placeholder { color: var(--placeholder); }

/* Numbers: the UI font with equal-width digits, so columns line up. */
.num, .cell-num {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.cell-num { font-size: 12.5px; color: var(--muted); }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ---------- shell ---------------------------------------------------- */

.topbar {
  width: 100%; max-width: 1180px;
  display: flex; flex-wrap: wrap;
  align-items: baseline; justify-content: space-between;
  gap: 8px; padding: 0 4px;
}
.topbar__title { font-size: 15px; font-weight: 600; }
.topbar__meta {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: .04em;
}

.shell {
  width: 100%; max-width: 1180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  display: flex; flex-wrap: wrap;
  min-height: 720px;
}

.nav {
  flex: 0 0 232px; min-width: 200px;
  border-left: 1px solid var(--line);
  background: var(--surface-alt);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav__head {
  padding: 6px 10px 14px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--muted); letter-spacing: .1em;
}
.nav__group {
  padding: 16px 10px 6px;
  font-family: var(--sans); font-size: 11.5px;
  color: var(--muted);
}
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 4px; cursor: pointer;
  font-size: 14px; font-weight: 500;
  background: transparent; color: var(--ink-2);
  border: 0; width: 100%; text-align: right;
  font-family: inherit;
}
.nav__item:hover { background: var(--line-soft); }
.nav__item.is-active { background: var(--accent-bg); color: var(--accent); }
.nav__dot {
  width: 5px; height: 5px; border-radius: 1px;
  background: var(--check); flex: 0 0 auto;
}
.nav__item.is-active .nav__dot { background: var(--accent); }
.nav__foot {
  margin-top: auto; padding: 14px 10px 0;
  border-top: 1px solid var(--line-mid);
  font-size: 11.5px; line-height: 1.7; color: var(--muted);
}

.main { flex: 1 1 420px; min-width: 0; padding: 32px 36px 56px; }

/* ---------- headings & primitives ------------------------------------ */

.eyebrow {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: .08em;
}
/* Used with Persian labels too: letter-spacing would break the joined script. */
.eyebrow--accent { color: var(--accent); letter-spacing: 0; font-family: var(--sans); font-size: 11.5px; font-weight: 600; }
.page-title {
  margin: 6px 0 28px; font-size: 30px;
  font-weight: 700; letter-spacing: -.01em;
}
.page-title--tight { margin-bottom: 10px; }
.page-lede {
  margin: 0 0 30px; font-size: 13.5px; line-height: 1.9;
  color: var(--muted); max-width: 62ch;
}
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 7px; margin-bottom: 16px;
  font-size: 14px; font-weight: 600;
  gap: 12px;
}
.section-head--flush { margin-bottom: 2px; }
.section-head__count { font-family: var(--num); font-size: 12px; color: var(--muted); font-weight: 400; }

.card {
  border: 1px solid var(--line); border-radius: 5px; padding: 14px;
}
.card--pad { padding: 16px 18px; }
.card--soft { background: var(--surface-alt); }
.card--strong { border-color: var(--ink); }

.stat-grid {
  display: grid; border: 1px solid var(--line);
  border-radius: 5px; overflow: hidden;
}
.stat {
  padding: 16px 18px; border-left: 1px solid var(--line);
}
.stat:last-child { border-left: 0; }
.stat--sm { padding: 12px 14px; }
.stat__label { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.stat__value { font-family: var(--num); font-variant-numeric: tabular-nums; font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.stat__value--sm { font-size: 17px; }
.stat__value--xs { font-size: 18px; }
.stat__value.is-pos { color: var(--pos); }
.stat__value.is-neg { color: var(--neg); }
.stat__note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--accent); }
.bar--thin { height: 4px; border-radius: 2px; }
.bar--mid { height: 5px; }
.bar-legend {
  display: flex; justify-content: space-between;
  font-family: var(--num); font-size: 11.5px;
  color: var(--muted); margin-top: 6px;
}

.chip {
  font-family: var(--sans); font-size: 11px;
  color: var(--accent); background: var(--accent-bg);
  padding: 3px 7px; border-radius: 3px; white-space: nowrap;
}
.chip--mute { color: var(--muted); background: var(--line-soft); }

/* ---------- buttons -------------------------------------------------- */

.btn {
  padding: 8px 18px; background: var(--accent); color: var(--on-accent);
  border: 0; border-radius: 4px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn[disabled] { opacity: .5; cursor: default; }

.btn-ghost {
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-2); border-radius: 4px;
  font-family: inherit; font-size: 12.5px;
  padding: 7px 14px; cursor: pointer;
}
.btn-ghost:hover { background: var(--line-soft); }
.btn-ghost--danger { color: var(--neg); border-color: var(--neg-line); }
.btn-ghost--danger:hover { background: var(--neg-bg); }

/* the "+ کار جدید" style link-button from the mockup */
.btn-add {
  padding: 12px 2px; font-size: 13px; color: var(--accent);
  background: none; border: 0; cursor: pointer;
  font-family: inherit; text-align: right; display: block;
}
.btn-add:hover { color: var(--accent-hover); text-decoration: underline; }
.btn-add--inline { padding: 4px 0; font-size: 12.5px; }

/* small icon actions revealed on row hover */
.row-actions {
  display: flex; gap: 4px; flex: 0 0 auto;
  opacity: 0; transition: opacity .08s linear;
}
.row:hover .row-actions,
.row:focus-within .row-actions { opacity: 1; }
.icon-btn {
  background: none; border: 0; cursor: pointer;
  color: var(--muted); font-family: var(--sans); font-size: 11.5px;
  padding: 2px 6px; border-radius: 3px; line-height: 1.6;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn--danger:hover { background: var(--neg-bg); color: var(--neg); }
.icon-btn[disabled] { opacity: .35; cursor: default; background: none; }

/* On a touch screen there is no hover, so reveal-on-hover would hide these
   controls permanently. Keep them visible there instead. */
@media (hover: none) {
  .row-actions { opacity: 1; }
}

/* ---------- quick capture -------------------------------------------- */

.capture {
  border: 1px solid var(--line); border-radius: 5px;
  padding: 14px 16px; display: flex; flex-wrap: wrap;
  gap: 12px; align-items: center; background: var(--surface-alt);
}
.capture__body { flex: 1 1 240px; min-width: 0; }
.capture__label {
  font-size: 11px; font-family: var(--mono); color: var(--accent);
  letter-spacing: .08em; margin-bottom: 6px;
}
.capture__input {
  width: 100%; border: 0; background: transparent;
  font-family: inherit; font-size: 15px; color: var(--ink);
  padding: 0; resize: none; line-height: 1.6;
}
.capture__input:focus { outline: none; }

/* ---------- task rows ------------------------------------------------ */

.task {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid var(--line-soft);
}
.task.is-done { opacity: .5; }
.task__box {
  width: 14px; height: 14px; border: 1.5px solid var(--check);
  border-radius: 3px; flex: 0 0 auto; cursor: pointer;
  background: transparent; padding: 0;
}
.task.is-done .task__box { border-color: var(--accent); background: var(--accent); }
.task__title {
  flex: 1 1 auto; font-size: 14px; cursor: text;
  min-width: 0; overflow-wrap: anywhere;
}
.task.is-done .task__title { text-decoration: line-through; }

/* ---------- tables (CSS-grid, exactly as the mockup) ------------------ */

.table { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.table__head, .table__row { display: grid; }
.table__head {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  font-family: var(--sans); font-size: 11.5px; font-weight: 500;
  color: var(--muted);
}
.table__head > div { padding: 10px 14px; border-left: 1px solid var(--line); }
.table__head > div:last-child { border-left: 0; }
.table__row {
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px; align-items: center;
}
.table__row:last-child { border-bottom: 0; }
.table__row:hover { background: var(--surface-alt); }
.table__row > div { padding: 12px 14px; border-left: 1px solid var(--line-soft); }
.table__row > div:last-child { border-left: 0; }
.table__row.is-dim { opacity: .55; }
.cell-strong { font-weight: 500; }
.cell-accent { color: var(--accent); }
.cell-mono { font-family: var(--num); font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); }
.cell-status { font-size: 12px; }

.grid-projects { grid-template-columns: minmax(0,2.3fr) minmax(0,1.5fr) 96px 96px 74px; }
.grid-people   { grid-template-columns: minmax(0,1.3fr) minmax(0,1.4fr) 88px 74px; }

/* ---------- layout helpers ------------------------------------------- */

.cols { display: flex; flex-wrap: wrap; gap: 28px; }
.cols--wide { gap: 32px; }
.col { flex: 1 1 320px; min-width: 0; }
.col--narrow { flex: 1 1 260px; }

.autogrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.autogrid--notes { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.autogrid--tasks { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.autogrid--stats { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.autogrid--stats3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.autogrid--money { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack--sm { gap: 8px; }
.stack--lg { gap: 14px; }

.mt-38 { margin-top: 38px; }
.mt-36 { margin-top: 36px; }
.mt-30 { margin-top: 30px; }
.mt-24 { margin-top: 24px; }
.mt-12 { margin-top: 12px; }
.mt-8  { margin-top: 8px; }
.mb-34 { margin-bottom: 34px; }
.mb-32 { margin-bottom: 32px; }
.mb-30 { margin-bottom: 30px; }

/* ---------- project card --------------------------------------------- */

.proj__name { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.proj__goal { font-size: 11.5px; color: var(--muted); margin-bottom: 12px; }
.proj__meta {
  display: flex; justify-content: space-between; margin-top: 7px;
  font-family: var(--num); font-size: 11.5px; color: var(--muted);
}

/* ---------- reminders ------------------------------------------------ */

.reminders { font-size: 13px; line-height: 1.9; color: var(--ink-2); }
.reminder { display: flex; gap: 8px; }
.reminder__day {
  font-family: var(--num); font-variant-numeric: tabular-nums; color: var(--muted);
  font-size: 12.5px; padding-top: 1px; flex: 0 0 auto; min-width: 1.4em;
}

/* ---------- money chart ---------------------------------------------- */

.chart { position: relative; height: 132px; border-bottom: 1px solid var(--ink); }
.chart__grid { position: absolute; right: 0; left: 0; border-top: 1px dashed var(--line-mid); }
.chart__bars {
  position: absolute; inset: 0;
  display: grid; align-items: end; gap: 4px;
}
.chart__col { display: flex; gap: 3px; align-items: flex-end; justify-content: center; height: 100%; }
.chart__bar { width: 14px; background: var(--accent); }
.chart__bar--out { background: var(--tint-bar); }
.chart__labels {
  display: grid; gap: 4px; margin-top: 8px;
  font-size: 11.5px; color: var(--muted); text-align: center;
}
.chart__legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.swatch { width: 9px; height: 9px; border-radius: 1px; display: inline-block; }
.legend-item { display: flex; align-items: center; gap: 6px; }

.mix { display: flex; height: 26px; border-radius: 3px; overflow: hidden; }
.mix__seg { height: 100%; }
.mix__legend {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px;
  font-size: 12px; color: var(--ink-2);
}
.mix__legend .legend-item { gap: 7px; }

.money-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 2px; border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px; gap: 10px;
}
.money-row--sub { padding: 11px 2px; }
.money-row__amount { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 500; flex: 0 0 auto; }
.money-row__label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.money-sum {
  display: flex; justify-content: space-between; padding: 11px 2px;
  font-family: var(--num); font-size: 12.5px; color: var(--accent);
}

.catbar__head {
  display: flex; justify-content: space-between;
  font-size: 13px; margin-bottom: 5px;
}

/* ---------- notes ----------------------------------------------------- */

.notes-col__head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 12px;
}
.notes-col__head.is-developed { border-bottom-color: var(--accent); }
.notes-col__head.is-reference { border-bottom-color: var(--check); }
.notes-col__title { font-size: 14px; font-weight: 600; }
.notes-col__head.is-developed .notes-col__title { color: var(--accent); }
.notes-col__head.is-reference .notes-col__title { color: var(--muted); }
.notes-col__count { font-family: var(--num); font-size: 12px; color: var(--muted); }

.note {
  border: 1px solid var(--line); border-radius: 4px; padding: 12px;
  font-size: 13.5px; line-height: 1.7; cursor: pointer;
  background: var(--surface); position: relative;
}
.note:hover { border-color: var(--check); }
.note--developed { border-color: var(--accent-line); background: var(--accent-soft); }
.note__title { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.note__body { font-size: 12.5px; line-height: 1.8; color: var(--ink-2); }
.note__link { font-size: 11px; color: var(--accent); margin-top: 10px; }
.note__source { display: inline-block; font-size: 11px; margin-top: 6px; }
.note__meta {
  font-size: 11px; color: var(--muted);
  margin-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}

.search {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 22px;
}
.search__input {
  flex: 1 1 auto; border: 0; background: transparent; padding: 0;
  font-family: inherit; font-size: 14px; color: var(--ink);
}
.search__input:focus { outline: none; }

/* ---------- learning -------------------------------------------------- */

.course {
  border: 1px solid var(--line); border-radius: 5px; padding: 16px 18px;
  display: flex; gap: 16px; align-items: center;
}
.course__ring {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.course__ring-in {
  width: 40px; height: 40px; border-radius: 50%; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--num); font-size: 12.5px; font-weight: 600; color: var(--accent);
}
.course__ring-in.is-mute { color: var(--muted); }
.course__body { min-width: 0; flex: 1 1 auto; }
.course__name { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.course__next { font-size: 12.5px; color: var(--muted); }

/* ---------- guide ------------------------------------------------------ */

.guide-item { border: 1px solid var(--line); border-radius: 5px; padding: 16px 18px; }
.guide-item__head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 12px; }
.guide-item__num { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.guide-item__title { font-size: 15px; font-weight: 600; }
.guide-item__fields {
  font-family: var(--mono); font-size: 12.5px;
  line-height: 2.1; color: var(--ink-2);
}
.guide-item__note { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.8; }
.guide-habits { font-size: 13px; line-height: 2; color: var(--ink-2); }

/* ---------- empty states ----------------------------------------------- */

.empty {
  border: 1px dashed var(--line); border-radius: 5px;
  padding: 20px 18px; text-align: center;
  font-size: 13px; color: var(--muted); line-height: 1.9;
}
.empty--inline { padding: 14px 12px; font-size: 12.5px; }

/* ---------- modal ------------------------------------------------------ */

.overlay {
  position: fixed; inset: 0; background: var(--overlay);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; width: 100%; max-width: 520px;
  padding: 22px 24px 20px;
  box-shadow: 0 12px 40px var(--shadow);
}
.modal--narrow { max-width: 400px; }
.modal__title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.modal__sub { font-size: 12.5px; color: var(--muted); margin: 0 0 18px; line-height: 1.8; }
.modal__foot {
  display: flex; gap: 10px; align-items: center;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft);
}
.modal__foot .spacer { flex: 1 1 auto; }

.field { margin-bottom: 14px; }
.field__label {
  display: block; font-size: 12px; color: var(--muted);
  margin-bottom: 6px; font-weight: 500;
}
.field__req { color: var(--accent); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 4px;
  padding: 9px 11px; font-family: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--surface);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg);
}
.input--mono { font-family: var(--num); font-variant-numeric: tabular-nums; }
.input--ltr { direction: ltr; text-align: left; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.8; }
.select { cursor: pointer; }
.field__hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.7; }
.field__error { font-size: 11.5px; color: var(--neg); margin-top: 5px; }
.field--check { display: flex; align-items: center; gap: 9px; }
.field--check .field__label { margin: 0; font-size: 13.5px; color: var(--ink); }
.field--row { display: flex; gap: 12px; }
.field--row > * { flex: 1 1 0; }

/* ---------- toast ------------------------------------------------------- */

.toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 60;
  align-items: center; pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--bg); border-radius: 4px;
  padding: 9px 16px; font-size: 13px; font-weight: 500;
  box-shadow: 0 6px 20px var(--shadow);
  max-width: 90vw;
}
.toast--err { background: var(--neg); }

/* ---------- settings ---------------------------------------------------- */

.setting-row {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid var(--line-soft);
}
.setting-row__body { flex: 1 1 260px; min-width: 0; }
.setting-row__title { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.setting-row__desc { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.setting-row__control { flex: 0 1 auto; min-width: 0; max-width: 100%; }

.segmented {
  display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line);
  border-radius: 5px; overflow: hidden; background: var(--surface);
}
.segmented__item {
  border: 0; border-left: 1px solid var(--line); background: transparent;
  padding: 7px 14px; font-family: var(--num); font-size: 13px;
  color: var(--ink-2); cursor: pointer;
}
.segmented__item:last-child { border-left: 0; }
.segmented__item:hover { background: var(--line-soft); }
.segmented__item.is-active { background: var(--accent); color: var(--on-accent); font-weight: 600; }

.accent-control { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0;
}
.swatch-btn:hover { box-shadow: 0 0 0 2px var(--check); }
.swatch-btn.is-active { box-shadow: 0 0 0 2px var(--ink); }

.color-pair { display: flex; flex-wrap: wrap; gap: 16px; }
.color-control {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.color-control__hex { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.color-input {
  width: 34px; height: 28px; padding: 0; border: 1px solid var(--line);
  border-radius: 4px; background: var(--surface); cursor: pointer;
}
.color-input::-webkit-color-swatch-wrapper { padding: 3px; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 2px; }

.custom-font {
  margin-top: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 5px;
}
.theme-preview { margin-top: 18px; }

/* ---------- categories -------------------------------------------------- */

.cat-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: 0 0 18px;
}
.cat-bar__label { font-size: 12px; color: var(--muted); }
.cat-bar__chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; min-width: 0; }
.cat-bar__manage { flex: 0 0 auto; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); border-radius: 999px;
  padding: 4px 11px; font-family: var(--sans); font-size: 12.5px; cursor: pointer;
}
.cat-chip:hover { background: var(--line-soft); }
.cat-chip.is-active { background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.cat-chip__count { font-size: 11px; color: var(--muted); }
.cat-chip.is-active .cat-chip__count { color: var(--accent); }

.cat-tag {
  display: inline-block; font-size: 11px; line-height: 1.6;
  color: var(--ink-2); background: var(--line-soft);
  border: 1px solid var(--line-mid); border-radius: 999px;
  padding: 0 8px; white-space: nowrap; vertical-align: middle; font-weight: 400;
}
.cat-preview { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }

.cat-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.cat-list__row { display: flex; align-items: center; gap: 8px; }
.cat-list__order { display: flex; flex-direction: column; flex: 0 0 auto; }
.cat-list__order .icon-btn { padding: 0 5px; font-size: 9px; line-height: 1.5; }
.cat-list__name { flex: 1 1 auto; min-width: 0; padding: 6px 10px; }
.cat-add { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.cat-add .input { flex: 1 1 auto; min-width: 0; }

/* ---------- pairs (details / materials) --------------------------------- */

.pairs { display: flex; flex-direction: column; gap: 6px; }
.pairs__head, .pairs__row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 26px; gap: 6px; align-items: center;
}
.pairs__head { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.pairs__head::after { content: ''; }
.pairs__row .input { padding: 7px 9px; font-size: 13px; }
.pairs__row .icon-btn { font-size: 15px; padding: 0 6px; }

/* ---------- people / profile --------------------------------------------- */

.person-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 4px; font-size: 11.5px; font-weight: 400;
}
.profile__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px 18px; margin-bottom: 6px;
}
.profile__item { font-size: 13.5px; overflow-wrap: anywhere; }
.profile__label { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.profile__block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.profile__details { display: flex; flex-direction: column; }
.profile__detail {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.profile__detail:last-child { border-bottom: 0; }
.profile__detail > :last-child { text-align: left; overflow-wrap: anywhere; min-width: 0; }
.profile__notes { font-size: 13.5px; line-height: 1.9; white-space: pre-wrap; color: var(--ink-2); }
.profile__doc { display: inline-block; text-decoration: none; }
.profile__doc:hover { text-decoration: none; }

/* ---------- learning materials ------------------------------------------- */

.materials {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 8px; font-size: 12.5px;
}
.materials__label { color: var(--muted); }
.materials__link {
  background: var(--accent-bg); border-radius: 3px; padding: 2px 8px;
}
.materials__link:hover { text-decoration: none; background: var(--accent-line); }
.materials__link.is-missing { color: var(--muted); background: var(--line-soft); }
.materials__add { padding: 6px 0 0; font-size: 12px; }

/* ---------- top bar tools -------------------------------------------------- */

.topbar__tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.topbar__btn {
  border: 1px solid var(--line); background: var(--surface);
  padding: 3px 10px; font-size: 12px; line-height: 1.6;
}
.sync {
  border: 0; background: none; padding: 2px 4px; cursor: default;
  font-family: var(--sans); font-size: 11.5px; color: var(--muted);
}
.sync::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--pos); margin-left: 6px; vertical-align: middle;
}
.sync.is-saving::before { background: var(--check); }
.sync.is-error, .sync.is-conflict, .sync.is-auth { color: var(--neg); cursor: pointer; text-decoration: underline; }
.sync.is-error::before, .sync.is-conflict::before, .sync.is-auth::before { background: var(--neg); }

/* ---------- gate (loading / login / setup) ------------------------------- */

.gate {
  width: 100%; max-width: 1180px; min-height: 60vh;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh;
}
.gate-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 26px 26px 24px;
}
.gate-card__title { font-size: 22px; font-weight: 700; margin: 8px 0 8px; }
.gate-card__lede { font-size: 13px; color: var(--muted); line-height: 1.9; margin: 0 0 20px; }
.gate-card .btn { width: 100%; padding: 10px 18px; }
.gate-loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13.5px; }
.gate-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: pld-spin .8s linear infinite;
}
@keyframes pld-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gate-spinner { animation: none; } }

.ext-link { white-space: nowrap; }

/* ---------- responsive --------------------------------------------------- */

@media (max-width: 760px) {
  body { padding: 16px 10px 48px; }
  .nav {
    flex: 1 1 100%;
    border-left: 0; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; gap: 6px; align-items: center;
  }
  .nav__head, .nav__foot { display: none; }
  .nav__group { padding: 6px 4px; }
  .nav__item { width: auto; }
  .main { padding: 22px 16px 40px; }
  .page-title { font-size: 24px; }
  .grid-projects { grid-template-columns: minmax(0,1.6fr) 84px 64px; }
  .grid-projects > div:nth-child(2),
  .grid-projects > div:nth-child(4) { display: none; }
  .grid-people { grid-template-columns: minmax(0,1.3fr) 84px 64px; }
  .grid-people > div:nth-child(2) { display: none; }
  .cols, .cols--wide { gap: 24px; }
  .field--row { flex-direction: column; gap: 0; }
  .setting-row__control { width: 100%; }
  .setting-row__control .select, .setting-row__control .input { width: 100% !important; }
  .pairs__head { display: none; }
  .pairs__row { grid-template-columns: minmax(0, 1fr) 26px; }
  .pairs__row .pairs__value { grid-column: 1; grid-row: 2; }
  .pairs__row { padding-bottom: 6px; border-bottom: 1px dashed var(--line-soft); }
  .topbar { align-items: center; }
  /* The task title matters more than the project chip on a narrow screen. */
  .task .chip { max-width: 38%; overflow: hidden; text-overflow: ellipsis; }
}

@media print {
  body { padding: 0; }
  .nav, .row-actions, .btn, .btn-add, .capture { display: none; }
  .shell { border: 0; }
}
