:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e3e6ee;
  --text: #1c2033;
  --muted: #6b7189;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --accent-soft: #eceeff;
  --danger: #dc3c42;
  --danger-soft: #fdecec;
  --warn: #c27803;
  --warn-soft: #fff4dd;
  --ok: #15803d;
  --ok-soft: #e4f6ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 12px;
  --sidebar: 232px;
  --topbar: 60px;
  --bottomnav: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --surface: #171a23; --surface-2: #1f2330; --border: #2a2f3d;
    --text: #e7e9f0; --muted: #9097ad; --accent: #7c74ff; --accent-soft: #24234a;
    --danger: #ff6b70; --danger-soft: #3a1b1e; --warn: #f5b74a; --warn-soft: #3a2c12;
    --ok: #4ade80; --ok-soft: #133022; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --surface: #171a23; --surface-2: #1f2330; --border: #2a2f3d;
  --text: #e7e9f0; --muted: #9097ad; --accent: #7c74ff; --accent-soft: #24234a;
  --danger: #ff6b70; --danger-soft: #3a1b1e; --warn: #f5b74a; --warn-soft: #3a2c12;
  --ok: #4ade80; --ok-soft: #133022; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 4px 8px 18px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; background: var(--surface-2); color: var(--muted); padding: 1px 7px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--topbar) + var(--safe-t)); padding: var(--safe-t) 20px 0;
  display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topsearch { position: relative; width: min(320px, 34vw); }
.topsearch input { width: 100%; padding: 8px 12px 8px 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.topsearch svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
#main { padding: 20px; flex: 1; min-width: 0; }
.page { max-width: 1200px; margin: 0 auto; }
.page.narrow { max-width: 860px; }

.bottomnav { display: none; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted);
  padding: 5px 10px; border-radius: 99px; background: var(--surface-2); border: none; cursor: pointer; white-space: nowrap;
}
.sync-pill.ok { color: var(--ok); background: var(--ok-soft); }
.sync-pill.off { color: var(--warn); background: var(--warn-soft); }
.sync-pill.err { color: var(--danger); background: var(--danger-soft); }
.sync-pill.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap;
  min-height: 38px; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { padding: 0; width: 38px; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13.5px; }
.btn.icon.sm { width: 32px; padding: 0; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.input, .field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); min-height: 40px;
}
.field textarea, textarea.input { resize: vertical; min-height: 90px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .topsearch input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { cursor: pointer; }
.swatches input { display: none; }
.swatches span { display: block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); }
.swatches input:checked + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * > .card:first-child { margin-top: 0; }
.nav .count:empty { display: none; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sec-head h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 160px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty svg { width: 36px; height: 36px; opacity: .5; margin-bottom: 6px; }

.stat { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat b { font-size: 24px; display: block; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 99px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.yellow { background: var(--warn-soft); color: var(--warn); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.tag { font-size: 12px; color: var(--accent); background: var(--accent-soft); padding: 1px 8px; border-radius: 6px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { display: flex; align-items: center; gap: 6px; flex: none; }
.group-letter { font-size: 12px; font-weight: 700; color: var(--muted); padding: 12px 6px 4px; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 15px;
  background: var(--accent-soft); color: var(--accent); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 96px; height: 96px; font-size: 34px; }
.avatar.sq { border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.avatar.sq img { object-fit: contain; background: #fff; }
.avatar.sq.xs { border-radius: 5px; }
.avatar.sq.lg { border-radius: 20px; }

/* empresa no contato */
.co-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 5px 10px 5px 6px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none;
}
.co-chip:hover { border-color: var(--accent); color: var(--accent); }
.co-chip svg { opacity: .6; }

/* autocompletar */
.ac { position: relative; }
.ac-box { position: relative; }
.ac-box input { padding-left: 38px; width: 100%; }
.ac-logo { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 4px;
}
.ac-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.ac-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-item.on, .ac-item:hover { background: var(--accent-soft); }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: calc(100vh - 190px); scroll-snap-type: x proximity; }
.col {
  flex: 0 0 290px; background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column;
  max-height: calc(100vh - 170px); scroll-snap-align: start;
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 700; }
.col-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.col-head .n { color: var(--muted); font-weight: 500; font-size: 13px; }
.col-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 40px; flex: 1; padding: 2px; }
.kcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; border-left: 4px solid transparent;
}
.kcard:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.kcard .t { font-weight: 600; margin-bottom: 6px; word-break: break-word; }
.kcard .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.kcard .meta span { display: inline-flex; align-items: center; gap: 3px; }
.kcard.p-alta { border-left-color: var(--warn); }
.kcard.p-urgente { border-left-color: var(--danger); }
.kcard.p-baixa { border-left-color: var(--ok); }
.kcard.dragging-src { opacity: .35; }
.kghost { position: fixed; z-index: 1000; pointer-events: none; transform: rotate(2.5deg); box-shadow: var(--shadow-lg); opacity: .95; }
.kplaceholder { border: 2px dashed var(--accent); border-radius: 10px; background: var(--accent-soft); flex: none; }
.col-add { margin-top: 8px; justify-content: flex-start; color: var(--muted); }
body.dragging { cursor: grabbing; user-select: none; }

/* ---------- Notes ---------- */
.notes-grid { columns: 4 240px; column-gap: 14px; }
.note-card {
  display: block; color: var(--text); break-inside: avoid; -webkit-column-break-inside: avoid; margin-bottom: 14px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; box-shadow: var(--shadow); position: relative;
}
.note-card h4 { font-size: 15px; margin-bottom: 6px; padding-right: 20px; }
.note-card .body { white-space: pre-wrap; word-break: break-word; font-size: 14px; max-height: 220px; overflow: hidden; color: var(--text); opacity: .9; }
.note-card .pin { position: absolute; top: 12px; right: 12px; color: var(--accent); }
.note-card .foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.note-editor .title-in { font-size: 22px; font-weight: 700; border: none; background: transparent; width: 100%; padding: 4px 0; outline: none; }
.note-editor .body-in { border: none; background: transparent; width: 100%; min-height: 300px; resize: none; outline: none; font-size: 15.5px; line-height: 1.6; padding: 4px 0; }
.nc-yellow { background: #fff8d6 !important; } .nc-green { background: #e5f7e9 !important; } .nc-blue { background: #e4efff !important; }
.nc-pink { background: #ffe6f0 !important; } .nc-purple { background: #efe7ff !important; } .nc-orange { background: #ffeedd !important; }
:root[data-theme="dark"] .nc-yellow { background: #3a3415 !important; } :root[data-theme="dark"] .nc-green { background: #17331f !important; }
:root[data-theme="dark"] .nc-blue { background: #15274a !important; } :root[data-theme="dark"] .nc-pink { background: #3d1a2b !important; }
:root[data-theme="dark"] .nc-purple { background: #2a1d4a !important; } :root[data-theme="dark"] .nc-orange { background: #3d2814 !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nc-yellow { background: #3a3415 !important; } :root:not([data-theme="light"]) .nc-green { background: #17331f !important; }
  :root:not([data-theme="light"]) .nc-blue { background: #15274a !important; } :root:not([data-theme="light"]) .nc-pink { background: #3d1a2b !important; }
  :root:not([data-theme="light"]) .nc-purple { background: #2a1d4a !important; } :root:not([data-theme="light"]) .nc-orange { background: #3d2814 !important; }
}

/* ---------- Detail ---------- */
.detail-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-head h2 { font-size: 22px; flex: 1; min-width: 200px; word-break: break-word; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.desc { white-space: pre-wrap; word-break: break-word; }
.checklist { display: flex; flex-direction: column; gap: 4px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; }
.check-item:hover { background: var(--surface-2); }
.check-item span { flex: 1; word-break: break-word; }
.check-item.done span { text-decoration: line-through; color: var(--muted); }
.progress { height: 6px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); }

.comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment .when { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.comment .txt { white-space: pre-wrap; word-break: break-word; }
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.comment-form textarea { min-height: 70px; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.file-tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); position: relative; }
.file-tile .thumb { aspect-ratio: 4/3; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.file-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-tile .thumb svg { width: 34px; height: 34px; }
.file-tile .ext { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; background: var(--surface); padding: 1px 6px; border-radius: 5px; text-transform: uppercase; }
.file-tile .nm { padding: 7px 9px 1px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-tile .sz { padding: 0 9px 8px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-tile .pend { position: absolute; top: 8px; right: 8px; }
.dropzone.over { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 10px; }

/* ---------- Calendar ---------- */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h3 { flex: 1; font-size: 18px; }
.cal-head h3::first-letter { text-transform: uppercase; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal .dow { background: var(--surface-2); text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 7px 0; text-transform: uppercase; }
.cal .day { background: var(--surface); min-height: 96px; padding: 5px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal .day:hover { background: var(--surface-2); }
.cal .day.other { opacity: .45; }
.cal .day .num { font-size: 13px; font-weight: 600; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .num { background: var(--accent); color: var(--accent-text); }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .ev { font-size: 11.5px; padding: 1px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--accent-soft); color: var(--accent); }
.cal .ev.task { background: var(--surface-2); color: var(--muted); }
.cal .dots { display: none; gap: 3px; justify-content: center; flex-wrap: wrap; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cal .dots i.task { background: var(--muted); }
.agenda-item { display: flex; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px; }
.agenda-item:hover { background: var(--surface-2); }
.agenda-item:last-child { border-bottom: none; }
.agenda-item .bar { width: 4px; border-radius: 4px; background: var(--accent); flex: none; }
.agenda-item .time { font-size: 12.5px; color: var(--muted); }

/* ---------- Modal / Toast ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 20, .5); z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade .15s ease;
}
.modal {
  background: var(--surface); border-radius: 16px; width: min(620px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { flex: 1; font-size: 17px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px calc(14px + var(--safe-b)); border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.viewer { display: grid; place-items: center; background: var(--surface-2); border-radius: 10px; min-height: 200px; overflow: hidden; }
.viewer img, .viewer video { max-width: 100%; max-height: 70vh; display: block; }
.viewer iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.viewer pre { width: 100%; max-height: 70vh; overflow: auto; margin: 0; padding: 14px; font-size: 13px; white-space: pre-wrap; }
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-list button { display: flex; align-items: center; gap: 12px; padding: 12px; border: none; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 500; }
.menu-list button:hover { background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1c2033; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; animation: up .2s ease; max-width: 90vw; }
.toast.err { background: var(--danger); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 28px; }
.login h2 { margin: 14px 0 4px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.login .err { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .topbar { padding-left: 14px; padding-right: 14px; gap: 8px; }
  .topsearch { display: none; }
  .topbar h1 { font-size: 18px; }
  #main { padding: 14px 14px calc(var(--bottomnav) + var(--safe-b) + 18px); }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--bottomnav) + var(--safe-b));
    padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--border);
  }
  .bottomnav a, .bottomnav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px;
    color: var(--muted); background: none; border: none; cursor: pointer; font-weight: 500;
  }
  .bottomnav a.active { color: var(--accent); }
  .bottomnav svg.i { width: 22px; height: 22px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { font-size: 12.5px; margin-top: 8px; }
  .board { min-height: calc(100vh - 220px); scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 12px; scroll-padding: 0 14px; }
  .col { flex-basis: 84vw; max-height: calc(100vh - 230px); }
  .notes-grid { columns: 2 150px; column-gap: 10px; }
  .note-card { margin-bottom: 10px; }
  .cal .day { min-height: 54px; align-items: center; }
  .cal .ev { display: none; }
  .cal .dots { display: flex; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; animation: up .2s ease; }
  .modal.wide { width: 100%; }
  .stat .ico { width: 38px; height: 38px; }
  .stat b { font-size: 20px; }
  .card { padding: 14px; }
  .hide-mobile { display: none !important; }
  #toast-root { bottom: calc(var(--bottomnav) + var(--safe-b) + 12px); }
}
@media (min-width: 821px) { .show-mobile { display: none !important; } }
