/* ============ Nest — design tokens (overridden at runtime by theme.js) ============ */
:root {
  --bg: #eef2ee; --bg-2: #e3ebe5;
  --surface: rgba(255, 255, 255, 0.62); --surface-solid: #fbfcfb; --surface-2: rgba(255, 255, 255, 0.4);
  --border: rgba(30, 50, 40, 0.09); --border-strong: rgba(30, 50, 40, 0.16);
  --text: #1f2a26; --muted: #66756f; --faint: #98a59f;
  --accent: #5e8c7a; --accent-soft: rgba(94, 140, 122, 0.14); --accent-ink: #ffffff;
  --blob1: #bcd7c9; --blob2: #d6e4ef; --blob3: #efe3d3;
  --warn: #c9874a; --warn-soft: rgba(201, 135, 74, 0.14);
  --danger: #c66a6a; --danger-soft: rgba(198, 106, 106, 0.12);
  --ok: #5e9c7a;
  --shadow: 0 1px 2px rgba(20, 40, 30, 0.04), 0 8px 24px rgba(20, 40, 30, 0.06);
  --shadow-lg: 0 24px 64px rgba(20, 40, 30, 0.18);
  --radius: 18px; --radius-sm: 12px; --radius-xs: 8px;
  --pad: 20px; --gap: 16px;
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --blur: 18px;
  --sidebar-w: 232px;
  color-scheme: light;
}
:root[data-mode="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ Background ============ */
#bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#bg .blob { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: 0.75; will-change: transform; }
#bg .b1 { background: var(--blob1); top: -20vmax; left: -15vmax; animation: drift1 38s ease-in-out infinite alternate; }
#bg .b2 { background: var(--blob2); bottom: -25vmax; right: -15vmax; animation: drift2 44s ease-in-out infinite alternate; }
#bg .b3 { background: var(--blob3); top: 30%; left: 35%; width: 40vmax; height: 40vmax; opacity: 0.55; animation: drift3 52s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(18vw, 12vh) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-14vw, -10vh) scale(0.92); } }
@keyframes drift3 { to { transform: translate(-20vw, 14vh) scale(1.2); } }
#bg .grain { position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
:root[data-bg="mesh"] #bg .blob { animation: none; }
:root[data-bg="plain"] #bg .blob, :root[data-bg="spline"] #bg .blob { display: none; }
#bg #silk-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#bg.silk-on .blob { display: none; }
#spline-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: none; }
:root[data-bg="spline"] #spline-bg { display: block; }
#spline-bg spline-viewer, #spline-bg iframe { width: 100%; height: 100%; border: 0; display: block; }
/* the scene is authored light; in dark mode show it as a dimmed negative with hues kept */
:root[data-mode="dark"] #spline-bg { filter: invert(0.9) hue-rotate(180deg) saturate(0.7) brightness(0.9); }
@media (prefers-reduced-motion: reduce) { #bg .blob { animation: none; } }

/* ============ Shell ============ */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
:root[data-sidebar="compact"] { --sidebar-w: 76px; }
.sidebar {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  background: var(--surface-2); backdrop-filter: blur(var(--blur)) saturate(1.2); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.2);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; text-decoration: none; color: var(--text); }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; box-shadow: 0 6px 18px var(--accent-soft); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.03em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-settings {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 500; transition: background .2s, color .2s;
}
.nav a i, .nav-settings i { font-style: normal; width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.nav a i svg, .nav-settings i svg { width: 19px; height: 19px; }
.nav a:hover, .nav-settings:hover { background: var(--surface); color: var(--text); }
.nav a.active, .nav-settings.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }
.nav a.active i { color: var(--accent); }
.nav-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.people-mini { display: flex; gap: 6px; padding: 8px 12px; }
.collapse-btn { align-self: flex-start; margin-left: 8px; border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.collapse-btn:hover { background: var(--surface); color: var(--text); }
:root[data-sidebar="compact"] .brand-name, :root[data-sidebar="compact"] .nav span, :root[data-sidebar="compact"] .nav-settings span { display: none; }
:root[data-sidebar="compact"] .people-mini { flex-direction: column; padding: 8px 6px; align-items: center; }
:root[data-sidebar="compact"] .collapse-btn { transform: rotate(180deg); }
:root[data-sidebar="compact"] .nav a, :root[data-sidebar="compact"] .nav-settings { justify-content: center; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 16px 28px 8px; }
.topbar-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; min-width: 140px; }
.topbar-title small { display: block; font-family: var(--font-body); font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input { width: 100%; padding: 10px 14px 10px 38px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a59f' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center / 16px; backdrop-filter: blur(var(--blur)); outline: none; transition: border-color .2s, box-shadow .2s; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; max-height: 60vh; overflow: auto; padding: 6px; background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.search-results button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.search-results button:hover, .search-results button.sel { background: var(--accent-soft); }
.search-results .kind { margin-left: auto; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 999px; background: var(--surface-2); }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2.4s infinite; }
.sync.flash .dot { background: var(--accent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(94,156,122,.5); } 70% { box-shadow: 0 0 0 8px rgba(94,156,122,0); } 100% { box-shadow: 0 0 0 0 rgba(94,156,122,0); } }

.view { flex: 1; overflow: auto; padding: 12px 28px 40px; }
.view.no-pad { padding-bottom: 16px; overflow: hidden; display: flex; flex-direction: column; }

/* ============ Primitives ============ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; transition: transform .15s, background .2s, border-color .2s, box-shadow .2s; backdrop-filter: blur(8px); }
.btn:hover { background: var(--surface-solid); border-color: var(--border-strong); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 18px var(--accent-soft); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { color: var(--danger); }
.btn.icon { width: 34px; height: 34px; padding: 0; justify-content: center; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.panel { background: var(--surface); backdrop-filter: blur(var(--blur)) saturate(1.2); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.2); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
:root[data-glass="off"] .panel, :root[data-glass="off"] .card, :root[data-glass="off"] .sidebar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface-solid); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px var(--pad) 8px; }
.panel-head h3 { font-size: 15px; }
.panel-head .sub { color: var(--muted); font-size: 12.5px; }
.panel-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel-body { padding: 8px var(--pad) var(--pad); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.chip.cat { color: var(--text); background: color-mix(in srgb, var(--c) 18%, transparent); border-color: color-mix(in srgb, var(--c) 30%, transparent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
button.chip { cursor: pointer; }
button.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
button.chip.cat.on { background: var(--c); color: #fff; }

.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; background: color-mix(in srgb, var(--pc) 28%, var(--surface-solid)); border: 2px solid var(--surface-solid); flex: none; }
.avatar.lg { width: 34px; height: 34px; font-size: 17px; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -8px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; }
.seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }

.input, .select, textarea.input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface-solid); outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.spacer { flex: 1; }
.empty { padding: 28px 16px; text-align: center; color: var(--faint); font-size: 13px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

/* ============ Cards ============ */
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); cursor: grab; transition: transform .18s ease, box-shadow .18s ease, opacity .2s;
  flex-shrink: 0;
}
.mini, .li { flex-shrink: 0; }
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 14px 32px rgba(20,40,30,.1); }
.card.dragging { opacity: .35; }
.card.done .card-title { text-decoration: line-through; color: var(--muted); }
.card-cover { position: relative; height: 92px; background-size: cover; background-position: center; }
.card-cover .chip.cat { position: absolute; left: 8px; top: 8px; background: rgba(255,255,255,.82); backdrop-filter: blur(6px); color: #2a3430; border: 0; }
.card-cover .prio { position: absolute; right: 8px; top: 8px; }
.card-body { padding: 10px 12px 11px; display: flex; flex-direction: column; gap: 5px; }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; line-height: 1.3; }
.card-sum { color: var(--muted); font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; font-size: 12px; color: var(--muted); }
.card-meta .spacer { flex: 1; }
:root[data-cardstyle="compact"] .card-cover { display: none; }
:root[data-cardstyle="compact"] .card { border-left: 4px solid var(--c); }
:root[data-density="compact"] .card-cover { height: 64px; }
:root[data-density="compact"] .card-body { padding: 7px 10px 8px; gap: 3px; }

/* Claude progress dots */
.cprog { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px 2px 5px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; }
.cprog i { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 25%, transparent); }
.cprog i.on { background: var(--accent); }
.cprog .spark { font-style: normal; margin-right: 2px; }
.cprog.fresh { animation: glow 2s ease-in-out 3; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px var(--accent-soft); } }

/* mini card (calendar cells) */
.mini { display: flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 7px; font-size: 12px; font-weight: 500; line-height: 1.25; cursor: grab;
  background: color-mix(in srgb, var(--c) 16%, var(--surface-solid)); border-left: 3px solid var(--c); box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: transform .12s; }
.mini:hover { transform: translateX(2px); }
.mini .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.mini .tm { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.mini.done .t { text-decoration: line-through; opacity: .6; }
.mini .pd { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.mini.routine { background: transparent; border: 1px dashed var(--border-strong); border-left: 3px dashed var(--pc, var(--faint)); cursor: pointer; color: var(--muted); font-weight: 400; }

/* drop zones */
[data-drop].over { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft) !important; }

/* ============ Home ============ */
.hero { display: flex; align-items: flex-end; gap: 20px; margin: 6px 0 20px; }
.hero h1 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 6px 0 0; color: var(--muted); }
.hero .right { margin-left: auto; display: flex; gap: 8px; }
.widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); align-items: start; }
.widget.wide { grid-column: span 2; }
.widget[draggable="true"] { cursor: move; outline: 1.5px dashed var(--accent); outline-offset: 3px; }
.widget.hiddenw { opacity: .4; }
.list { display: flex; flex-direction: column; gap: 6px; }
.li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.li:hover { background: var(--surface-solid); border-color: var(--border); }
.li .em { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); flex: none; }
.li .tx { flex: 1; min-width: 0; }
.li .tx b { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .tx small { color: var(--muted); font-size: 12px; }
.li .when { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.li .when.late { color: var(--danger); font-weight: 600; }
.li .when.today { color: var(--accent); font-weight: 600; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.stat { padding: 16px var(--pad); }
.stat b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 12.5px; }

/* ============ Calendar ============ */
.cal-wrap { display: grid; grid-template-columns: 1fr 300px; gap: var(--gap); flex: 1; min-height: 0; }
:root[data-pool="left"] .cal-wrap { grid-template-columns: 300px 1fr; }
:root[data-pool="left"] .cal-wrap .pool { order: -1; }
.cal { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.cal-head h2 { font-size: 20px; min-width: 190px; letter-spacing: -0.02em; }
.cal-head h2 span { color: var(--muted); font-weight: 400; }
.dow { display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 10px; font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.dow div { padding: 4px 8px; }
.month { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(0, 1fr); gap: 6px; padding: 4px 10px 10px; min-height: 0; }
.day { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 6px; min-height: 0; overflow: hidden; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid transparent; transition: background .15s, border-color .15s; }
.day:hover { border-color: var(--border); background: var(--surface); }
.day.out { opacity: .45; }
.day.weekend { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.day .dn { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 2px 2px; font-variant-numeric: tabular-nums; }
.day.today .dn b { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 7px; }
.day .add { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--faint); font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 5px; }
.day:hover .add { opacity: 1; }
.day .add:hover { background: var(--accent-soft); color: var(--accent); }
.day .items { display: flex; flex-direction: column; gap: 3px; overflow: auto; scrollbar-width: none; }
.day .more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.week { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding: 4px 10px 10px; min-height: 0; }
.week .day { gap: 8px; padding: 10px 8px; }
.week .day .items { gap: 8px; }
.week .card-cover { height: 60px; }
.pool { display: flex; flex-direction: column; min-height: 0; }
.pool .panel-body { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 4px; border-radius: 0 0 var(--radius) var(--radius); }
.pool-hint { font-size: 12px; color: var(--faint); padding: 0 var(--pad) 8px; }

/* ============ Board ============ */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: var(--gap); flex: 1; min-height: 0; overflow-x: auto; }
.col { display: flex; flex-direction: column; min-height: 0; }
.col .panel-head { padding-bottom: 10px; }
.col .count { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.col-body { flex: 1; overflow: auto; padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 10px; border-radius: 0 0 var(--radius) var(--radius); }
.col .dotc { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

/* ============ Inventory ============ */
.inv-group { margin-bottom: 22px; }
.inv-group > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px 4px; font-family: var(--font-body); font-weight: 600; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.inv { padding: 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.inv:hover { transform: translateY(-2px); }
.inv.low { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.inv .top { display: flex; gap: 10px; align-items: center; }
.inv .em { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--surface-solid); border: 1px solid var(--border); flex: none; }
.inv .nm { font-weight: 600; font-family: var(--font-display); font-size: 14px; line-height: 1.25; }
.inv .loc { font-size: 12px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-solid); overflow: hidden; }
.stepper button { border: 0; background: none; width: 30px; height: 28px; cursor: pointer; font-size: 16px; color: var(--muted); }
.stepper button:hover { background: var(--accent-soft); color: var(--accent); }
.stepper span { min-width: 64px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.inv.low .meter i { background: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: var(--accent-soft); color: var(--accent); }

/* ============ Routines ============ */
.rt-wrap { display: grid; grid-template-columns: 1fr 320px; gap: var(--gap); align-items: start; }
.rt-list { display: flex; flex-direction: column; gap: 10px; }
.rt { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.rt .em { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 21px; background: var(--surface-solid); border: 1px solid var(--border); flex: none; }
.rt .tx { flex: 1; min-width: 0; cursor: pointer; }
.rt .tx b { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; }
.rt .tx small { display: block; color: var(--muted); font-size: 12.5px; }
.rt .due { min-width: 110px; text-align: right; }
.rt .due b { display: block; font-size: 13px; }
.rt .due small { color: var(--muted); font-size: 11.5px; }
.rt.overdue { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.rt.overdue .due b { color: var(--danger); }
.rt.today .due b { color: var(--accent); }
.rt .ring { --p: 0; width: 44px; height: 44px; border-radius: 50%; background: conic-gradient(var(--ringc, var(--accent)) calc(var(--p) * 1%), var(--surface-2) 0); display: grid; place-items: center; flex: none; }
.rt .ring > span { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-solid); display: grid; place-items: center; font-size: 18px; }
.rt .acts { display: flex; gap: 6px; }
.donebtn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-solid); cursor: pointer; font-size: 12.5px; font-weight: 500; transition: background .15s, transform .12s; }
.donebtn:hover { background: color-mix(in srgb, var(--pc) 18%, var(--surface-solid)); border-color: var(--pc); }
.donebtn:active { transform: scale(.95); }
.fair { display: flex; flex-direction: column; gap: 14px; }
.fair .bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.fair .bar i { display: block; height: 100%; transition: width .4s; }
.fair .legend { display: flex; justify-content: space-between; font-size: 12.5px; }

/* ============ Modal ============ */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 25, 20, 0.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(1080px, 100%); max-height: calc(100vh - 48px); overflow: hidden; display: flex; flex-direction: column; background: var(--surface-solid); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-lg); animation: pop .26s cubic-bezier(.2,.9,.3,1.2); }
.modal.sm { width: min(520px, 100%); }
.modal.md { width: min(680px, 100%); }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 10px; }
.modal-head h2 { font-size: 18px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 8px 22px 22px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; padding: 12px 22px 18px; border-top: 1px solid var(--border); }
.cm { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); flex: 1; min-height: 0; }
.cm-left { overflow: auto; padding: 0 0 22px; }
.cm-right { overflow: auto; background: color-mix(in srgb, var(--accent) 5%, var(--bg)); border-left: 1px solid var(--border); padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.cm-cover { position: relative; height: 200px; background-size: cover; background-position: center; }
.cm-cover .cover-actions { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; }
.cm-cover .cover-actions .btn { background: rgba(255,255,255,.85); color: #222; backdrop-filter: blur(6px); }
.cm-cover .x { position: absolute; right: 12px; top: 12px; background: rgba(255,255,255,.85); color: #222; }
.cm-form { padding: 16px 22px 0; display: flex; flex-direction: column; gap: 14px; }
.title-input { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; border: 0; background: transparent; outline: none; padding: 2px 0; width: 100%; }
.title-input:focus { box-shadow: inset 0 -2px 0 var(--accent-soft); }
.props { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.check input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.check input[type=text] { flex: 1; border: 0; background: transparent; outline: none; padding: 4px 2px; border-bottom: 1px solid transparent; }
.check input[type=text]:focus { border-bottom-color: var(--accent); }
.check.done input[type=text] { text-decoration: line-through; color: var(--muted); }
.check .del { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--faint); }
.check:hover .del { opacity: 1; }
.section-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.section-label .right { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }

/* Claude workspace */
.claude-head { display: flex; align-items: center; gap: 10px; }
.claude-logo { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: #d97757; color: #fff; flex: none; }
.claude-logo svg { width: 18px; height: 18px; }
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stage { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--faint); font-weight: 500; cursor: default; }
.stage i { height: 5px; border-radius: 99px; background: var(--border-strong); }
.stage.on { color: var(--text); cursor: pointer; }
.stage.on i { background: var(--accent); }
.stage.sel { color: var(--accent); }
.doc-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.doc-tabs button { border: 1px solid var(--border); background: var(--surface-solid); padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 12.5px; }
.doc-tabs button.on { background: var(--text); color: var(--bg); border-color: transparent; }
.doc { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; font-size: 13.5px; min-height: 120px; }
.prompt-box { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.prompt-box code { font-size: 12px; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; display: block; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.files a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 13px; }
.files a:hover { background: var(--surface-solid); }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1 { font-size: 18px; margin: 14px 0 8px; }
.md h2 { font-size: 15.5px; margin: 16px 0 6px; }
.md h3 { font-size: 14px; margin: 14px 0 6px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.md li.task { list-style: none; margin-left: -20px; }
.md li.task input { margin-right: 6px; accent-color: var(--accent); }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.md pre { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; overflow: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.md table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 12.5px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.md th { background: var(--surface-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

/* ============ Settings ============ */
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: var(--gap); align-items: start; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row > span { font-weight: 500; }
.set-row > span small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 54px; height: 54px; border-radius: 14px; border: 2px solid transparent; cursor: pointer; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.swatch.on { border-color: var(--text); }
.swatch span { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 600; color: #333; }
.color-in { width: 34px; height: 34px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 8px; }
.color-in::-webkit-color-swatch-wrapper { padding: 0; }
.color-in::-webkit-color-swatch { border: 1px solid var(--border); border-radius: 50%; }
.cat-row { display: grid; grid-template-columns: 52px 1fr 40px 34px; gap: 8px; align-items: center; margin-bottom: 6px; }
.cat-row .input { padding: 6px 9px; }
.toggle { position: relative; width: 40px; height: 23px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle i { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); cursor: pointer; transition: background .2s; }
.toggle i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(17px); }
.font-opt { display: flex; flex-direction: column; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface-solid); text-align: left; }
.font-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.font-opt b { font-size: 17px; }
.font-opt small { color: var(--muted); }
.fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }

/* ============ Toasts ============ */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 500; font-size: 13px; box-shadow: var(--shadow-lg); animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2); display: flex; gap: 10px; align-items: center; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .cal-wrap, .rt-wrap { grid-template-columns: 1fr; }
  .pool { max-height: 360px; }
  .view.no-pad { overflow: auto; }
  .month { min-height: 640px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .cm { grid-template-columns: 1fr; overflow: auto; }
  .cm-left, .cm-right { overflow: visible; }
}
@media (max-width: 720px) {
  body { overflow: auto; }
  .shell { grid-template-columns: 1fr; height: auto; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; flex-direction: row; padding: 8px; border-right: 0; border-top: 1px solid var(--border); }
  .brand, .nav-bottom .people-mini, .collapse-btn { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav span, .nav-settings span { display: none; }
  .nav-bottom { margin: 0; }
  .main { height: auto; min-height: 100vh; padding-bottom: 70px; }
  .topbar { flex-wrap: wrap; padding: 14px 16px 6px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .view { padding: 8px 16px 40px; overflow: visible; }
  .board { grid-template-columns: repeat(4, 80vw); }
  .props, .grid2, .grid3 { grid-template-columns: 1fr 1fr; }
  .set-grid { grid-template-columns: 1fr; }
  .month { grid-auto-rows: minmax(84px, auto); gap: 3px; padding: 4px; }
  .day { padding: 3px; }
  .mini { font-size: 10.5px; padding: 2px 4px; }
  .mini .tm { display: none; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero .right { margin-left: 0; }
  .overlay { padding: 0; }
  .modal { max-height: 100vh; border-radius: 0; height: 100%; }
}

/* sign-in (online version) */
.login { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login ~ .shell, body:has(.login) .shell { visibility: hidden; }
.login-box { width: min(360px, 100%); padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.login-box .brand-mark { width: 48px; height: 48px; border-radius: 16px; }
.login-box .input, .login-box .btn { width: 100%; justify-content: center; }
.login-err { min-height: 1.2em; margin: 0; color: #B4505A; font-size: 13px; }
