/* ============================================================
   Mosaic — design system
   Professional pastel palette · light + dark · CSS variables
   ============================================================ */

:root {
  /* surfaces */
  --bg: #F5F4F0;
  --surface: #FFFFFF;
  --surface-2: #FAF9F6;
  --surface-3: #F0EEE7;
  --border: #E6E3DA;
  --border-strong: #D6D2C6;

  /* text */
  --text: #383B47;
  --text-2: #6E7180;
  --text-3: #9A9DAB;

  /* accent (iris) */
  --accent: #6E77B8;
  --accent-strong: #5A64A8;
  --accent-soft: #E5E7F5;
  --accent-text: #4A5293;

  /* pastel family */
  --sage: #6F9472;        --sage-soft: #E2ECDF;
  --amber: #A1842F;       --amber-soft: #F4EBD2;
  --rose: #B5687A;        --rose-soft: #F6E1E6;
  --sky: #527FA8;         --sky-soft: #DEEAF4;
  --lilac: #8C7FB8;       --lilac-soft: #EAE5F6;

  --shadow-sm: 0 1px 2px rgba(30, 30, 45, 0.05);
  --shadow-md: 0 1px 3px rgba(30, 30, 45, 0.06), 0 6px 24px rgba(30, 30, 45, 0.07);
  --shadow-lg: 0 4px 12px rgba(30, 30, 45, 0.10), 0 16px 48px rgba(30, 30, 45, 0.14);

  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;

  --sidebar-w: 224px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #222127;
  --surface: #2B2A31;
  --surface-2: #312F38;
  --surface-3: #38363F;
  --border: #3D3B45;
  --border-strong: #4B4955;

  --text: #E8E6F0;
  --text-2: #A7A5B6;
  --text-3: #787685;

  --accent: #99A1DD;
  --accent-strong: #ACB3E8;
  --accent-soft: #3A3D55;
  --accent-text: #C2C7F0;

  --sage: #94BD97;        --sage-soft: #304034;
  --amber: #CDAE5E;       --amber-soft: #443C27;
  --rose: #D391A0;        --rose-soft: #463038;
  --sky: #88AED1;         --sky-soft: #2C3A49;
  --lilac: #B0A3D9;       --lilac-soft: #3B3450;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4), 0 20px 56px rgba(0, 0, 0, 0.45);
}

/* ---------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  transition: background-color .2s ease, color .2s ease;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 12px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.brand svg { flex: 0 0 auto; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.nav a svg { flex: 0 0 auto; opacity: .85; }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 8px; }

.sidebar-foot { display: flex; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-foot form { display: contents; }

.content { padding: 26px 32px 48px; min-width: 0; }

.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 21px; }
.topbar .sub { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 550; font-size: 13.5px; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
[data-theme="dark"] .btn-primary { color: #1d1c22; }
.btn-danger { color: var(--rose); border-color: var(--rose-soft); background: transparent; }
.btn-danger:hover { background: var(--rose-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-icon { padding: 7px; border-radius: var(--r-sm); line-height: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------- forms */
.input, .select, .textarea {
  width: 100%; padding: 7px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 72px; }
.select { appearance: none; padding-right: 28px;
  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='%23888da0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span2 { grid-column: span 2; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--text-2); user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: var(--r-sm); gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------- cards & chips */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 0; }
.card-head h2 { font-size: 14.5px; }
.card-body { padding: 14px 18px 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.chip-rose  { background: var(--rose-soft);  color: var(--rose); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-sage  { background: var(--sage-soft);  color: var(--sage); }
.chip-sky   { background: var(--sky-soft);   color: var(--sky); }
.chip-lilac { background: var(--lilac-soft); color: var(--lilac); }
.chip-accent{ background: var(--accent-soft);color: var(--accent-text); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot-high { background: var(--rose); }
.dot-medium { background: var(--amber); }
.dot-low { background: var(--sage); }

.empty { padding: 36px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.empty strong { display: block; color: var(--text-2); font-size: 14.5px; margin-bottom: 4px; }

/* ---------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(28, 27, 38, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 20px 20px; overflow-y: auto;
  animation: fadeIn .15s ease;
}
.modal {
  width: 100%; max-width: 520px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: popIn .18s cubic-bezier(.2,.9,.3,1.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 2px 20px 18px; }
.modal-foot .left { margin-right: auto; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------------------------------------------------------- toast */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 16px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg);
  font-size: 13px; font-weight: 550; box-shadow: var(--shadow-md);
  animation: toastIn .2s ease;
}
.toast.err { background: var(--rose); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------- tasks page */
.tasks-wrap { max-width: 880px; }
.task-add {
  display: flex; gap: 9px; padding: 9px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); flex-wrap: wrap;
}
.task-add .input { flex: 1 1 220px; border-color: transparent; background: transparent; font-size: 14px; }
.task-add .input:focus { box-shadow: none; }
.task-add .select, .task-add input[type="date"] { width: auto; }

.task-filters { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.task-filters .input { width: 200px; }

.task-group { margin-bottom: 6px; }
.task-group-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 4px 7px;
}
.task-group-head .count { color: var(--text-3); font-weight: 600; }
.task-group-head.overdue { color: var(--rose); }
.task-list { display: flex; flex-direction: column; gap: 7px; }

.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  transition: border-color .15s ease, box-shadow .15s ease, opacity .2s ease;
  cursor: pointer;
}
.task-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.task-row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.task-row .meta { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.task-row.done { opacity: .62; }
.task-row.done .title { text-decoration: line-through; color: var(--text-2); }
.task-row .row-del { opacity: 0; transition: opacity .15s ease; }
.task-row:hover .row-del { opacity: 1; }

.tcheck {
  width: 19px; height: 19px; border-radius: 6px; flex: 0 0 auto;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .15s ease, border-color .15s ease;
  padding: 0;
}
.tcheck:hover { border-color: var(--sage); }
.tcheck svg { opacity: 0; transition: opacity .12s ease; }
.tcheck.on { background: var(--sage); border-color: var(--sage); }
.tcheck.on svg { opacity: 1; }

.due-chip.overdue { background: var(--rose-soft); color: var(--rose); }
.due-chip.today { background: var(--amber-soft); color: var(--amber); }

/* ---------------------------------------------------------- kanban */
.kb-grid { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 18px; align-items: start; }
.kb-col {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 12px; min-height: 300px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s ease, background-color .15s ease;
}
.kb-col.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.kb-col-head .name { font-size: 13px; font-weight: 700; }
.kb-col-head .count { font-size: 11.5px; font-weight: 650; color: var(--text-2); background: var(--surface-3); border-radius: 99px; padding: 1px 8px; }
.kb-col-head .bar { width: 22px; height: 5px; border-radius: 3px; margin-right: 2px; }
.kb-cards { display: flex; flex-direction: column; gap: 9px; min-height: 40px; flex: 1; }

.kb-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 11px 13px; cursor: grab; box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.kb-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.kb-card:active { cursor: grabbing; }
.kb-card.dragging { opacity: .45; }
.kb-card .t { font-weight: 550; margin-bottom: 7px; line-height: 1.35; }
.kb-card .meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.kb-card.is-done .t { color: var(--text-2); text-decoration: line-through; }
.kb-add { width: 100%; justify-content: flex-start; color: var(--text-3); }
.kb-drop-hint { height: 3px; border-radius: 2px; background: var(--accent); margin: -6px 2px; opacity: 0; transition: opacity .1s ease; }
.kb-drop-hint.show { opacity: 1; }

/* ---------------------------------------------------------- calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title { font-size: 17px; font-weight: 700; min-width: 170px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }

.cal-month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-dow div { padding: 8px 10px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); text-align: right; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 104px; padding: 7px 7px 9px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0;
  transition: background-color .15s ease;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell .dnum { font-size: 12px; font-weight: 650; color: var(--text-2); align-self: flex-end; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-cell.dim .dnum { color: var(--text-3); opacity: .6; }
.cal-cell.today-cell .dnum { background: var(--accent); color: #fff; }
[data-theme="dark"] .cal-cell.today-cell .dnum { color: #1d1c22; }
.cal-cell.weekend { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.cal-cell.weekend:hover { background: var(--surface-2); }

.cal-chip {
  font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--sky-soft); color: var(--sky); cursor: pointer;
  border-left: 3px solid var(--sky);
  transition: filter .15s ease;
}
.cal-chip:hover { filter: brightness(.96); }
[data-theme="dark"] .cal-chip:hover { filter: brightness(1.15); }
.cal-chip.task-chip { background: var(--surface-3); color: var(--text-2); border-left-color: var(--text-3); }
.cal-chip.task-chip.p-high { background: var(--rose-soft); color: var(--rose); border-left-color: var(--rose); }
.cal-chip.task-chip.p-medium { background: var(--amber-soft); color: var(--amber); border-left-color: var(--amber); }
.cal-chip.task-chip.p-low { background: var(--sage-soft); color: var(--sage); border-left-color: var(--sage); }
.cal-chip.task-chip.tdone { opacity: .55; text-decoration: line-through; }
.cal-more { font-size: 11px; font-weight: 650; color: var(--text-3); padding: 0 7px; cursor: pointer; }
.cal-more:hover { color: var(--accent-text); }

/* week view */
.cal-week { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.wk-allday { display: grid; grid-template-columns: 52px repeat(7, 1fr); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.wk-allday .gut { font-size: 10.5px; color: var(--text-3); padding: 6px; text-align: right; }
.wk-allday .day-head { padding: 7px 8px; border-left: 1px solid var(--border); min-width: 0; }
.wk-allday .day-head .dh-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.wk-allday .day-head .dh-num { font-size: 16px; font-weight: 700; color: var(--text-2); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; margin-top: 2px; }
.wk-allday .day-head.today-cell .dh-num { background: var(--accent); color: #fff; }
[data-theme="dark"] .wk-allday .day-head.today-cell .dh-num { color: #1d1c22; }
.wk-allday .chips { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; }
.wk-scroll { max-height: 600px; overflow-y: auto; }
.wk-grid { display: grid; grid-template-columns: 52px repeat(7, 1fr); position: relative; }
.wk-hours { display: flex; flex-direction: column; }
.wk-hours div { height: 48px; font-size: 10.5px; color: var(--text-3); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.wk-daycol { position: relative; border-left: 1px solid var(--border); background:
  repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px 48px); }
.wk-event {
  position: absolute; left: 3px; right: 4px; z-index: 2;
  border-radius: 6px; padding: 3px 7px; overflow: hidden;
  background: var(--sky-soft); color: var(--sky); border-left: 3px solid var(--sky);
  font-size: 11.5px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: filter .15s ease;
}
.wk-event:hover { filter: brightness(.96); z-index: 3; }
[data-theme="dark"] .wk-event:hover { filter: brightness(1.15); }
.wk-event .when { font-weight: 500; opacity: .8; font-size: 10.5px; }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--rose); z-index: 4; pointer-events: none; }
.wk-now::before { content: ""; position: absolute; left: -2px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); }

/* ---------------------------------------------------------- notes */
.notes-layout {
  display: grid; grid-template-columns: 200px 290px 1fr;
  gap: 0; height: calc(100vh - 130px); min-height: 440px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.np-folders { border-right: 1px solid var(--border); background: var(--surface-2); padding: 14px 10px; overflow-y: auto; }
.np-folders .sec { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); padding: 10px 8px 6px; }
.folder-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 550; font-size: 13px; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.folder-item:hover { background: var(--surface-3); color: var(--text); }
.folder-item.active { background: var(--accent-soft); color: var(--accent-text); }
.folder-item .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-item .c { font-size: 11px; color: var(--text-3); }
.folder-item .f-del { opacity: 0; line-height: 0; color: var(--text-3); }
.folder-item:hover .f-del { opacity: 1; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 8px; }
.tag-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); cursor: pointer; border: 1px solid transparent; transition: all .15s ease; }
.tag-pill:hover { color: var(--text); border-color: var(--border-strong); }
.tag-pill.active { background: var(--lilac-soft); color: var(--lilac); border-color: var(--lilac); }

.np-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.np-list-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; }
.np-scroll { overflow-y: auto; flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.note-item {
  padding: 10px 12px; border-radius: var(--r-md); cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s ease, border-color .15s ease;
}
.note-item:hover { background: var(--surface-2); }
.note-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.note-item .nt { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.note-item .nt .pin { color: var(--amber); line-height: 0; flex: 0 0 auto; }
.note-item .ns { font-size: 12px; color: var(--text-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-item .nm { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.note-item .nd { font-size: 11px; color: var(--text-3); }

.np-editor { display: flex; flex-direction: column; min-width: 0; }
.ed-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ed-title { border: 0; background: transparent; font-size: 19px; font-weight: 700; color: var(--text); flex: 1 1 200px; min-width: 0; padding: 4px 0; letter-spacing: -0.01em; }
.ed-title:focus { outline: none; }
.ed-title::placeholder { color: var(--text-3); }
.ed-status { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.ed-toolbar { display: flex; align-items: center; gap: 2px; padding: 7px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.ed-btn {
  border: 0; background: transparent; border-radius: 6px; padding: 5px 8px; min-width: 30px;
  color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 650; line-height: 1.2;
  transition: background-color .12s ease, color .12s ease;
}
.ed-btn:hover { background: var(--surface-3); color: var(--text); }
.ed-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 6px; }
.ed-meta { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.ed-meta .select { width: auto; font-size: 12px; padding: 4px 26px 4px 9px; }

.ed-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.prose { outline: none; max-width: 720px; font-size: 14.5px; line-height: 1.65; min-height: 220px; }
.prose h1 { font-size: 22px; margin: 18px 0 8px; }
.prose h2 { font-size: 17px; margin: 16px 0 6px; }
.prose h3 { font-size: 15px; margin: 14px 0 5px; }
.prose p, .prose div { margin: 0 0 8px; }
.prose ul, .prose ol { margin: 0 0 10px; padding-left: 24px; }
.prose li { margin-bottom: 3px; }
.prose blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--text-2); }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; }
.prose code { font-family: var(--mono); font-size: .92em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }
.prose .hl { background: var(--amber-soft); border-radius: 3px; padding: 0 2px; }
.prose a { text-decoration: underline; }
.prose:empty::before, .prose.is-empty::before { content: attr(data-placeholder); color: var(--text-3); pointer-events: none; }

.ed-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 9px 16px; border-top: 1px solid var(--border); }
.ed-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; background: var(--lilac-soft); color: var(--lilac); border-radius: 99px; padding: 2px 9px; }
.ed-tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; line-height: 0; opacity: .7; }
.ed-tag button:hover { opacity: 1; }
.ed-tag-input { border: 0; background: transparent; color: var(--text); font-size: 12px; min-width: 90px; padding: 3px; }
.ed-tag-input:focus { outline: none; }

.np-back { display: none; }

/* ---------------------------------------------------------- focus / pomodoro */
.focus-grid { display: grid; grid-template-columns: minmax(320px, 430px) 1fr; gap: 22px; align-items: start; }
.timer-card { padding: 28px 24px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.timer-modes { display: flex; gap: 6px; }
.ring-wrap { position: relative; width: 240px; height: 240px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-track { stroke: var(--surface-3); }
.ring-bar { stroke: var(--accent); transition: stroke-dashoffset .4s linear, stroke .3s ease; stroke-linecap: round; }
.ring-bar.mode-short, .ring-bar.mode-long { stroke: var(--sage); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring-time { font-size: 46px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.cycle-dots { display: flex; gap: 7px; }
.cycle-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background-color .2s ease; }
.cycle-dots span.done { background: var(--accent); border-color: var(--accent); }
.timer-controls { display: flex; gap: 10px; }
.timer-controls .btn-primary { min-width: 120px; }
.timer-task { width: 100%; max-width: 320px; }
.focus-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; }
.stat .v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stat .k { font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.hist-day { margin-bottom: 14px; }
.hist-day .hd { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; display: flex; justify-content: space-between; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); font-size: 12.5px; }
.hist-row:hover { background: var(--surface-2); }
.hist-row .hk { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.hist-row .hk.focus { background: var(--accent); }
.hist-row .hk.short, .hist-row .hk.long { background: var(--sage); }
.hist-row .ht { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row .hm { color: var(--text-3); font-variant-numeric: tabular-nums; }
.task-time-list .hist-row .ht { color: var(--text); font-weight: 500; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------------------------------------------------- break game */
.game-wrap { display: grid; grid-template-columns: minmax(300px, 560px) 260px; gap: 24px; justify-content: center; align-items: start; }
.game-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.game-hud .nums { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.mem-grid { display: grid; gap: 10px; }
.mem-grid.c4 { grid-template-columns: repeat(4, 1fr); }
.mem-grid.c6 { grid-template-columns: repeat(6, 1fr); }
.mem-card { aspect-ratio: 1; perspective: 600px; cursor: pointer; border: 0; background: none; padding: 0; }
.mem-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .35s cubic-bezier(.4,.1,.2,1.1); }
.mem-card.flipped .mem-inner, .mem-card.matched .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.mem-back { background: var(--surface); box-shadow: var(--shadow-sm); transition: box-shadow .15s ease; }
.mem-card:hover:not(.matched) .mem-back { box-shadow: var(--shadow-md); }
.mem-back::after { content: ""; width: 34%; height: 34%; border-radius: 30%; background: var(--surface-3); }
.mem-front { transform: rotateY(180deg); }
.mem-front svg { width: 46%; height: 46%; }
.mem-card.matched { cursor: default; }
.mem-card.matched .mem-front { opacity: .55; }
.mem-card.shake .mem-inner { animation: shake .3s ease; }
@keyframes shake { 25% { transform: rotateY(180deg) translateX(-4px); } 75% { transform: rotateY(180deg) translateX(4px); } }
.best-row { display: flex; justify-content: space-between; padding: 7px 4px; font-size: 13px; border-bottom: 1px solid var(--border); }
.best-row:last-child { border-bottom: 0; }
.best-row .b { color: var(--text-2); }
.win-stats { display: flex; gap: 18px; justify-content: center; font-size: 15px; font-weight: 650; margin: 8px 0 4px; }
.win-note { text-align: center; color: var(--text-2); font-size: 13px; }

/* ---------------------------------------------------------- today dashboard */
.dash-greet { margin-bottom: 22px; }
.dash-greet h1 { font-size: 24px; }
.dash-greet .sub { color: var(--text-2); margin-top: 4px; font-size: 13.5px; }
.dash-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-list { display: flex; flex-direction: column; gap: 4px; }
.dash-ev { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); font-size: 13.5px; }
.dash-ev:hover { background: var(--surface-2); }
.dash-ev .when { font-variant-numeric: tabular-nums; color: var(--text-3); font-size: 12px; min-width: 88px; }
.dash-ev .ti { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-day-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 10px 10px 3px; }
.dash-note { display: block; padding: 9px 11px; border-radius: var(--r-sm); }
.dash-note:hover { background: var(--surface-2); text-decoration: none; }
.dash-note .ti { font-weight: 600; font-size: 13.5px; color: var(--text); display: flex; gap: 6px; align-items: center; }
.dash-note .sn { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.dash-focus { display: flex; align-items: center; gap: 18px; }
.dash-focus .big { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.dash-focus .lbl { font-size: 12px; color: var(--text-3); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.see-all { font-size: 12.5px; font-weight: 600; }

/* ---------------------------------------------------------- login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 360px; padding: 34px 32px 30px; display: flex; flex-direction: column; gap: 18px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand .brand-name { font-size: 22px; }
.login-brand .tag { color: var(--text-2); font-size: 13px; }
.login-err { background: var(--rose-soft); color: var(--rose); border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; font-weight: 550; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .focus-grid { grid-template-columns: 1fr; }
  .game-wrap { grid-template-columns: minmax(280px, 520px); }
  .dash-grid { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 170px 250px 1fr; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 50; height: auto;
    flex-direction: row; align-items: center; gap: 4px;
    padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .brand { padding: 0 8px 0 0; }
  .brand-name { display: none; }
  .nav { flex-direction: row; flex: 1; gap: 1px; }
  .nav a { padding: 7px 9px; }
  .nav a span { display: none; }
  .nav-sep { display: none; }
  .sidebar-foot { border-top: 0; padding-top: 0; }
  .content { padding: 18px 14px 40px; }
  .kb-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-chip { display: none; }
  .cal-cell .dots-mobile { display: flex; gap: 3px; flex-wrap: wrap; }
  .focus-stats { grid-template-columns: 1fr 1fr 1fr; }
  .game-wrap { grid-template-columns: 1fr; }

  /* notes: switch to two stacked panes with back navigation */
  .notes-layout { grid-template-columns: 1fr; height: calc(100vh - 120px); }
  .np-folders { display: none; }
  .np-list { border-right: 0; }
  .notes-layout.show-editor .np-list { display: none; }
  .notes-layout:not(.show-editor) .np-editor { display: none; }
  .np-back { display: inline-flex; }
}

@media (min-width: 861px) {
  .cal-cell .dots-mobile { display: none; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
