/* Renovation OS — design system. Light, one accent, system fonts, no external assets. */

:root {
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f5f8;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f2f6;
  --surface-3: #e7e9ef;
  --border: #e3e5eb;
  --border-strong: #d0d4dd;
  --text: #15181e;
  --text-2: #4d5463;
  --text-3: #80869a;
  --accent: #4f5fd9;
  --accent-strong: #3c4bc4;
  --accent-ink: #ffffff;
  --accent-soft: rgba(79, 95, 217, 0.10);
  --success: #1f9a63;
  --success-soft: rgba(31, 154, 99, 0.12);
  --warning: #b97d12;
  --warning-soft: rgba(214, 150, 30, 0.14);
  --danger: #d2433d;
  --danger-soft: rgba(210, 67, 61, 0.10);
  --info: #1f7fbf;
  --info-soft: rgba(31, 127, 191, 0.10);

  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 18px;
  --shadow: 0 1px 2px rgba(16,24,40,0.05), 0 6px 18px rgba(16,24,40,0.06);
  --shadow-l: 0 24px 60px rgba(16,24,40,0.18);
  --ease: cubic-bezier(.2,.7,.2,1);
  --dur: 180ms;

  --sidebar: 236px;
  --topbar: 56px;
  --bottombar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 620; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.76rem; }
.mono { font-family: var(--mono); font-size: 0.86em; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 20px; }
.right { margin-left: auto; }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.boot-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent); animation: pulse 1.2s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.6; } }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px; border-right: 1px solid var(--border); background: var(--bg-elev);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 650; letter-spacing: -0.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-mark svg { width: 17px; height: 17px; }
.nav-section { margin: 14px 10px 6px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-s);
  color: var(--text-2); font-weight: 500; transition: background var(--dur), color var(--dur);
}
.nav-link svg { width: 19px; height: 19px; flex: none; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav-link[aria-current="page"] svg { color: var(--accent); }
.nav-link .count { margin-left: auto; font-size: 0.75rem; color: var(--text-3); }
.sidebar-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .crumbs { font-weight: 600; min-width: 0; }
.search-trigger {
  margin-left: auto; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; min-width: 240px;
  border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface); color: var(--text-3); cursor: pointer;
}
.search-trigger svg { width: 16px; height: 16px; }
.search-trigger kbd { margin-left: auto; font-family: var(--font); font-size: 0.72rem; border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; }
.content { padding: 24px; width: 100%; max-width: 1360px; margin: 0 auto; flex: 1; min-width: 0; }
.content.full { max-width: none; padding: 0; display: flex; flex-direction: column; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }

.bottombar, .fab { display: none; }

@media (max-width: 959px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; padding-top: var(--safe-t); height: calc(var(--topbar) + var(--safe-t)); }
  .search-trigger { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .content { padding: 16px 14px calc(var(--bottombar) + var(--safe-b) + 84px); }
  .content.full { padding-bottom: calc(var(--bottombar) + var(--safe-b)); }
  .bottombar {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--bottombar) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
    backdrop-filter: saturate(140%) blur(16px); -webkit-backdrop-filter: saturate(140%) blur(16px);
    border-top: 1px solid var(--border);
  }
  .bottombar a, .bottombar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
    color: var(--text-3); font-size: 0.66rem; font-weight: 500; background: none; border: 0; cursor: pointer; padding: 0;
  }
  .bottombar svg { width: 22px; height: 22px; }
  .bottombar [aria-current="page"] { color: var(--accent); }
  .bottombar a:hover { text-decoration: none; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(var(--bottombar) + var(--safe-b) + 16px); z-index: 31;
    width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4); cursor: pointer; transition: transform var(--dur) var(--ease);
  }
  .fab:active { transform: scale(0.94); }
  .fab svg { width: 24px; height: 24px; }
  .hide-mobile { display: none !important; }
  h1 { font-size: 1.35rem; }
}
@media (min-width: 960px) { .hide-desktop { display: none !important; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: var(--radius-s); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 550; font-size: 0.92rem; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--dur), border-color var(--dur), transform 80ms;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 0.84rem; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.block { width: 100%; }
.btn.loading { pointer-events: none; opacity: 0.7; }
@media (max-width: 959px) { .btn { height: 42px; } .btn.icon { width: 42px; } .btn.sm { height: 34px; } .btn.sm.icon { width: 34px; } }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; }
.card-head h2 { font-size: 0.98rem; }
.card-head .link { font-size: 0.84rem; color: var(--text-2); }
.card-body { padding: 8px 18px 18px; }
.card.clickable { cursor: pointer; transition: border-color var(--dur), transform var(--dur) var(--ease); }
.card.clickable:hover { border-color: var(--border-strong); }

.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)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 1100px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); } .grid.auto { grid-template-columns: minmax(0, 1fr); } }

.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--text-2); font-size: 0.82rem; }
.stat .value { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .value.danger { color: var(--danger); }
.stat .value.warning { color: var(--warning); }
@media (max-width: 700px) { .stat { padding: 12px 14px; } .stat .value { font-size: 1.3rem; } }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0;
  color: inherit; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100%;
}
.list-item:first-child { border-top: 0; }
button.list-item, a.list-item { cursor: pointer; }
button.list-item:hover .li-title, a.list-item:hover .li-title { color: var(--accent); }
a.list-item:hover { text-decoration: none; }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color var(--dur); }
.li-meta { color: var(--text-3); font-size: 0.8rem; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; }
.li-side { flex: none; display: flex; align-items: center; gap: 6px; }

/* ---------- Chips & badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.urgent { background: var(--danger); } .dot.high { background: var(--warning); } .dot.normal { background: var(--info); } .dot.low { background: var(--text-3); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-2); font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip .n { font-size: 0.75rem; color: var(--text-3); }
@media (max-width: 959px) { .chip { height: 36px; } }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 500ms var(--ease); }
.progress.success > span { background: var(--success); }
.progress.warning > span { background: var(--warning); }
.progress.danger > span { background: var(--danger); }
.progress .marker { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: 0.7; }
.ring { width: 36px; height: 36px; flex: none; }
.ring circle { fill: none; stroke-width: 4; }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 600ms var(--ease); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 0.82rem; font-weight: 550; color: var(--text-2); }
.field .hint { font-size: 0.78rem; color: var(--text-3); }
.field .error { font-size: 0.8rem; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: var(--radius-s);
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
input[type="date"].input, input[type="datetime-local"].input, input[type="time"].input { min-width: 0; }
@media (max-width: 959px) { .input, .select { height: 44px; font-size: 16px; } .textarea { font-size: 16px; } }
.input-group { position: relative; }
.input-group .prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-group .input { padding-left: 28px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; color: var(--text-2); height: 30px; padding: 0 12px; border-radius: 7px; cursor: pointer; font-weight: 550; font-size: 0.85rem; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.room-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--bg-elev); }
.room-checks .check { min-height: 32px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* Round checkbox used for tasks/shopping */
.tick {
  flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); background: transparent;
  display: grid; place-items: center; cursor: pointer; color: transparent; padding: 0;
  transition: background var(--dur), border-color var(--dur), color var(--dur), transform 120ms;
}
.tick svg { width: 14px; height: 14px; }
.tick:hover { border-color: var(--accent); }
.tick[aria-checked="true"] { background: var(--success); border-color: var(--success); color: #fff; }
.tick:active { transform: scale(0.9); }
.tick.square { border-radius: 7px; }
@media (max-width: 959px) { .tick { width: 28px; height: 28px; } }
.done-text { text-decoration: line-through; color: var(--text-3); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 220px; min-width: 0; position: relative; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.toolbar .search .input { padding-left: 34px; }
@media (max-width: 700px) { .toolbar .select { flex: 1 1 130px; width: auto !important; max-width: none !important; } .toolbar .search { flex-basis: 100%; } }
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; min-width: 0; }

/* ---------- Task rows ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); min-width: 0; transition: border-color var(--dur);
}
.task-row:hover { border-color: var(--border-strong); }
.task-row .t-main { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 5px; }
.task-row .t-title { font-weight: 560; overflow-wrap: anywhere; }
.task-row .t-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--text-3); font-size: 0.8rem; }
.task-row .t-side { display: flex; gap: 2px; align-items: center; }
.task-row.is-done { opacity: 0.62; }
.subtasks { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; padding-left: 2px; }
.subtask { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--text-2); min-width: 0; }
.subtask .tick { width: 20px; height: 20px; }
.subtask .tick svg { width: 12px; height: 12px; }
.group-title { display: flex; align-items: center; gap: 8px; margin: 18px 2px 8px; color: var(--text-2); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.group-title:first-child { margin-top: 0; }

/* ---------- Modal / drawer / sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(17, 22, 34, 0.38);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade-in var(--dur) var(--ease);
}
.overlay.closing { animation: fade-out 160ms var(--ease) forwards; }
.modal {
  width: 100%; max-width: 560px; max-height: min(88vh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow-l);
  animation: pop-in 220ms var(--ease);
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.modal-body { padding: 18px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.overlay.drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
.overlay.drawer .modal { max-width: 560px; max-height: none; height: 100%; border-radius: 0; border-width: 0 0 0 1px; animation: slide-in 260ms var(--ease); }
@media (max-width: 700px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal, .overlay.drawer .modal {
    max-width: none; max-height: calc(100dvh - 24px - var(--safe-t)); height: auto; border-radius: var(--radius-l) var(--radius-l) 0 0;
    border-width: 1px 0 0; animation: sheet-in 280ms var(--ease);
  }
  .overlay.drawer .modal { height: calc(100dvh - 24px - var(--safe-t)); }
  .modal-foot { padding-bottom: calc(14px + var(--safe-b)); }
  .modal-foot .btn { flex: 1; }
  .modal-head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--border-strong); }
  .modal { position: relative; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }

.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius); border: 0; background: transparent;
  color: var(--text); cursor: pointer; text-align: left; width: 100%;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); text-decoration: none; }
.menu-item .mi-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); flex: none; }
.menu-item .mi-icon svg { width: 19px; height: 19px; }
.menu-item .mi-text { display: flex; flex-direction: column; min-width: 0; }
.menu-item .mi-text small { color: var(--text-3); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 24px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 440px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius);
  background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow-l); font-weight: 520; font-size: 0.9rem;
  animation: pop-in 220ms var(--ease); max-width: 100%;
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.success svg { color: var(--success); } .toast.error svg { color: var(--danger); } .toast.info svg { color: var(--accent); }
.toast.leaving { animation: fade-out 200ms forwards; }
@media (max-width: 959px) { .toasts { bottom: calc(var(--bottombar) + var(--safe-b) + 84px); } }

.offline-banner { position: fixed; z-index: 150; top: 0; left: 0; right: 0; padding: 8px 16px; padding-top: calc(8px + var(--safe-t)); background: var(--warning); color: #1d1300; text-align: center; font-weight: 600; font-size: 0.88rem; }

/* ---------- Empty / skeleton / error ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 36px 20px; color: var(--text-2); }
.empty .e-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.empty .e-icon svg { width: 24px; height: 24px; }
.empty h3 { color: var(--text); font-size: 1rem; }
.empty p { max-width: 420px; font-size: 0.9rem; }
.empty.compact { padding: 18px 10px; }
.empty.compact .e-icon { display: none; }
.skeleton { border-radius: var(--radius-s); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 0.88rem; color: var(--text-2); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice.warning { background: var(--warning-soft); border-color: transparent; color: var(--text); } .notice.warning svg { color: var(--warning); }
.notice.danger { background: var(--danger-soft); border-color: transparent; color: var(--text); } .notice.danger svg { color: var(--danger); }
.notice.info { background: var(--accent-soft); border-color: transparent; color: var(--text); } .notice.info svg { color: var(--accent); }

/* ---------- Detail panel sections ---------- */
.section { display: flex; flex-direction: column; gap: 10px; }
.section + .section { margin-top: 22px; }
.section-title { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); font-weight: 650; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.9rem; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85rem; }
.chain .arrow { color: var(--text-3); }
.chain .node { padding: 4px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; color: var(--text); }
.chain .node.done { color: var(--text-3); text-decoration: line-through; }
.chain .node.current { border-color: var(--accent); background: var(--accent-soft); }
.chain .node.open { border-color: var(--warning); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 10px 12px; border: 0; background: none; color: var(--text-2); font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Tables (cost overview) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--text-3); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--border-strong); }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; --c-appt: var(--accent); --c-deadline: var(--warning); --c-task: var(--info); }
.cal .dow { font-size: 0.7rem; color: var(--text-3); text-align: center; padding: 2px 0 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.cal .day {
  min-height: 96px; padding: 5px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; text-align: left; color: inherit; font: inherit;
}
.cal .day:hover { border-color: var(--border-strong); }
.cal .day.other { opacity: 0.45; }
.cal .day.has { background: color-mix(in srgb, var(--surface) 92%, var(--accent)); }
.cal .day.today .dn { background: var(--accent); color: var(--accent-ink); }
.cal .day[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cal .day .dn { align-self: flex-start; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center; font-size: 0.78rem; font-weight: 700; color: var(--text); }
.cal .evs { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal .ev { font-size: 0.72rem; line-height: 1.25; padding: 2px 5px 2px 6px; border-radius: 4px; border-left: 3px solid var(--c, var(--c-appt)); background: color-mix(in srgb, var(--c, var(--c-appt)) 14%, transparent); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev b { font-weight: 700; margin-right: 4px; }
.cal .ev.appt { --c: var(--c-appt); } .cal .ev.deadline { --c: var(--c-deadline); } .cal .ev.task { --c: var(--c-task); }
.cal .ev.done, .cal .ev.cancelled { opacity: 0.55; text-decoration: line-through; }
.cal .ev-more { font-size: 0.68rem; color: var(--text-3); padding-left: 4px; }
.cal .ev-pills { display: none; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.74rem; color: var(--text-2); margin-bottom: 8px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 3px; }
.cal-legend i.appt { background: var(--accent); } .cal-legend i.deadline { background: var(--warning); } .cal-legend i.task { background: var(--info); }
.cal-agenda { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.agenda-list { display: flex; flex-direction: column; gap: 6px; }
.agenda-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-s); border: 1px solid var(--border); border-left: 4px solid var(--c, var(--accent)); background: var(--surface); text-align: left; color: inherit; font: inherit; cursor: pointer; width: 100%; }
.agenda-item.appt { --c: var(--accent); } .agenda-item.deadline { --c: var(--warning); } .agenda-item.task { --c: var(--info); }
.agenda-item.done, .agenda-item.cancelled { opacity: 0.6; }
.agenda-item .ai-time { flex: none; width: 52px; font-weight: 700; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .cal { gap: 3px; }
  .cal .day { min-height: 58px; padding: 4px 3px; align-items: center; }
  .cal .day .dn { align-self: center; font-size: 0.8rem; }
  .cal .evs { display: none; }
  .cal .ev-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
  .cal .pill { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 0.62rem; font-weight: 700; display: grid; place-items: center; color: #fff; background: var(--accent); }
  .cal .pill.deadline { background: var(--warning); color: #1d1300; } .cal .pill.task { background: var(--info); }
}
.date-block { width: 48px; flex: none; text-align: center; border-radius: 10px; background: var(--surface-2); padding: 6px 0; }
.date-block .m { font-size: 0.68rem; text-transform: uppercase; color: var(--accent); font-weight: 700; letter-spacing: 0.06em; }
.date-block .d { font-size: 1.2rem; font-weight: 650; line-height: 1.1; }

.room-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .room-grid { grid-template-columns: minmax(0, 1fr); } }
.planning-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .planning-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Documents ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
@media (max-width: 420px) { .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.doc-card { display: flex; flex-direction: column; overflow: hidden; cursor: pointer; padding: 0; text-align: left; color: inherit; font: inherit; }
.doc-thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); overflow: hidden; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb svg { width: 32px; height: 32px; }
.doc-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color var(--dur), background var(--dur); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.preview-img { max-height: 60vh; margin: 0 auto; border-radius: var(--radius-s); }

/* ---------- Search ---------- */
.search-modal .modal { max-width: 620px; align-self: flex-start; margin-top: 10vh; }
@media (max-width: 700px) { .search-modal { align-items: flex-start; } .search-modal .modal { margin-top: 0; align-self: flex-start; border-radius: 0 0 var(--radius-l) var(--radius-l); max-height: 80dvh; padding-top: var(--safe-t); animation: pop-in 220ms var(--ease); } .search-modal .modal-head::before { display: none; } }
.search-input { border: 0; background: transparent; font-size: 1.05rem; width: 100%; height: 44px; outline: none; }
.search-result { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius-s); cursor: pointer; border: 0; background: none; color: inherit; width: 100%; text-align: left; }
.search-result:hover, .search-result.active { background: var(--surface-2); }
.search-result .sr-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.search-result .sr-icon svg { width: 16px; height: 16px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 22px; align-items: center; text-align: center; }
.login-card .brand-mark { width: 52px; height: 52px; border-radius: 15px; }
.login-card .brand-mark svg { width: 28px; height: 28px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; height: 20px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); transition: background var(--dur), border-color var(--dur), transform var(--dur); }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.pin-dots.shake { animation: shake 360ms; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; justify-content: center; }
.keypad button { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-size: 1.5rem; font-weight: 500; cursor: pointer; transition: background var(--dur), transform 80ms; }
.keypad button:hover { background: var(--surface-2); }
.keypad button:active { transform: scale(0.94); background: var(--surface-3); }
.keypad button.fn { background: transparent; border-color: transparent; font-size: 0.9rem; color: var(--text-2); }
.keypad button svg { width: 22px; height: 22px; margin: 0 auto; }
.login .error { color: var(--danger); min-height: 1.4em; font-size: 0.9rem; }

/* ---------- Floorplan ---------- */
.fp-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; height: calc(100dvh - var(--topbar)); }
@media (max-width: 959px) { .fp-wrap { height: calc(100dvh - var(--topbar) - var(--safe-t) - var(--bottombar) - var(--safe-b)); } }
.fp-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background:
  radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text-3) 22%, transparent) 1px, transparent 0) 0 0 / 22px 22px, var(--bg); }
.fp-svg { width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.fp-svg.panning { cursor: grabbing; }
.fp-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: flex-start; pointer-events: none; z-index: 2; flex-wrap: wrap; }
.fp-top > * { pointer-events: auto; }
.fp-crumbs { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow); min-width: 0; max-width: 100%; }
.fp-crumbs button { border: 0; background: none; color: var(--text-2); font-weight: 550; padding: 6px 10px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fp-crumbs button:hover { background: var(--surface-2); color: var(--text); }
.fp-crumbs .cur { color: var(--text); font-weight: 600; padding: 6px 10px 6px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-crumbs svg { width: 16px; height: 16px; }
.fp-zoom { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow); z-index: 2; }
.fp-zoom .icon-btn { width: 38px; height: 38px; }
.fp-modes { position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: calc(100% - 24px); }
.fp-modebar { display: flex; gap: 2px; padding: 4px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--border); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-l); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.fp-modebar::-webkit-scrollbar { display: none; }
.fp-modebar button { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 560; cursor: pointer; font-size: 0.88rem; }
.fp-modebar button svg { width: 17px; height: 17px; }
.fp-modebar button .swatch { width: 9px; height: 9px; border-radius: 50%; }
.fp-modebar button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.fp-subfilters { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 6px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--border); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.fp-subfilters .chip { height: 28px; font-size: 0.8rem; }
.fp-legend { position: absolute; left: 12px; top: 64px; z-index: 2; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 0.78rem; display: flex; flex-direction: column; gap: 6px; max-width: 240px; }
.fp-legend .lg { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.fp-legend .lg i { width: 18px; height: 0; border-top: 3px solid currentColor; flex: none; }
.fp-legend .lg i.dash { border-top-style: dashed; }
.fp-legend .lg i.pt { width: 9px; height: 9px; border: 0; border-radius: 50%; background: currentColor; }
@media (max-width: 700px) {
  .fp-legend { display: none; }
  .fp-zoom { top: auto; bottom: 120px; transform: none; right: 10px; }
  .fp-modebar button { padding: 0 10px; }
}
.fp-banner { flex-basis: 100%; align-self: flex-start; width: max-content; max-width: 100%; padding: 6px 12px; border-radius: 99px; background: var(--warning); color: #1d1300; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; box-shadow: var(--shadow); }
.fp-layer-empty { position: absolute; z-index: 2; left: 50%; transform: translateX(-50%); bottom: 140px; max-width: min(420px, calc(100% - 24px)); }

@media (min-width: 701px) {
  .fp-wrap.panel-open .fp-modes { left: calc((100% - 400px) / 2); max-width: calc(100% - 430px); }
}
@media (max-width: 1100px) { .fp-wrap.panel-open .fp-legend { display: none; } }
.fp-legend:not([open]) { gap: 0; }
.fp-legend summary { list-style-position: inside; }
@media (max-width: 700px) {
  .fp-wrap.panel-open .fp-subfilters, .fp-wrap.panel-open .fp-layer-empty { display: none; }
  .fp-modes { left: 10px; right: 82px; transform: none; align-items: flex-start; max-width: none; bottom: 12px; }
  .fp-subfilters { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .fp-subfilters::-webkit-scrollbar { display: none; }
  .fp-subfilters .chip { flex: none; }
  .fp-layer-empty { left: 10px; right: 82px; transform: none; bottom: 128px; max-width: none; }
  .fp-banner { font-size: 0.72rem; white-space: normal; }
}

/* SVG semantics. Colors come from CSS so both themes work. */
.fp-svg { --fp-paper: #ffffff; --fp-ink: #1d2230; --fp-ink-2: #5d6474; --fp-wall-light: #9aa0ab; --fp-hatch-bg: #f3f4f6; --fp-hatch: #4b5263; --fp-dim: #6b7280; }
.fp-svg text { font-family: var(--font); pointer-events: none; }
.fp-room { fill: var(--fp-paper); stroke: none; cursor: pointer; transition: fill var(--dur); }
.fp-room:hover { fill: color-mix(in srgb, var(--fp-paper) 94%, var(--accent)); }
.fp-room.linked { fill: var(--fp-paper); }
.fp-room.selected { fill: color-mix(in srgb, var(--fp-paper) 84%, var(--accent)); }
.fp-room-label { fill: var(--fp-ink); font-weight: 640; letter-spacing: -0.01em; }
.fp-room-sub { fill: var(--fp-ink-2); font-weight: 500; }
.fp-wall-edge { fill: var(--fp-ink); stroke: var(--fp-ink); stroke-width: 2.4px; vector-effect: non-scaling-stroke; stroke-linejoin: miter; }
.fp-wall-body { stroke: none; }
.fp-wall-body.heavy { fill: url(#fp-hatch); }
.fp-wall-body.light { fill: var(--fp-wall-light); }
.fp-wall-body.unknown { fill: none; stroke: var(--fp-ink-2); stroke-width: 1px; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.fp-wall-body.selected { fill: var(--accent); }
.fp-hatch-bg { fill: var(--fp-hatch-bg); }
.fp-hatch-line { stroke: var(--fp-hatch); stroke-width: 9; }
.fp-opening-gap { stroke: var(--fp-paper); }
.fp-jamb { stroke: var(--fp-ink); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.fp-opening { stroke: var(--fp-ink); fill: none; vector-effect: non-scaling-stroke; stroke-width: 0.9px; cursor: pointer; }
.fp-opening.leaf { stroke-width: 1.4px; }
.fp-opening.arc { stroke-width: 0.8px; stroke-dasharray: none; opacity: 0.8; }
.fp-opening.window { stroke: var(--fp-ink); stroke-width: 0.9px; }
.fp-opening.selected { stroke: var(--accent); stroke-width: 2.2px; }
.fp-opening-hit, .fp-wall-hit, .fp-dim-hit, .fp-path-hit { stroke: transparent; fill: none; cursor: pointer; pointer-events: stroke; }
.fp-dim { stroke: var(--fp-dim); vector-effect: non-scaling-stroke; stroke-width: 0.8px; fill: none; }
.fp-dim.ext { stroke-width: 0.6px; opacity: 0.85; }
.fp-dim.tick { stroke-width: 1.3px; stroke: var(--fp-ink-2); }
.fp-dim.selected { stroke: var(--accent); }
.fp-dim.approximate:not(.tick):not(.ext) { stroke-dasharray: 5 3; }
.fp-dim-label { fill: var(--fp-ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.fp-dim-bg { fill: var(--fp-paper); opacity: 0.92; }
.fp-dim-labelgroup.selected .fp-dim-label { fill: var(--accent); }
.fp-path { fill: none; vector-effect: non-scaling-stroke; stroke-width: 2.6px; stroke-linecap: round; stroke-linejoin: round; }
.fp-path.approximate { stroke-dasharray: 8 6; }
.fp-path.unknown { stroke-dasharray: 2 6; opacity: 0.7; }
.fp-path.planned { opacity: 0.9; }
.fp-path.selected { stroke-width: 5px; }
.fp-point { cursor: pointer; }
.fp-point .pt-bg { fill: var(--bg); stroke-width: 1.6px; vector-effect: non-scaling-stroke; }
.fp-point.approximate .pt-bg { stroke-dasharray: 3 2; }
.fp-point .pt-glyph { fill: none; stroke-width: 1.4px; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.fp-point.selected .pt-bg { stroke-width: 3px; }
.fp-progress-bg { fill: var(--surface-3); }
.fp-progress-fg { fill: var(--accent); }
.fp-badge { fill: var(--accent); }
.fp-badge-text { fill: var(--accent-ink); font-weight: 700; }
.fp-dimmed { opacity: 0.35; transition: opacity var(--dur); }

/* ---------- Misc ---------- */
.room-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.money-row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; }
.money-row .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.stacked-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); position: relative; }
.stacked-bar span { height: 100%; transition: width 500ms var(--ease); }
.stacked-bar .paid { background: var(--success); } .stacked-bar .committed { background: var(--accent); } .stacked-bar .estimate { background: color-mix(in srgb, var(--accent) 40%, var(--surface-3)); }
.stacked-bar .budget-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); }
.activity-item { display: flex; gap: 10px; padding: 7px 0; font-size: 0.86rem; color: var(--text-2); }
.activity-item time { color: var(--text-3); flex: none; font-size: 0.78rem; min-width: 62px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* ---------- Install card ---------- */
.install-card { position: fixed; z-index: 120; left: 50%; transform: translateX(-50%); bottom: 24px; width: min(440px, calc(100% - 24px));
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 12px; padding: 12px 14px; border-radius: var(--radius-l); background: var(--surface);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-l); animation: sheet-in 300ms var(--ease); }
.install-card img { border-radius: 11px; flex: none; }
.install-card p { margin-top: 2px; }
.install-card .ic-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
@media (min-width: 560px) { .install-card { grid-template-columns: auto 1fr auto; } .install-card .ic-actions { grid-column: auto; } }
@media (max-width: 959px) { .install-card { bottom: calc(var(--bottombar) + var(--safe-b) + 12px); } }
.step-no { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; flex: none; }
strong svg { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Dashboard v2 (compact, visual) ---------- */
.dash { display: flex; flex-direction: column; gap: 12px; font-size: 0.875rem; }
.dash h2 { font-size: 0.9rem; }
.dash .li-title { font-size: 0.86rem; }
.dash .li-meta { font-size: 0.74rem; }
.dash .badge { height: 19px; font-size: 0.68rem; padding: 0 7px; }
.quick-actions { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.quick-actions::-webkit-scrollbar { display: none; }
.qa { flex: 1 1 0; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.75rem; font-weight: 560; cursor: pointer; transition: border-color var(--dur), transform 80ms; }
.qa:hover { border-color: var(--accent); }
.qa:active { transform: scale(0.97); }
.qa-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.qa-icon svg { width: 18px; height: 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kpi { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon value" "label label" "sub sub"; align-items: center; gap: 2px 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: inherit; min-width: 0; }
.kpi:hover { text-decoration: none; border-color: var(--border-strong); }
.kpi-icon { grid-area: icon; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.kpi-icon svg { width: 15px; height: 15px; }
.kpi-value { grid-area: value; font-size: 1.35rem; font-weight: 680; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-label { grid-area: label; font-size: 0.72rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { grid-area: sub; font-size: 0.68rem; color: var(--text-3); }
.kpi.danger .kpi-icon { background: var(--danger-soft); color: var(--danger); } .kpi.danger .kpi-value { color: var(--danger); }
.kpi.warning .kpi-icon { background: var(--warning-soft); color: var(--warning); } .kpi.warning .kpi-value { color: var(--warning); }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-col:last-child { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { gap: 6px; }
  .kpi { padding: 8px; grid-template-columns: 1fr; grid-template-areas: "value" "label" "sub"; }
  .kpi-icon { display: none; }
  .kpi-value { font-size: 1.2rem; }
  .kpi-label { font-size: 0.66rem; }
}
.dash-card { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.dc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dc-link { display: inline-flex; align-items: center; gap: 2px; font-size: 0.76rem; color: var(--text-2); }
.dc-link svg { width: 14px; height: 14px; }
details > summary.dc-head { list-style: none; cursor: pointer; padding: 12px 14px; }
details > summary.dc-head::-webkit-details-marker { display: none; }
details > summary.dc-head svg { width: 16px; height: 16px; color: var(--text-3); transition: transform var(--dur); }
details[open] > summary.dc-head svg { transform: rotate(180deg); }
.activity-card .card-body { padding-top: 0; }

.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 5px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); color: var(--text-2); cursor: pointer; font: inherit; min-width: 0; }
.wd.today .wd-name { color: var(--accent); font-weight: 700; }
.wd[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.wd-name { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.wd-num { font-size: 1rem; font-weight: 680; color: var(--text); line-height: 1.1; }
.wd-dots { display: flex; gap: 2px; height: 6px; }
.wd-dots i, .di-icon { --c: var(--accent); }
.wd-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.wd-dots i.deadline, .day-item.deadline { --c: var(--warning); }
.wd-dots i.task, .day-item.task { --c: var(--info); }
.wd-dots i.shopping, .day-item.shopping { --c: var(--success); }
.day-list { display: flex; flex-direction: column; margin-top: 6px; }
.day-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border: 0; border-top: 1px solid var(--border); background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; width: 100%; }
.day-item:first-child { border-top: 0; }
.day-item > svg { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.day-item.done .li-title { text-decoration: line-through; color: var(--text-3); }
.di-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); }
.day-item .di-icon { --c: inherit; }
.day-item.appointment { --c: var(--accent); }
.di-icon svg { width: 15px; height: 15px; }

.compact-list { display: flex; flex-direction: column; }
.compact-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.compact-item:first-child { border-top: 0; }
.compact-item .tick { width: 22px; height: 22px; margin-top: 1px; }
.li-main.plain { background: none; border: 0; padding: 0; text-align: left; color: inherit; cursor: pointer; font: inherit; }
.li-main.plain .li-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.blocked-details summary { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.78rem; color: var(--warning); font-weight: 600; padding: 4px 0; }
.blocked-details summary svg { width: 14px; height: 14px; }

.shop-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.shop-strip::-webkit-scrollbar { display: none; }
.shop-mini { display: flex; flex-direction: column; gap: 5px; color: inherit; min-width: 0; }
.shop-mini:hover { text-decoration: none; }
.sm-thumb { aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); overflow: hidden; border: 1px solid var(--border); }
.sm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sm-thumb svg { width: 26px; height: 26px; }
.sm-title { font-size: 0.8rem; font-weight: 560; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sm-meta { display: flex; gap: 5px; align-items: center; font-size: 0.7rem; color: var(--text-3); flex-wrap: wrap; }

.proj-strip { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (max-width: 760px) { .proj-strip { grid-auto-flow: column; grid-auto-columns: 78%; grid-template-columns: none; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; } .proj-strip::-webkit-scrollbar { display: none; } .proj-card { scroll-snap-align: start; } }
.proj-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); color: inherit; min-width: 0; border: 1px solid transparent; }
.proj-card:hover { text-decoration: none; border-color: var(--border-strong); }
.pc-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pc-ring { position: relative; flex: none; width: 46px; height: 46px; }
.pc-ring .ring { width: 46px; height: 46px; }
.pc-pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.68rem; font-weight: 700; }
.pc-name { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-budget { display: flex; flex-direction: column; gap: 4px; }

.budget-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.hero-num { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.hero-sub { font-size: 1rem; font-weight: 650; }
.hero-sub.neg { color: var(--danger); } .hero-sub.pos { color: var(--success); }
.stacked-bar.tall { height: 14px; gap: 2px; background: var(--surface-3); }
.stacked-bar.tall span:not(.budget-line) { border-radius: 4px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.74rem; }
.lg-item { display: inline-flex; align-items: center; gap: 5px; }
.lg-item i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.lg-item i.line { width: 3px; height: 11px; border-radius: 1px; }

/* ---------- Compact forms ---------- */
.more-fields { border-top: 1px solid var(--border); padding-top: 10px; }
.more-fields > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 560; font-size: 0.86rem; padding: 4px 0; }
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary svg { width: 15px; height: 15px; transition: transform var(--dur); }
.more-fields[open] > summary svg { transform: rotate(180deg); }
.more-fields[open] > .form-grid { margin-top: 12px; }
.prio-seg button { display: inline-flex; align-items: center; gap: 6px; }
.segmented { max-width: 100%; }
.photo-row { display: flex; gap: 14px; align-items: flex-start; }
.photo-picker { flex: none; width: 104px; height: 104px; border-radius: var(--radius); border: 1.5px dashed var(--border-strong); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; cursor: pointer; position: relative; transition: border-color var(--dur); }
.photo-picker:hover { border-color: var(--accent); }
.photo-picker img { width: 100%; height: 100%; object-fit: cover; }
.pp-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-3); font-size: 0.78rem; }
.pp-empty svg { width: 24px; height: 24px; }
@media (max-width: 420px) { .photo-picker { width: 84px; height: 84px; } }

/* ---------- Shopping cards ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
@media (max-width: 520px) { .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.shop-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-width: 0; transition: border-color var(--dur); }
.shop-card:hover { border-color: var(--border-strong); }
.shop-card.is-bought { opacity: 0.6; }
.sc-thumb { aspect-ratio: 4 / 3; width: 100%; border: 0; padding: 0; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; cursor: pointer; color: var(--text-3); }
.sc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sc-thumb.empty { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; font-size: 0.76rem; border-bottom: 1px dashed var(--border-strong); }
.sc-thumb.empty:hover { color: var(--accent); }
.sc-thumb.empty svg { width: 24px; height: 24px; }
.sc-tick { position: absolute; top: 8px; left: 8px; }
.sc-tick .tick { background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sc-tick .tick[aria-checked="true"] { background: var(--success); }
.sc-body { display: flex; flex-direction: column; gap: 4px; padding: 9px 11px 11px; border: 0; background: none; text-align: left; color: inherit; font: inherit; cursor: pointer; min-width: 0; flex: 1; }
.sc-title { font-weight: 600; font-size: 0.86rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 0.72rem; color: var(--text-3); min-width: 0; }
.sc-meta span + span::before { content: "·"; margin-right: 6px; }
.sc-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.sc-foot .badge { height: 19px; font-size: 0.68rem; }
.sc-price { margin-left: auto; font-size: 0.8rem; }
.row-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.segmented button svg { width: 16px; height: 16px; display: block; }
.quick-add { position: relative; margin-bottom: 10px; }
.quick-add > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--accent); pointer-events: none; }
.quick-add .input { padding-left: 36px; border-style: dashed; }
.quick-add .input:focus { border-style: solid; }

.sc-thumb.empty { aspect-ratio: auto; height: 58px; flex-direction: row; gap: 6px; }
.sc-thumb.empty + .sc-tick, .shop-card:has(.sc-thumb.empty) .sc-tick { top: 15px; }
@media (max-width: 700px) {
  .toolbar { gap: 8px; margin-bottom: 10px; }
  .toolbar .select { flex: 1 1 100px; }
  .toolbar .segmented { flex: none; }
  .page-head { margin-bottom: 12px; }
  .page-head .btn.primary.head-add { display: none; }
}

@media (max-width: 700px) {
  .modal-foot { flex-wrap: nowrap; }
  .modal-foot .btn.foot-extra { flex: 0 0 42px; width: 42px; padding: 0; font-size: 0; gap: 0; }
  .modal-foot .btn.foot-extra svg { width: 18px; height: 18px; }
}
.modal-foot .btn.foot-extra:first-child { margin-right: auto; }
@media (min-width: 960px) {
  .qa { flex-direction: row; justify-content: center; padding: 8px 12px; gap: 10px; font-size: 0.82rem; }
  .qa-icon { width: 28px; height: 28px; border-radius: 9px; }
  .qa-icon svg { width: 16px; height: 16px; }
}

/* ---------- Purchase detail ---------- */
.link-btn { justify-content: flex-start; min-width: 0; }
.link-btn span { min-width: 0; }
.item-photo { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.item-photo img { width: 100%; max-height: 52vh; object-fit: contain; display: block; margin: 0 auto; }
.item-photo .zoom-hint { position: absolute; right: 10px; bottom: 10px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(0,0,0,0.5); color: #fff; }
.item-photo .zoom-hint svg { width: 16px; height: 16px; }
.item-photo.empty { display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; height: 150px; border: 1.5px dashed var(--border-strong); color: var(--text-2); cursor: pointer; font-weight: 560; }
.item-photo.empty svg { width: 28px; height: 28px; }
.item-photo.empty:hover { border-color: var(--accent); color: var(--accent); }
.item-thumbs { display: flex; gap: 8px; overflow-x: auto; }
.item-thumbs button, .add-thumb { flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); padding: 0; cursor: pointer; display: grid; place-items: center; color: var(--text-3); }
.item-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.add-thumb { border-style: dashed; }
.add-thumb svg { width: 18px; height: 18px; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 12px; }
.danger-text { color: var(--danger); }
.lightbox .modal { max-width: min(1200px, 96vw); background: #000; border-color: #000; }
.lightbox .modal-head { background: #000; border-color: #222; color: #fff; }
.lightbox .modal-head .icon-btn { color: #fff; }
.lightbox .modal-body { padding: 0; display: grid; place-items: center; background: #000; }
.lightbox-img { max-width: 100%; max-height: 82vh; object-fit: contain; cursor: zoom-out; }
@media (max-width: 700px) { .lightbox .modal { max-height: 100dvh; height: 100dvh; border-radius: 0; } .lightbox-img { max-height: calc(100dvh - 70px); } }

.day-list { gap: 10px; }
.day-group { display: flex; flex-direction: column; gap: 6px; }
.dg-head { display: flex; align-items: baseline; gap: 8px; font-size: 0.8rem; }
.dg-head strong { text-transform: capitalize; }
.dash .agenda-item { padding: 7px 9px; gap: 10px; }
.dash .agenda-item .ai-time { width: 42px; font-size: 0.76rem; }
.agenda-item.shopping { --c: var(--success); }
.next-appt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-s); background: var(--surface-2); border: 0; color: var(--text-2); font: inherit; font-size: 0.78rem; text-align: left; cursor: pointer; }
.next-appt svg { width: 15px; height: 15px; flex: none; color: var(--accent); }

/* ---------- Project cards with to-dos ---------- */
.project-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
@media (max-width: 700px) { .project-grid { grid-template-columns: minmax(0, 1fr); } }
.room-card { padding: 0; gap: 0; }
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 10px; color: inherit; }
.rc-head:hover { text-decoration: none; }
.rc-head:hover h3 { color: var(--accent); }
.rc-head .pc-ring, .rc-head .pc-ring .ring { width: 42px; height: 42px; }
.todo-list { display: flex; flex-direction: column; padding: 0 14px 10px; }
.todo-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); min-width: 0; font-size: 0.84rem; }
.todo-row .tick { width: 20px; height: 20px; }
.todo-row .tick svg { width: 12px; height: 12px; }
.todo-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.todo-title:hover .truncate { color: var(--accent); }
.todo-title .dot { width: 7px; height: 7px; }
.todo-title .dot.normal, .todo-title .dot.low { background: var(--border-strong); }
.todo-sub { font-size: 0.7rem; color: var(--text-3); flex: none; }
.todo-due { font-size: 0.7rem; color: var(--text-3); flex: none; white-space: nowrap; }
.todo-due.soon { color: var(--warning); font-weight: 600; } .todo-due.late { color: var(--danger); font-weight: 600; }
.todo-flag { flex: none; display: grid; place-items: center; }
.todo-flag svg { width: 14px; height: 14px; }
.todo-flag.danger { color: var(--danger); }
.todo-more { font-size: 0.76rem; padding: 4px 0 2px 28px; color: var(--text-2); }
.todo-add { position: relative; margin-top: 6px; }
.todo-add > svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.todo-input { width: 100%; height: 32px; padding: 0 10px 0 28px; border-radius: var(--radius-s); border: 1px dashed var(--border-strong); background: transparent; color: var(--text); font-size: 0.82rem; }
.todo-input:focus { outline: none; border-style: solid; border-color: var(--accent); background: var(--bg-elev); }
@media (max-width: 959px) { .todo-input { height: 38px; font-size: 16px; } }
.rc-budget { padding: 10px 14px 14px; border-top: 1px solid var(--border); }
.item-sheet .segmented { display: flex; width: 100%; }
.item-sheet .segmented button { flex: 1; }
.agenda-item .ai-time.icon { display: grid; place-items: start; color: var(--c, var(--accent)); }
.agenda-item .ai-time.icon svg { width: 16px; height: 16px; }

/* ---------- Map detail panel (modal-styled, non-blocking) ---------- */
.fp-panel { position: absolute; z-index: 6; top: 12px; right: 12px; bottom: 12px; width: 420px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow-l); animation: slide-in 240ms var(--ease); overflow: hidden; }
.fp-panel .modal-head { padding: 14px 16px; }
.fp-panel .modal-head h2 { font-size: 1.15rem; margin-top: 2px; }
.fp-panel .modal-body { overflow-y: auto; overscroll-behavior: contain; gap: 16px; padding: 16px; }
@media (min-width: 701px) { .fp-wrap.panel-open .fp-zoom { right: 444px; } }
@media (max-width: 700px) {
  .fp-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 64%; border-radius: var(--radius-l) var(--radius-l) 0 0; border-width: 1px 0 0; animation: sheet-in 280ms var(--ease); }
  .fp-panel .modal-head { padding-top: 18px; position: relative; }
  .fp-wrap.panel-open .fp-modes, .fp-wrap.panel-open .fp-zoom { display: none; }
}
.panel-h { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 650; }
.panel-project { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); }
.panel-project .todo-row { border-top-color: var(--border-strong); }
.panel-project .todo-row:first-child { border-top: 0; }
.pp-head { display: flex; align-items: center; gap: 12px; }
.pp-head .pc-ring, .pp-head .pc-ring .ring { width: 44px; height: 44px; }
.pp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.link-btn-plain { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: 0.8rem; cursor: pointer; padding: 2px 0; }
.link-btn-plain svg { width: 14px; height: 14px; }
.link-btn-plain:hover { color: var(--accent); }
.measure-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mt { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: var(--radius-s); border: 1px solid var(--border); }
.mt-l { font-size: 0.7rem; color: var(--text-3); }
.mt-v { font-size: 1rem; font-weight: 680; }
.panel-src summary { cursor: pointer; font-size: 0.8rem; color: var(--text-2); font-weight: 560; padding: 4px 0; }
.panel-src[open] summary { margin-bottom: 8px; }
@media (max-width: 959px) { body.fp-panel-open .fab { display: none; } }

/* ---------- Documents & gallery ---------- */
.doc-thumb.file { background: linear-gradient(160deg, var(--surface-2), var(--surface-3)); }
.file-badge { position: relative; display: grid; place-items: center; color: var(--accent); }
.file-badge svg { width: 40px; height: 40px; stroke-width: 1.4; }
.file-badge span { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 0.56rem; font-weight: 800; letter-spacing: 0.04em; background: var(--accent); color: #fff; padding: 1px 4px; border-radius: 3px; }
.file-badge.big svg { width: 52px; height: 52px; }
.file-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface-2); flex-wrap: wrap; }
.file-card .btn { margin-left: auto; }
.link-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.link-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font: inherit; font-size: 0.8rem; font-weight: 550; }
button.link-chip { cursor: pointer; color: var(--accent); }
button.link-chip:hover { border-color: var(--accent); }
.link-chip svg { width: 14px; height: 14px; flex: none; }
.lb-stage { position: relative; width: 100%; display: grid; place-items: center; min-height: 40vh; touch-action: pan-y; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.16); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lb-nav:disabled { opacity: 0.25; cursor: default; }
.lb-nav svg { width: 22px; height: 22px; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.lb-count { color: rgba(255,255,255,0.7); font-size: 0.82rem; font-variant-numeric: tabular-nums; margin-right: 6px; }
.lightbox .modal-head h2 { color: #fff; font-size: 0.95rem; }
.lightbox .modal-head::before { background: #444 !important; }
.doc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 420px) { .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.doc-card .doc-thumb { aspect-ratio: 1; }

/* ---------- Appointment view ---------- */
.when-card { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); }
.date-block.big { width: 56px; background: var(--surface); padding: 8px 0; }
.date-block.big .d { font-size: 1.5rem; }
.person-card, .quote-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); }
.quote-card { justify-content: space-between; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.item-sheet .segmented { display: flex; width: 100%; }
.item-sheet .segmented button { flex: 1; white-space: nowrap; }
.cost-cards { display: flex; flex-direction: column; gap: 8px; }
.cost-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); color: inherit; }
.cost-card:hover { text-decoration: none; border-color: var(--border-strong); }
.cost-card .neg { color: var(--danger); font-weight: 650; } .cost-card .pos { color: var(--success); font-weight: 650; }
.btn.danger-text { color: var(--danger); }
.item-actions { flex-wrap: nowrap; }
.item-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; }
@media (max-width: 380px) { .item-actions .btn { font-size: 0.8rem; gap: 5px; } }
@media (max-width: 700px) { .lightbox .modal { max-width: none; width: 100vw; border: 0; } }
.item-sheet .segmented { flex-wrap: nowrap; }
.item-sheet .segmented button { padding: 0 6px; font-size: 0.82rem; }

/* ---------- Project detail ---------- */
.project-hero { padding: 14px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 4px; }
.ph-top { display: flex; align-items: center; gap: 12px; }
.ph-top .pc-ring, .ph-top .pc-ring .ring { width: 56px; height: 56px; }
.ph-top .pc-pct { font-size: 0.78rem; }
.ph-title { font-size: 1.3rem; margin: 2px 0; overflow-wrap: anywhere; }
.back-link { display: inline-flex; align-items: center; gap: 2px; }
.back-link svg { width: 13px; height: 13px; }
.ph-budget { display: flex; flex-direction: column; gap: 6px; }
.sticky-tabs { position: sticky; top: var(--topbar); z-index: 10; background: var(--bg); margin: 0 -14px 14px; padding: 0 14px; }
@media (min-width: 960px) { .sticky-tabs { margin: 0 0 14px; padding: 0; } }
@media (max-width: 959px) { .sticky-tabs { top: calc(var(--topbar) + var(--safe-t)); } }
.tab { display: inline-flex; align-items: center; gap: 6px; }
.tab-n { font-size: 0.7rem; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); display: inline-grid; place-items: center; }
.tab[aria-selected="true"] .tab-n { background: var(--accent); color: #fff; }
.task-row { padding: 10px 12px; gap: 10px; }
.task-row .t-title { font-size: 0.9rem; }
.task-row .t-meta .badge { height: 20px; font-size: 0.68rem; padding: 0 7px; }
.task-row .tick { width: 24px; height: 24px; }
.task-list { gap: 6px; }
.section-title { flex-wrap: wrap; row-gap: 4px; }
.section-title .row { flex-wrap: wrap; }
@media (max-width: 700px) { .stat { padding: 10px 12px; } .stat .value { font-size: 1.15rem; } .stat .label { font-size: 0.74rem; } .grid.cols-4 { gap: 8px; } }
