/* ===== Design tokens ===== */
:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --border: #e3e6ec;
  --border-strong: #cfd4dd;
  --text: #121826;
  --text-2: #4a5263;
  --text-3: #7d8597;
  --accent: #2f5bea;
  --accent-ink: #ffffff;
  --accent-soft: #e8eeff;
  --accent-text: #2449c6;
  --success: #12875a;
  --success-soft: #e3f5ec;
  --warning: #b86e00;
  --warning-soft: #fff3dc;
  --danger: #cf2e2e;
  --danger-soft: #fde8e8;
  --info-soft: #e6f2fb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 4px 14px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .22);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --top-h: 56px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1017; --surface: #151a23; --surface-2: #1a202b; --surface-3: #222a37;
    --border: #262e3c; --border-strong: #354055; --text: #eef1f6; --text-2: #b4bccb; --text-3: #8089a0;
    --accent: #5b82ff; --accent-ink: #fff; --accent-soft: #1d2a4d; --accent-text: #9db4ff;
    --success: #34c48b; --success-soft: #11301f; --warning: #f0a93b; --warning-soft: #33260e;
    --danger: #f06363; --danger-soft: #3a1717; --info-soft: #132636;
    --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.03); --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1017; --surface: #151a23; --surface-2: #1a202b; --surface-3: #222a37;
  --border: #262e3c; --border-strong: #354055; --text: #eef1f6; --text-2: #b4bccb; --text-3: #8089a0;
  --accent: #5b82ff; --accent-ink: #fff; --accent-soft: #1d2a4d; --accent-text: #9db4ff;
  --success: #34c48b; --success-soft: #11301f; --warning: #f0a93b; --warning-soft: #33260e;
  --danger: #f06363; --danger-soft: #3a1717; --info-soft: #132636;
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.03); --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hide { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 24px; height: 24px; }

/* ===== Shell ===== */
.app { min-height: 100%; display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--sat) + 8px) 16px 8px; min-height: calc(var(--top-h) + var(--sat));
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { font-size: 22px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 4px 16px calc(var(--nav-h) + var(--sab) + 88px); max-width: 1180px; width: 100%; margin: 0 auto; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(var(--sab) + 6px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  color: var(--text-3); font-size: 11px; font-weight: 600; border-radius: 10px; position: relative;
}
.bottomnav a.active { color: var(--accent-text); }
.bottomnav a .dot { position: absolute; top: 3px; left: calc(50% + 8px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + var(--sab) + 16px); z-index: 25;
  width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent); cursor: pointer;
}
.fab svg.i { width: 26px; height: 26px; stroke-width: 2.2; }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; width: 248px; flex: none; position: sticky; top: 0; height: 100vh;
    padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto;
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
  .brand img { width: 34px; height: 34px; border-radius: 9px; }
  .brand b { display: block; font-size: 15px; }
  .brand span { font-size: 12px; color: var(--text-3); }
  .sidebar nav a {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px;
    color: var(--text-2); font-weight: 550; font-size: 14px; margin-bottom: 1px;
  }
  .sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
  .sidebar nav a.active { background: var(--accent-soft); color: var(--accent-text); }
  .sidebar nav a .count { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 600; }
  .sidebar .navsec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 6px; }
  .sidebar .foot { margin-top: auto; padding: 10px; }
  .bottomnav, .fab { display: none; }
  .topbar { padding: 14px 28px; min-height: 68px; }
  .topbar h1 { font-size: 24px; }
  .content { padding: 4px 28px 60px; }
}

/* ===== Sync pill ===== */
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 5px 9px; border-radius: 999px; background: var(--surface-3); white-space: nowrap; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.sync.live i { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
.sync.busy i { background: var(--warning); animation: pulse 1s infinite; }
.sync.err i { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 10px; color: var(--text-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===== Cards & sections ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad { padding: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.card-h h3 { font-size: 15px; font-weight: 700; flex: 1; }
.card-h .link { font-size: 13px; font-weight: 600; }
.section { margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; flex: 1; }
.grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .grid.c2 { grid-template-columns: 1fr 1fr; } .grid.c3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid.c4 { grid-template-columns: repeat(4, 1fr); } .grid.dash { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.grid.c4 { grid-template-columns: 1fr 1fr; }

/* KPI */
.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* Hero */
.hero { padding: 18px; display: flex; gap: 18px; align-items: center; }
.hero h2 { font-size: 19px; }
.ring { width: 84px; height: 84px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 750; }
.phasebar { display: flex; gap: 3px; margin-top: 12px; }
.phasebar div { height: 8px; border-radius: 4px; flex: 1; background: var(--surface-3); overflow: hidden; }
.phasebar div span { display: block; height: 100%; }

/* ===== Lists ===== */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list > .row + .row, .list > * + .row { border-top: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; cursor: pointer; background: var(--surface); }
.row:hover { background: var(--surface-2); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 600; font-size: 14.5px; }
.row .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 3px; font-size: 12.5px; color: var(--text-3); align-items: center; }
.row .meta > span { display: inline-flex; align-items: center; gap: 4px; }
.row.done .title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.row .end { display: flex; align-items: center; gap: 6px; color: var(--text-3); flex: none; }
.list-h { padding: 10px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--surface-2); display: flex; align-items: center; gap: 8px; }

/* Checkbox */
.check {
  width: 26px; height: 26px; flex: none; border-radius: 8px; border: 2px solid var(--border-strong);
  display: grid; place-items: center; background: var(--surface); cursor: pointer; padding: 0; color: #fff;
  transition: background .15s, border-color .15s;
}
.check svg.i { width: 16px; height: 16px; stroke-width: 3; opacity: 0; }
.check.on { background: var(--success); border-color: var(--success); }
.check.on svg.i { opacity: 1; }
.check.doing { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 20px var(--accent-soft); }
.check.locked { border-style: dashed; color: var(--text-3); }
.check.locked svg.i { opacity: .8; stroke-width: 2; width: 13px; height: 13px; }
.check.round { border-radius: 50%; width: 22px; height: 22px; }
.check.round svg.i { width: 13px; height: 13px; }

/* Badges & chips */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.5; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.pdot { width: 9px; height: 9px; border-radius: 3px; flex: none; display: inline-block; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; cursor: pointer; flex: none; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { font-size: 11.5px; opacity: .7; }

/* Segmented */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.full { display: flex; } .seg.full button { flex: 1; }

/* Alerts */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; align-items: flex-start; border: 1px solid transparent; }
.alert + .alert { margin-top: 8px; }
.alert .i { margin-top: 1px; }
.alert b { display: block; font-size: 14px; }
.alert p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.alert.bad { background: var(--danger-soft); } .alert.bad > svg { color: var(--danger); }
.alert.warn { background: var(--warning-soft); } .alert.warn > svg { color: var(--warning); }
.alert.info { background: var(--info-soft); } .alert.info > svg { color: var(--accent-text); }
.alert.ok { background: var(--success-soft); } .alert.ok > svg { color: var(--success); }
.alert { cursor: default; }
.alert[data-href] { cursor: pointer; }

/* Forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 650; color: var(--text-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 16px; outline: none; appearance: none; -webkit-appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237d8597' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { position: relative; flex: 1; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input { padding-left: 36px; min-height: 40px; background: var(--surface); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

/* ===== Sheet (modal) ===== */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 22, .45); animation: fade .18s ease; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-height: calc(100% - var(--sat) - 10px); border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: up .24s cubic-bezier(.2,.9,.3,1);
}
.sheet-h { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: 18px 18px 0 0; }
.sheet-h h3 { flex: 1; font-size: 16px; font-weight: 700; min-width: 0; }
.sheet-b { overflow-y: auto; padding: 16px; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-f { padding: 12px 16px calc(12px + var(--sab)); border-top: 1px solid var(--border); background: var(--surface); display: flex; gap: 8px; }
.sheet-f .btn { flex: 1; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto; position: absolute; left: 0; right: 0; top: 5px; }
@media (min-width: 900px) {
  .scrim { align-items: stretch; justify-content: flex-end; }
  .sheet { width: 560px; max-height: none; height: 100%; border-radius: 0; animation: slide .24s cubic-bezier(.2,.9,.3,1); }
  .sheet.wide { width: 760px; }
  .sheet-h { border-radius: 0; padding: 14px 14px 14px 22px; }
  .sheet-b { padding: 22px; }
  .grabber { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }

/* Detail blocks */
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dl > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.dl label { display: block; font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.dl select, .dl input { border: 0; padding: 0; min-height: 26px; background: transparent; font-weight: 600; width: 100%; font-size: 15px; outline: none; -webkit-appearance: none; appearance: none; }
.why { background: var(--info-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--text); display: flex; gap: 10px; }
.why svg { color: var(--accent-text); margin-top: 2px; }
.subhead { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
.subhead span { flex: 1; }
.cklist .ckrow { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; }
.cklist .ckrow + .ckrow { border-top: 1px solid var(--border); }
.cklist .ckrow .txt { flex: 1; font-size: 14px; padding-top: 1px; }
.cklist .ckrow.on .txt { color: var(--text-3); text-decoration: line-through; }
.cklist .ckrow .x { opacity: 0; } .cklist .ckrow:hover .x { opacity: 1; }
@media (hover: none) { .cklist .ckrow .x { opacity: .6; } }
.addrow { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--border); }
.addrow input { flex: 1; border: 0; background: transparent; padding: 8px 6px; outline: none; font-size: 15px; }

/* Progress bars */
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.ok > span { background: var(--success); }
.bar.warn > span { background: var(--warning); }
.bar.bad > span { background: var(--danger); }

/* Tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.t { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
table.t th, table.t td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.grp td { background: var(--surface-2); font-weight: 700; font-size: 12px; color: var(--text-2); }
table.t tr.total td { font-weight: 750; background: var(--surface-2); }
table.t tr:last-child td { border-bottom: 0; }
table.t td.sticky, table.t th.sticky { position: sticky; left: 0; background: inherit; z-index: 1; }
table.t td.sticky { background: var(--surface); }
table.t tr.grp td.sticky, table.t tr.total td.sticky { background: var(--surface-2); }
table.t .best { color: var(--success); font-weight: 700; }
table.t .gap { color: var(--warning); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal .dow { background: var(--surface-2); text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 6px 0; text-transform: uppercase; }
.cal .day { background: var(--surface); min-height: 64px; padding: 4px; cursor: pointer; position: relative; }
.cal .day.out { background: var(--surface-2); color: var(--text-3); }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .day .dn { font-size: 12.5px; font-weight: 650; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .dn { background: var(--accent); color: #fff; }
.cal .day .dots { display: flex; gap: 3px; flex-wrap: wrap; padding: 2px; }
.cal .day .dots i { width: 6px; height: 6px; border-radius: 50%; }
.cal .day .ev { display: none; }
@media (min-width: 900px) {
  .cal .day { min-height: 108px; }
  .cal .day .dots { display: none; }
  .cal .day .ev { display: block; font-size: 11.5px; padding: 2px 6px; border-radius: 5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
}

/* Gantt */
.gantt { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.gantt-scroll { overflow: auto; -webkit-overflow-scrolling: touch; max-height: calc(100vh - 230px); }
.g-grid { position: relative; }
.g-head { position: sticky; top: 0; z-index: 3; display: flex; background: var(--surface-2); border-bottom: 1px solid var(--border); height: 40px; }
.g-labelcol { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--border); flex: none; }
.g-head .g-labelcol { background: var(--surface-2); z-index: 4; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--text-3); padding: 12px; letter-spacing: .05em; }
.g-row { display: flex; height: 34px; border-bottom: 1px solid var(--border); }
.g-row.phase { background: var(--surface-2); }
.g-row.phase .g-labelcol { background: var(--surface-2); font-weight: 700; font-size: 12.5px; }
.g-row .g-labelcol { padding: 0 10px; display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; overflow: hidden; white-space: nowrap; }
.g-track { position: relative; flex: none; }
.g-bar { position: absolute; top: 8px; height: 18px; border-radius: 5px; font-size: 10.5px; color: #fff; padding: 0 6px; line-height: 18px; white-space: nowrap; overflow: hidden; cursor: pointer; font-weight: 650; }
.g-bar.done { opacity: .45; }
.g-bar.crit { box-shadow: 0 0 0 2px var(--danger); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 1; opacity: .7; }
.g-week { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); }
.g-mlabel { position: absolute; top: 4px; font-size: 11px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.g-dlabel { position: absolute; top: 21px; font-size: 10.5px; color: var(--text-3); }

/* Docs */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 22px; text-align: center; background: var(--surface); cursor: pointer; transition: all .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone b { display: block; margin-top: 6px; }
.thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; flex: none; overflow: hidden; color: var(--text-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview { width: 100%; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
iframe.preview { height: 60vh; }

/* Contacts */
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; color: #fff; }
.quick { display: flex; gap: 4px; }
.quick a { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }

/* Toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + 10px); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 550; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: drop .25s ease; pointer-events: auto; }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }

/* Empty */
.empty { text-align: center; padding: 36px 16px; color: var(--text-3); }
.empty svg.i { width: 36px; height: 36px; margin-bottom: 8px; stroke-width: 1.5; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .card { width: min(420px, 100%); padding: 26px; }
.auth img { width: 64px; height: 64px; border-radius: 16px; display: block; margin-bottom: 14px; }
.auth h1 { font-size: 24px; margin-bottom: 4px; }

.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more-grid a { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 650; }
.more-grid a svg.i { color: var(--accent-text); width: 26px; height: 26px; }
.more-grid a span { font-size: 12.5px; font-weight: 500; color: var(--text-3); }

.divider { height: 1px; background: var(--border); margin: 16px 0; }
.spacer { flex: 1; }
.mt { margin-top: 14px; } .mt0 { margin-top: 0; } .mb { margin-bottom: 14px; }
.stack > * + * { margin-top: 10px; }
.flex { display: flex; align-items: center; gap: 8px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.money { font-variant-numeric: tabular-nums; font-weight: 650; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; }
.note-body { white-space: pre-wrap; font-size: 14.5px; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; }
