/* Lab CRM — «lightbox» UI
   Unbounded (display) + Onest (text). One loud element: the day hero with story segments.
   Everything else: ink on white sheets, hairlines instead of shadows, color only for status. */

@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/onest-cyrillic-wght-normal.woff2) format("woff2-variations"), url(fonts/onest-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/onest-latin-wght-normal.woff2) format("woff2-variations"), url(fonts/onest-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url(fonts/unbounded-cyrillic-wght-normal.woff2) format("woff2-variations"), url(fonts/unbounded-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url(fonts/unbounded-latin-wght-normal.woff2) format("woff2-variations"), url(fonts/unbounded-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* palette */
  --lightbox: #EDEEF1;      /* app background */
  --sheet: #FFFFFF;         /* surfaces */
  --sheet-2: #F6F7F9;       /* inset areas */
  --ink: #15131A;           /* text, primary actions */
  --graphite: #64626D;      /* secondary text */
  --mist: #9C9AA5;          /* tertiary text */
  --rule: #DFE0E5;          /* hairlines */
  --rule-strong: #C9CAD1;
  --signal: #FF2E6C;        /* the one accent: today, progress, attention */
  --signal-soft: #FFE6EE;
  --cobalt: #3346FF;        /* in progress, links, focus */
  --cobalt-soft: #E8EAFF;
  --amber: #C27C00;         /* in review (text-safe amber) */
  --amber-soft: #FFF2D6;
  --mint: #0C9468;          /* done */
  --mint-soft: #DDF5EC;
  --hover: #F1F2F5;

  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Onest", system-ui, sans-serif;

  /* radii by role, not one-size */
  --r-panel: 20px;
  --r-card: 14px;
  --r-field: 10px;
  --r-chip: 6px;

  --sidebar: 244px;
  --shadow-float: 0 24px 60px rgba(21, 19, 26, .22), 0 2px 8px rgba(21, 19, 26, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --lightbox: #121116;
    --sheet: #1B1A21;
    --sheet-2: #222129;
    --ink: #F2F1F5;
    --graphite: #A7A5B0;
    --mist: #6F6D78;
    --rule: #2D2C34;
    --rule-strong: #3B3A43;
    --signal: #FF4F86;
    --signal-soft: #3A1624;
    --cobalt: #7381FF;
    --cobalt-soft: #1E2246;
    --amber: #F0B23A;
    --amber-soft: #36290F;
    --mint: #3BCB97;
    --mint-soft: #11302A;
    --hover: #24232B;
    --shadow-float: 0 24px 60px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink);
  background: var(--lightbox); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01";
}
a { color: var(--cobalt); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 .75em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; border-radius: 4px; }
.ic { flex: none; display: block; }
.muted { color: var(--graphite); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.app { padding-left: var(--sidebar); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column;
  padding: 22px 14px 14px; background: var(--lightbox); border-right: 1px solid var(--rule); z-index: 20;
}
.brand {
  display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important;
  font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.03em; padding: 0 10px 22px;
}
.brand-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--signal); flex: none; box-shadow: 0 0 0 4px var(--signal-soft); }
.quick-add-btn { margin: 0 0 18px; justify-content: flex-start; padding-left: 14px; }
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-field); color: var(--graphite);
  font-weight: 500; text-decoration: none !important;
}
.nav-link:hover { color: var(--ink); background: var(--hover); }
.nav-link.active { color: var(--ink); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); }
.nav-link.active .ic { color: var(--signal); }
.nav-badge { margin-left: auto; color: var(--signal); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sidebar-foot { border-top: 1px solid var(--rule); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.me-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: var(--r-field); color: var(--ink); text-decoration: none !important; }
.me-card:hover, .me-card.active { background: var(--hover); }
.me-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-meta strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-meta small { color: var(--graphite); font-size: 12.5px; }
.sidebar-actions { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.main { max-width: 1180px; margin: 0 auto; padding: 36px 40px 72px; }
.topbar, .tabbar { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-title { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.1; letter-spacing: -0.035em; }
.page-sub { color: var(--graphite); margin: 8px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Surfaces ---------- */
.card { background: var(--sheet); border-radius: var(--r-panel); border: 1px solid var(--rule); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head h2, .card-head h3 { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .count { color: var(--mist); font-weight: 500; font-variant-numeric: tabular-nums; }
.card-body { padding: 10px 22px 22px; }
.section-title { font-size: 15px; font-weight: 600; color: var(--ink); margin: 32px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .count { color: var(--mist); font-weight: 500; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer;
  text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.btn-primary:hover { background: var(--ink); opacity: .88; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--graphite); font-weight: 500; }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 35%, transparent); }
.btn-danger:hover { background: var(--signal-soft); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-lg { height: 48px; font-size: 15px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; border: 0; background: transparent;
  color: var(--graphite); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.danger:hover { color: var(--signal); background: var(--signal-soft); }
.lang-form { margin: 0; display: inline; }
.lang-btn { border: 1px solid var(--rule-strong); background: transparent; border-radius: var(--r-chip); padding: 3px 8px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--graphite); }
.lang-btn:hover { color: var(--ink); border-color: var(--graphite); }

.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-field); border: 1px solid var(--rule-strong); background: var(--sheet);
  color: var(--ink); font: inherit; font-size: 15px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--mist); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; line-height: 1.55; }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239C9AA5' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus { border-color: var(--cobalt); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cobalt) 18%, transparent); }
.input-lg { height: 50px; font-size: 18px; font-weight: 500; }
.input-time { max-width: 120px; }
.input-sm { height: 34px; font-size: 14px; padding: 0 10px; }
select.input-sm { padding-right: 28px; background-position: right 9px center; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field > span { font-size: 13.5px; font-weight: 500; color: var(--graphite); }
.field small { color: var(--mist); font-size: 12.5px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row-gap { display: flex; gap: 8px; align-items: center; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

.flash { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-card); margin-bottom: 18px; font-weight: 500; font-size: 14px; border: 1px solid transparent; }
.flash-x { margin-left: auto; border: 0; background: transparent; cursor: pointer; color: inherit; opacity: .6; padding: 2px; }
.flash-success { background: var(--mint-soft); color: var(--mint); }
.flash-error { background: var(--signal-soft); color: var(--signal); }
.flash-info { background: var(--cobalt-soft); color: var(--cobalt); }

.avatar {
  --c: var(--cobalt); width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 14%, var(--sheet)); color: color-mix(in srgb, var(--c) 80%, var(--ink));
  font-weight: 600; font-size: 12px;
}
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 60px; height: 60px; font-size: 20px; font-family: var(--display); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-chip); font-size: 12.5px; font-weight: 500; background: var(--hover); color: var(--graphite); white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-project { --c: var(--cobalt); background: transparent; color: var(--graphite); padding: 0; }
.badge-project .dot { background: var(--c); width: 8px; height: 8px; border-radius: 2px; }
.prio-low { color: var(--mist); }
.prio-normal { color: var(--graphite); }
.prio-high { color: var(--amber); background: var(--amber-soft); }
.prio-urgent { color: var(--sheet); background: var(--signal); }
.st-todo { background: var(--hover); color: var(--graphite); }
.st-in_progress { background: var(--cobalt-soft); color: var(--cobalt); }
.st-review { background: var(--amber-soft); color: var(--amber); }
.st-done { background: var(--mint-soft); color: var(--mint); }
.role-admin { background: var(--ink); color: var(--sheet); }
.role-manager { background: var(--cobalt-soft); color: var(--cobalt); }
.role-model { background: var(--signal-soft); color: var(--signal); }

.empty-state { text-align: left; padding: 28px 22px; color: var(--graphite); }
.empty-state.big { padding: 56px 40px; }
.empty-state h2, .empty-state h3 { color: var(--ink); margin-bottom: 6px; font-size: 19px; font-weight: 600; }
.empty-state p { max-width: 46ch; }
.empty-state .btn { margin-top: 12px; }
.empty-emoji { display: none; }

.tabs { display: inline-flex; background: var(--sheet); border: 1px solid var(--rule); border-radius: 999px; padding: 3px; gap: 2px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px; color: var(--graphite); font-weight: 500; font-size: 14px; text-decoration: none !important; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { background: var(--ink); color: var(--sheet); }

/* ---------- Day hero (the loud element) ---------- */
.day-hero { margin: 4px 0 34px; }
.day-hero .weekday { font-size: 15px; color: var(--graphite); font-weight: 500; }
.day-hero h1 {
  font-family: var(--display); font-weight: 700; font-size: clamp(40px, 6vw, 68px); line-height: .98; letter-spacing: -0.045em; margin: 4px 0 22px;
}
.stories { display: flex; gap: 4px; max-width: 720px; }
.stories span { flex: 1; height: 5px; border-radius: 3px; background: var(--rule); position: relative; overflow: hidden; }
.stories span.on { background: var(--signal); }
.stories span.late { background: transparent; box-shadow: inset 0 0 0 1.5px var(--signal); }
.stories.empty span { background: var(--rule); }
.day-summary { margin: 14px 0 0; font-size: 16px; color: var(--graphite); max-width: 60ch; }
.day-summary b { color: var(--ink); font-weight: 600; }
.day-summary a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.day-summary a.late { color: var(--signal); text-decoration-color: currentColor; }
@media (prefers-reduced-motion: no-preference) {
  .stories span.on { animation: fill .6s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms + 120ms); transform-origin: left; }
  @keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- Tasks ---------- */
.task-list { display: flex; flex-direction: column; }
.task-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--rule); }
.task-row:last-child { border-bottom: 0; }
.task-check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--rule-strong); background: transparent; cursor: pointer; flex: none;
  display: grid; place-items: center; margin-top: 1px; color: transparent; padding: 0; transition: background .15s, border-color .15s;
}
.task-check:hover { border-color: var(--mint); color: var(--mint); }
.task-check.p-high { border-color: var(--amber); }
.task-check.p-urgent { border-color: var(--signal); border-width: 2px; }
.task-row.is-done .task-check { background: var(--mint); border-color: var(--mint); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { color: var(--ink); font-weight: 500; text-decoration: none !important; display: block; word-break: break-word; }
.task-title:hover { color: var(--cobalt); }
.task-row.is-done .task-title { color: var(--mist); text-decoration: line-through !important; text-decoration-color: var(--rule-strong) !important; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--graphite); }
.task-meta .m { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .m .ic { width: 14px; height: 14px; }
.task-meta .overdue { color: var(--signal); font-weight: 600; }
.task-meta .due-today { color: var(--ink); font-weight: 600; }
.task-side { display: flex; align-items: center; gap: 10px; flex: none; padding-top: 1px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filters .input { width: auto; min-width: 130px; }
.filters .search { position: relative; flex: 1; min-width: 180px; }
.filters .search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--mist); }
.filters .search .input { padding-left: 34px; width: 100%; }

.group { margin-bottom: 6px; }
.group-title { font-size: 15px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; padding: 20px 2px 4px; }
.group-title .count { color: var(--mist); font-weight: 500; font-variant-numeric: tabular-nums; }
.group-title .when { color: var(--graphite); font-weight: 400; }
.group-title.danger { color: var(--signal); }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 12px; }
.column { border-radius: var(--r-panel); padding: 8px; min-height: 160px; background: color-mix(in srgb, var(--sheet) 45%, transparent); border: 1px solid var(--rule); }
.column.drag-over { border-color: var(--cobalt); background: var(--cobalt-soft); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; font-weight: 600; font-size: 14px; }
.column-head .count { color: var(--mist); font-weight: 500; }
.column-head .dot { width: 8px; height: 8px; border-radius: 2px; }
.column-body { display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.kcard { background: var(--sheet); border-radius: var(--r-card); padding: 12px 12px 10px; border: 1px solid var(--rule); cursor: grab; position: relative; }
.kcard:hover { border-color: var(--rule-strong); }
.kcard.dragging { opacity: .5; }
.kcard .task-title { font-size: 14px; margin-bottom: 8px; padding-right: 22px; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.kcard-foot .task-meta { margin: 0; }
.kcard .advance { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; opacity: 0; }
.kcard:hover .advance, .kcard:focus-within .advance { opacity: 1; }
.kcard.p-urgent { box-shadow: inset 3px 0 0 var(--signal); }
.kcard.p-high { box-shadow: inset 3px 0 0 var(--amber); }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-head h2 { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.03em; min-width: 230px; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--rule); gap: 1px; border-radius: var(--r-panel); overflow: hidden; border: 1px solid var(--rule); }
.cal-dow { background: var(--sheet-2); padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--graphite); }
.cal-day { background: var(--sheet); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 3px; position: relative; }
.cal-day.other { background: var(--sheet-2); }
.cal-day.other .cal-num { color: var(--mist); }
.cal-num { font-size: 13px; font-weight: 600; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.cal-day.today .cal-num { background: var(--signal); color: #fff; }
.cal-day .cal-add { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-task {
  display: block; font-size: 12px; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink); background: var(--sheet-2); text-decoration: none !important; font-weight: 500; box-shadow: inset 2px 0 0 var(--c, var(--cobalt));
}
.cal-task:hover { background: var(--hover); }
.cal-task.done { color: var(--mist); text-decoration: line-through !important; }
.cal-more { font-size: 12px; color: var(--graphite); padding-left: 6px; }

/* Task detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
.detail-title { font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; word-break: break-word; max-width: 30ch; }
.props { display: flex; flex-direction: column; gap: 16px; }
.prop { display: flex; flex-direction: column; gap: 6px; }
.prop > label, .prop > span { font-size: 13px; font-weight: 500; color: var(--graphite); }
.status-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.status-pills button { border: 1px solid var(--rule-strong); background: var(--sheet); border-radius: var(--r-field); padding: 7px 8px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--graphite); }
.status-pills button:hover { color: var(--ink); border-color: var(--graphite); }
.status-pills button.on { border-color: transparent; font-weight: 600; }
.status-pills button.on.st-todo { background: var(--ink); color: var(--sheet); }
.status-pills button.on.st-in_progress { background: var(--cobalt); color: #fff; }
.status-pills button.on.st-review { background: var(--amber); color: #fff; }
.status-pills button.on.st-done { background: var(--mint); color: #fff; }
.comments { display: flex; flex-direction: column; gap: 18px; }
.comment { display: flex; gap: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.comment-head strong { font-size: 14px; font-weight: 600; }
.comment-head time { color: var(--mist); }
.comment-text { margin-top: 2px; }
.files { display: flex; flex-direction: column; }
.file { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.file:last-child { border-bottom: 0; }
.file a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.file small { color: var(--mist); white-space: nowrap; }
.file-ext { width: 36px; height: 36px; border-radius: 8px; background: var(--sheet-2); border: 1px solid var(--rule); color: var(--graphite); font-size: 10px; font-weight: 700; display: grid; place-items: center; text-transform: uppercase; flex: none; }
.dropzone { border: 1.5px dashed var(--rule-strong); border-radius: var(--r-card); padding: 14px; color: var(--graphite); font-size: 14px; cursor: pointer; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--cobalt); color: var(--cobalt); background: var(--cobalt-soft); }
.dropzone:focus-within { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* ---------- Markdown ---------- */
.prose { line-height: 1.6; word-wrap: break-word; max-width: 72ch; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 21px; margin: 1.3em 0 .45em; }
.prose h3 { font-size: 17px; margin: 1.2em 0 .4em; }
.prose h4, .prose h5 { font-size: 15px; margin: 1em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 .8em; }
.prose li { margin: .2em 0; }
.prose li.md-check { list-style: none; margin-left: -1.3em; display: flex; gap: 9px; align-items: flex-start; }
.prose .md-box { width: 18px; height: 18px; border: 1.5px solid var(--rule-strong); border-radius: 5px; display: inline-grid; place-items: center; font-size: 11px; flex: none; margin-top: 3px; color: #fff; font-weight: 800; }
.prose li.md-check.done .md-box { background: var(--mint); border-color: var(--mint); }
.prose li.md-check.done { color: var(--mist); text-decoration: line-through; text-decoration-color: var(--rule-strong); }
.prose code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; background: var(--sheet-2); border: 1px solid var(--rule); padding: 1px 5px; border-radius: 5px; }
.prose pre { background: var(--sheet-2); border: 1px solid var(--rule); padding: 14px 16px; border-radius: var(--r-field); overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose blockquote { margin: 0 0 .8em; padding: 2px 0 2px 14px; border-left: 3px solid var(--signal); color: var(--graphite); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 1.5em 0; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
[data-checklist] li.md-check { cursor: pointer; user-select: none; }
[data-checklist] li.md-check:hover .md-box { border-color: var(--mint); }
.md-hint { font-size: 12.5px; color: var(--mist); margin-top: 4px; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 20px; }
.side-section { padding: 2px 0 6px; }
.side-section + .side-section { border-top: 1px solid var(--rule); padding-top: 18px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.side-head h3 { font-size: 15px; font-weight: 600; }
.progress { height: 5px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.quick-inline { display: flex; gap: 8px; margin: 6px 0 4px; }
.quick-inline .input { flex: 1; background: var(--sheet-2); border-color: transparent; }
.quick-inline .input:focus { background: var(--sheet); border-color: var(--cobalt); }
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none !important; }
.mini-item:last-child { border-bottom: 0; }
.mini-item:hover strong { color: var(--cobalt); }
.mini-item .grow { flex: 1; min-width: 0; }
.mini-item strong { display: block; font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-item small { color: var(--graphite); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }
.mini-item .emoji { width: 20px; text-align: center; flex: none; }

/* ---------- Notes ---------- */
.notes-grid { columns: 3 250px; column-gap: 12px; }
.note-card { break-inside: avoid; margin-bottom: 12px; padding: 16px 18px; display: block; color: var(--ink); text-decoration: none !important; position: relative; border-radius: var(--r-card); }
.note-card:hover { border-color: var(--rule-strong); }
.note-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; padding-right: 24px; }
.note-card .prose { font-size: 14px; color: var(--graphite); max-height: 220px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.note-card .note-date { font-size: 12.5px; color: var(--mist); margin-top: 8px; }
.note-card .pin { position: absolute; top: 15px; right: 15px; color: var(--signal); }
.note-yellow { background: #FFF6D8; border-color: #F2E3A6; }
.note-pink { background: #FFE9F0; border-color: #F6C9D8; }
.note-green { background: #E3F6EE; border-color: #BCE5D3; }
.note-blue { background: #E8ECFF; border-color: #C8D0FB; }
.note-purple { background: #F1EAFF; border-color: #DACBFA; }
@media (prefers-color-scheme: dark) {
  .note-yellow { background: #2B2713; border-color: #463F1C; }
  .note-pink { background: #31182A; border-color: #4E2740; }
  .note-green { background: #12271F; border-color: #1F4134; }
  .note-blue { background: #171D3A; border-color: #29335F; }
  .note-purple { background: #211A36; border-color: #372B5C; }
}
.color-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.color-pick label { cursor: pointer; position: relative; }
.color-pick input { position: absolute; opacity: 0; pointer-events: none; }
.color-pick .sw { width: 26px; height: 26px; border-radius: 50%; display: block; border: 1.5px solid var(--rule-strong); }
.color-pick input:checked + .sw { box-shadow: 0 0 0 2px var(--sheet), 0 0 0 4px var(--ink); }
.color-pick input:focus-visible + .sw { outline: 2px solid var(--cobalt); outline-offset: 3px; }
.editor-title { border: 0; background: transparent; font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -0.035em; width: 100%; outline: none; color: var(--ink); padding: 0; }
.editor-title::placeholder { color: var(--mist); }
.editor-body { border: 0; background: transparent; width: 100%; min-height: 380px; resize: vertical; outline: none; font: inherit; font-size: 16px; line-height: 1.65; color: var(--ink); padding: 0; }
.editor-body::placeholder { color: var(--mist); }
.editor-tabs { display: flex; gap: 4px; margin: 14px 0 10px; }
.editor-tabs button { border: 0; background: transparent; padding: 4px 11px; border-radius: var(--r-chip); font-size: 13px; font-weight: 500; color: var(--graphite); cursor: pointer; }
.editor-tabs button.on { background: var(--ink); color: var(--sheet); }
.save-state { font-size: 13px; color: var(--mist); }

/* ---------- Knowledge base ---------- */
.kb-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.kb-cats { display: flex; flex-direction: column; gap: 1px; position: sticky; top: 24px; }
.kb-cat { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-field); color: var(--graphite); font-weight: 500; text-decoration: none !important; }
.kb-cat:hover { background: var(--hover); color: var(--ink); }
.kb-cat.active { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.kb-cat .count { margin-left: auto; color: var(--mist); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kb-cat .emoji { width: 20px; text-align: center; }
.kb-list { display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-panel); padding: 4px 22px; }
.kb-item { padding: 16px 0; color: var(--ink); text-decoration: none !important; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--rule); }
.kb-item:last-child { border-bottom: 0; }
.kb-item.card { border-radius: 0; border-width: 0 0 1px; background: transparent; }
.kb-item.card:last-child { border-bottom: 0; }
.kb-item:hover h3 { color: var(--cobalt); }
.kb-item h3 { font-size: 16px; font-weight: 600; }
.kb-item p { color: var(--graphite); font-size: 14px; margin: 0; max-width: 72ch; }
.kb-item .meta { font-size: 12.5px; color: var(--mist); display: flex; gap: 12px; }
.article { max-width: 780px; }
.article-head { margin-bottom: 22px; }
.article-head h1 { font-family: var(--display); font-size: 32px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.12; }
.article-meta { color: var(--graphite); font-size: 13.5px; margin-top: 12px; display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; }
.article .prose { font-size: 16.5px; }
.crumbs { font-size: 13.5px; color: var(--graphite); margin-bottom: 14px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--graphite); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--graphite); padding: 12px 16px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .user-cell { display: flex; align-items: center; gap: 10px; }
.table .user-cell small { display: block; color: var(--graphite); font-size: 13px; }
.table tr.inactive td { opacity: .5; }
.copy-field { display: flex; gap: 6px; }
.copy-field .input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.project-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; border-radius: var(--r-card); }
.project-card h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.project-card h3 a { color: var(--ink); }
.project-card .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; }
.project-stats { display: flex; gap: 16px; font-size: 13.5px; color: var(--graphite); }
.project-stats b { color: var(--ink); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: none; max-height: none; }
dialog::backdrop { background: rgba(21, 19, 26, .38); }
.modal { width: min(560px, calc(100vw - 32px)); margin: auto; }
.modal-body { max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--sheet); border-radius: var(--r-panel); padding: 22px; box-shadow: var(--shadow-float); display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-size: 19px; font-weight: 600; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .modal[open] .modal-body { animation: pop .18s cubic-bezier(.2, .8, .3, 1); }
  .sheet[open] .sheet-body { animation: up .22s ease; }
  @keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
  @keyframes up { from { transform: translateY(100%); } to { transform: none; } }
}
.sheet { width: 100%; margin: auto 0 0; }
.sheet-body { background: var(--sheet); border-radius: 22px 22px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 6px 6px 14px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.sheet-head div { flex: 1; display: flex; flex-direction: column; }
.sheet-head small { color: var(--graphite); }
.sheet-link, .sheet-row { display: flex; align-items: center; gap: 14px; padding: 13px 10px; border-radius: 12px; color: var(--ink); font-size: 16px; font-weight: 500; text-decoration: none !important; border: 0; background: transparent; width: 100%; cursor: pointer; text-align: left; }
.sheet-row span { flex: 1; }
.sheet-link:hover { background: var(--hover); }
.sheet-link.danger { color: var(--signal); }
.sheet form { margin: 0; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; padding: 24px; }
.auth-top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.auth-top .brand { padding: 0; }
.auth-card { width: 100%; max-width: 420px; margin: auto; padding: 8px 0 40px; }
.auth-title { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1.05; letter-spacing: -0.045em; margin-bottom: 10px; }
.auth-sub { color: var(--graphite); margin-bottom: 28px; font-size: 16px; }
.auth-card .input { background: var(--sheet); }
.auth-foot { color: var(--mist); font-size: 13.5px; margin-top: 18px; }
.pass-wrap { position: relative; display: block; }
.pass-wrap .input { padding-right: 46px; }
.pass-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; gap: 28px; }
  .detail { grid-template-columns: 1fr; }
  .detail .props-card { order: -1; }
}
@media (max-width: 900px) {
  .app { padding-left: 0; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 15; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
    background: color-mix(in srgb, var(--lightbox) 86%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--rule);
  }
  .topbar .brand { padding: 0; font-size: 15px; }
  .topbar-title { flex: 1; font-size: 16px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .icon-btn { background: var(--ink); color: var(--sheet); width: 34px; height: 34px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 15;
    background: color-mix(in srgb, var(--sheet) 90%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom);
  }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; font-size: 11px; font-weight: 500; color: var(--mist); text-decoration: none !important; border: 0; background: transparent; cursor: pointer; }
  .tab.active { color: var(--ink); }
  .tab.active .ic { color: var(--signal); }
  .main { padding: 20px 16px 40px; }
  .page-title { font-size: 25px; }
  .day-hero { margin-bottom: 26px; }
  .day-hero h1 { margin-bottom: 18px; }
  .kb-layout { grid-template-columns: 1fr; gap: 14px; }
  .kb-cats { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .kb-cat { white-space: nowrap; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); }
  .kb-cat.active { background: var(--ink); color: var(--sheet); box-shadow: none; }
  .kb-cat .count { display: none; }
  .kb-list { padding: 2px 16px; }
  .board { grid-template-columns: repeat(4, 84vw); scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 12px; }
  .column { scroll-snap-align: center; }
  .kcard .advance { opacity: 1; }
  .cal-day { min-height: 70px; padding: 3px; }
  .cal-task { font-size: 0; padding: 0; height: 5px; border-radius: 3px; background: var(--c, var(--cobalt)); box-shadow: none; }
  .cal-task.done { opacity: .35; }
  .cal-more { font-size: 10px; padding: 0; }
  .cal-dow { padding: 6px 2px; font-size: 11px; text-align: center; }
  .cal-num { width: 22px; height: 22px; font-size: 12px; }
  .cal-day .cal-add { display: none; }
  .cal-head h2 { min-width: 0; flex: 1; font-size: 19px; }
  .page-head { margin-bottom: 18px; }
  .notes-grid { columns: 2 150px; column-gap: 10px; }
  .note-card { margin-bottom: 10px; padding: 14px; }
  .table th, .table td { padding: 10px; }
  .card-pad { padding: 18px; }
  .card-head { padding: 16px 18px 0; }
  .card-body { padding: 8px 18px 18px; }
  .hide-mobile { display: none !important; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .filters .input { min-width: 0; flex: 1 1 40%; }
  .filters > .tabs { width: 100%; overflow-x: auto; }
  .modal { width: 100vw; margin: auto 0 0; }
  .modal-body { border-radius: 22px 22px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .task-side .badge-project { display: none; }
  .auth-title { font-size: 30px; }
}
@media (min-width: 901px) { .show-mobile { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
