/* CRM1080 — hand-written design system. One file, no build step. */
:root {
  --navy: #1f3864;
  --navy-2: #2a4a8c;
  --accent: #2f6fed;
  --accent-soft: #e8efff;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #1a1f36;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --green: #16a34a; --green-soft: #dcfce7;
  --amber: #d97706; --amber-soft: #fef3c7;
  --red: #dc2626; --red-soft: #fee2e2;
  --purple: #7c3aed; --purple-soft: #ede9fe;
  --teal: #0d9488; --teal-soft: #ccfbf1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .14);
  --sidebar-w: 236px;
  --topbar-h: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.muted { font-size: .9rem; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 6px; z-index: 100; }
.linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--navy); color: #e6ecf7;
  display: flex; flex-direction: column; padding: 18px 14px; z-index: 40; transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 9px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 26px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #c9d4ea; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.nav .ic { width: 20px; text-align: center; opacity: .9; }
.nav .count { margin-left: auto; background: var(--amber); color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; gap: 10px; align-items: center; color: #fff; }
.me:hover { text-decoration: none; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me-text strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: #aebbd6; font-size: .75rem; }
.sidebar-foot .linklike { color: #aebbd6; font-size: .85rem; text-align: left; }
.sidebar-foot .linklike:hover { color: #fff; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); margin-left: var(--sidebar-w);
  background: rgba(244,246,250,.9); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  border-bottom: 1px solid var(--border);
}
.brand-mobile { display: none; color: var(--navy); font-size: 1.05rem; }
.menu-toggle { display: none; }
.search { flex: 1; max-width: 520px; }
.search .input { width: 100%; background: #fff; }
.new-menu { margin-left: auto; }
.main { margin-left: var(--sidebar-w); padding: 22px 24px 60px; max-width: 1400px; }
.auth-main { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.tabbar { display: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .topbar { margin-left: 0; padding: 0 12px; gap: 8px; }
  .brand-mobile { display: flex; }
  .menu-toggle { display: inline-flex; }
  .search { max-width: none; }
  .new-menu summary { padding: 8px 10px; }
  .main { margin-left: 0; padding: 14px 12px 84px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); }
  .tabbar a span { font-size: 1.15rem; line-height: 1; }
  .tabbar a.on { color: var(--navy); font-weight: 600; }
}
@media (max-width: 600px) { .search { display: none; } .topbar .search.open { display: block; } }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: #fff; color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--red); border-color: #fecaca; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 7px; }
.btn.xs { padding: 2px 8px; font-size: .75rem; border-radius: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.iconbtn { background: none; border: 1px solid var(--border-strong); border-radius: 8px; width: 36px; height: 36px; font-size: 1.1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
summary { list-style: none; cursor: pointer; } summary::-webkit-details-marker { display: none; }
.dropdown { position: relative; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 170px; padding: 6px; z-index: 50; display: flex; flex-direction: column; }
.dropdown-panel a, .dropdown-panel button { padding: 8px 10px; border-radius: 7px; color: var(--text); text-align: left; background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown-panel a:hover, .dropdown-panel button:hover { background: var(--bg); text-decoration: none; }
.dropdown-panel .danger { color: var(--red); }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.tight { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card.tight .card-head { padding: 14px 18px 0; margin-bottom: 8px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4, .grid-main, .grid-detail { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.empty { color: var(--muted); padding: 24px; text-align: center; font-size: .95rem; }
.empty.sm { padding: 10px 0; text-align: left; }

/* ---------- KPIs ---------- */
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi .value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.kpi .hint { color: var(--muted); font-size: .82rem; }
.kpi.warn .value { color: var(--amber); }
.kpi.good .value { color: var(--green); }

/* ---------- Bars ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 140px; gap: 10px; align-items: center; font-size: .9rem; }
a.bar-row { padding: 3px 6px; margin: 0 -6px; border-radius: 8px; }
.see-all { padding: 12px 18px; border-top: 1px solid var(--border); }
.card:not(.tight) .see-all { border-top: 0; padding: 12px 0 0; }
.table.compact th, .table.compact td { padding: 8px 10px; font-size: .86rem; }
.grid-3 .bar-row { grid-template-columns: 96px 1fr 100px; font-size: .84rem; }
a.bar-row:hover { background: var(--bg); text-decoration: none; }
.table td a.row:hover { text-decoration: none; }
.bar-row .lbl { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; min-width: 2px; }
.bar.s-lead > i { background: #93a4c7; } .bar.s-qualified > i { background: #7aa7f0; } .bar.s-discovery > i { background: #5b8def; }
.bar.s-proposal > i { background: #8b5cf6; } .bar.s-negotiation > i { background: #f59e0b; } .bar.s-contracting > i { background: #10b981; }
@media (max-width: 600px) { .bar-row { grid-template-columns: 100px 1fr 90px; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfd; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table a.strong { color: var(--text); font-weight: 600; }
.table a.strong:hover { color: var(--accent); }
.table .sort { color: inherit; }
.input.xs { padding: 4px 8px; font-size: .8rem; border-radius: 6px; min-width: 70px; }
/* Excel-style column menus */
.colhead { position: relative; display: inline-block; }
.colmenu-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.colmenu-btn:hover .collabel { color: var(--navy); }
.colmenu-btn .caret { color: #9ca3af; font-size: .7rem; }
.colmenu-btn .arrow, .colmenu-btn .funnel { color: var(--accent); font-size: .75rem; }
th.col-active .collabel { color: var(--navy); }
.colmenu { position: fixed; z-index: 60; min-width: 230px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .86rem; color: var(--text); }
.colmenu-item { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.colmenu-item:hover { background: var(--bg); text-decoration: none; }
.colmenu-item.on { background: var(--accent-soft); color: var(--navy); font-weight: 600; }
.colmenu-sep { border-top: 1px solid var(--border); margin: 6px 0; }
.colmenu-filter { padding: 4px 6px; }
.colmenu-filter .input.xs { width: 100%; }
.colmenu-list { max-height: 220px; overflow: auto; margin-top: 2px; border-top: 1px solid var(--border); padding-top: 4px; }
.colmenu-check { display: flex; gap: 8px; align-items: center; padding: 4px 4px; cursor: pointer; }
.colmenu-check input { width: 15px; height: 15px; accent-color: var(--navy); }
.colmenu-check.all { font-weight: 600; }
.colmenu-actions { display: flex; gap: 6px; justify-content: flex-end; padding: 8px 6px 2px; border-top: 1px solid var(--border); margin-top: 6px; }
caption.active-filters { caption-side: top; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fafbfd; font-size: .85rem; }
.active-filters-inner { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fchip { display: inline-flex; gap: 4px; align-items: center; background: var(--accent-soft); color: var(--navy); border-radius: 999px; padding: 2px 6px 2px 10px; }
.fchip-x { border: 0; background: none; color: var(--navy); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 4px; }

.table .actions { text-align: right; white-space: nowrap; }
.list-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); gap: 10px; flex-wrap: wrap; }
.pager { display: flex; gap: 4px; }
.pager a, .pager span { padding: 4px 9px; border-radius: 6px; border: 1px solid var(--border); color: var(--text); }
.pager span.cur { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; }
.filters .input[type=search] { min-width: 220px; flex: 1; max-width: 360px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.seg a, .seg button { padding: 6px 12px; font-size: .85rem; font-weight: 600; color: var(--muted); border: 0; background: none; cursor: pointer; font-family: inherit; }
.seg a.on, .seg button.on { background: var(--navy); color: #fff; }
.seg a:hover { text-decoration: none; }

/* ---------- Badges / chips / avatars ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--bg); color: var(--muted); }
.b-blue { background: var(--accent-soft); color: #1d4ed8; } .b-green { background: var(--green-soft); color: #15803d; }
.b-grey { background: #eef0f4; color: #4b5563; } .b-red { background: var(--red-soft); color: #b91c1c; }
.b-amber { background: var(--amber-soft); color: #b45309; } .b-purple { background: var(--purple-soft); color: #6d28d9; }
.b-teal { background: var(--teal-soft); color: #0f766e; }
.badge.s-lead { background: #eef0f4; color: #4b5563; } .badge.s-qualified { background: #e0ecff; color: #1d4ed8; }
.badge.s-discovery { background: #dbeafe; color: #1e40af; } .badge.s-proposal { background: var(--purple-soft); color: #6d28d9; }
.badge.s-negotiation { background: var(--amber-soft); color: #b45309; } .badge.s-contracting { background: var(--teal-soft); color: #0f766e; }
.badge.s-won { background: var(--green-soft); color: #15803d; } .badge.s-lost { background: var(--red-soft); color: #b91c1c; }
.badge.stale { background: var(--amber-soft); color: #b45309; }
.badge.private { background: #f3f4f6; color: #6b7280; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-soft); color: var(--navy); font-weight: 700; flex: none; }
.avatar.s { width: 26px; height: 26px; font-size: .7rem; } .avatar.m { width: 34px; height: 34px; font-size: .8rem; } .avatar.l { width: 52px; height: 52px; font-size: 1.1rem; }
.sidebar .avatar { background: rgba(255,255,255,.18); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--text); }
.chip small { color: var(--muted); }
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--text); }

/* ---------- Forms ---------- */
.form-card { max-width: 880px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: .82rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.field .err { color: var(--red); font-size: .8rem; margin-top: 3px; }
.input { width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; font-size: .93rem; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid rgba(47,111,237,.35); border-color: var(--accent); }
.input.textarea { resize: vertical; min-height: 80px; }
select.input { appearance: auto; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.check-list li label { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: .9rem; }
.check-list input, .check { width: 16px; height: 16px; accent-color: var(--navy); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.fieldset-title { grid-column: 1 / -1; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-top: 6px; }
.errorlist { color: var(--red); font-size: .85rem; margin: 0 0 10px; padding-left: 16px; }
.dedupe { margin-top: 8px; }
.dedupe .warn-box { background: var(--amber-soft); border: 1px solid #fcd34d; border-radius: 8px; padding: 10px 12px; font-size: .88rem; }
.dedupe ul { margin: 6px 0 0; padding-left: 16px; }

/* ---------- Detail pages ---------- */
.record-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.record-head .title { flex: 1; min-width: 240px; }
.record-head h1 { margin-bottom: 2px; }
.record-meta { display: flex; gap: 8px 14px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; align-items: center; }
.props { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: .92rem; }
.props dt { color: var(--muted); } .props dd { margin: 0; word-break: break-word; }
.props dd.empty-v { color: #c0c5ce; }
.props .prop-note { grid-column: 1 / -1; display: grid; grid-template-columns: inherit; gap: inherit; background: var(--bg); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin: 0 0 4px; }
.props .prop-note dt { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; grid-column: 1 / -1; }
.props .prop-note dd { grid-column: 1 / -1; }
@media (max-width: 500px) { .props { grid-template-columns: 110px 1fr; } }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.listy { list-style: none; margin: 0; padding: 0; }
.listy li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.listy li:last-child { border-bottom: 0; }
.listy .grow { flex: 1; min-width: 0; }
.listy .grow .sub { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listy a.strong { color: var(--text); font-weight: 600; }
.status-summary { border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; font-size: .92rem; white-space: normal; }
.status-summary.private { border-color: var(--amber); background: var(--amber-soft); }
.private-note { color: var(--muted); font-size: .85rem; padding: 8px 0; display: flex; gap: 6px; align-items: center; }

/* Stage strip on deal detail */
.stage-strip { display: flex; gap: 4px; margin: 6px 0 14px; flex-wrap: wrap; }
.stage-strip form { display: contents; }
.stage-strip button { flex: 1; min-width: 90px; padding: 7px 8px; font: inherit; font-size: .78rem; font-weight: 600; border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer; border-radius: 6px; }
.stage-strip button.done { background: var(--accent-soft); border-color: #c7d7fb; color: var(--navy); }
.stage-strip button.cur { background: var(--navy); border-color: var(--navy); color: #fff; }
.stage-strip button:hover:not(.cur) { border-color: var(--accent); color: var(--accent); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 6px 0 0; max-height: 440px; overflow-y: auto; scrollbar-gutter: stable; }
.timeline li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .tl-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: .95rem; }
.timeline .tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: .92rem; }
.timeline .tl-head strong { font-weight: 600; }
.timeline .tl-body { white-space: pre-wrap; font-size: .9rem; color: #374151; margin-top: 3px; }
.timeline .tl-meta { color: var(--muted); font-size: .8rem; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.timeline .origin { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; font-size: .75rem; }
.timeline li.task-done .tl-head strong { text-decoration: line-through; color: var(--muted); }
.timeline li.overdue .tl-ic { background: var(--red-soft); }
.log-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- Tasks ---------- */
.task-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row form.toggle button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; cursor: pointer; margin-top: 2px; }
.task-row form.toggle button.done { background: var(--green); border-color: var(--green); color: #fff; font-size: .75rem; }
.task-row .grow { flex: 1; min-width: 0; }
.task-row .t-title { font-weight: 600; font-size: .93rem; }
.task-row .t-sub { color: var(--muted); font-size: .82rem; display: flex; gap: 8px; flex-wrap: wrap; }
.task-row .due { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.task-row .due.over { color: var(--red); } .task-row .due.today { color: var(--amber); }
.task-row.done .t-title { text-decoration: line-through; color: var(--muted); }
.task-row .flag, .todo-row .flag { color: var(--red); font-size: .9em; margin-right: 4px; }

/* Dashboard to-do: one shaded row per task, the whole row opens the record */
.todo { display: flex; flex-direction: column; gap: 8px; }
.todo-row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; border: 1px solid transparent; border-left-width: 4px; }
.todo-row.later { background: #f1f6ff; border-color: #dbe7ff; border-left-color: var(--accent); }
.todo-row.today { background: #fffbe6; border-color: #fdecb0; border-left-color: var(--amber); }
.todo-row.over { background: #fff3f3; border-color: #fdd5d5; border-left-color: var(--red); }
.todo-row.done { background: #f6f7f9; border-color: #e5e7eb; border-left-color: #c0c5ce; }
.todo-row .grow { flex: 1; min-width: 0; }
.todo-row .t-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.todo-row .t-name { font-weight: 650; font-size: .95rem; color: var(--text); text-decoration: underline; text-decoration-color: rgba(0,0,0,.18); text-underline-offset: 3px; }
.todo-row .t-name:hover { color: var(--accent); text-decoration-color: currentColor; }
.todo-row.done .t-name { text-decoration: line-through; color: var(--muted); }
.todo-row .t-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: .8rem; color: var(--navy); background: #fff; border: 1px solid rgba(0,0,0,.12); border-radius: 999px; padding: 2px 10px 2px 4px; }
.todo-row .t-chip:hover { border-color: var(--accent); color: var(--accent); }
.todo-row .t-chip .k { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 1px 6px; }
.todo-row .t-sub { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.todo-row .due { font-size: .8rem; font-weight: 700; white-space: nowrap; color: var(--accent); }
.todo-row.today .due { color: #b45309; } .todo-row.over .due { color: var(--red); } .todo-row.done .due { color: var(--muted); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 14px; right: 14px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { background: var(--text); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .9rem; animation: toast-in .2s ease; }
.toast.success { background: #166534; } .toast.error { background: #991b1b; } .toast.info { background: var(--navy); } .toast.warning { background: #92400e; }
.toast.hide { opacity: 0; transition: opacity .4s; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Auth ---------- */
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card .brand { color: var(--navy); justify-content: center; margin-bottom: 18px; font-size: 1.3rem; }
.auth-card .btn { width: 100%; justify-content: center; }

/* ---------- Misc ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--navy); border-color: var(--navy); }
.tabs a:hover { text-decoration: none; color: var(--navy); }
.inline-form { display: inline; }
.kv { font-size: .85rem; color: var(--muted); }
.kv b { color: var(--text); font-weight: 600; }
.search-group h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.notice { background: var(--accent-soft); border: 1px solid #c7d7fb; color: var(--navy); border-radius: 10px; padding: 10px 14px; font-size: .9rem; }
.danger-zone { border-color: #fecaca; }
pre.json { background: var(--bg); padding: 8px; border-radius: 6px; font-size: .78rem; max-width: 460px; white-space: pre-wrap; word-break: break-word; margin: 0; }

/* ---------- Detail card edit mode ---------- */
.panel-form .form-grid { gap: 10px 14px; }
.panel-form .field label { font-size: .78rem; }
.panel-form .input { font-size: .9rem; padding: 7px 10px; }
.panel-form .form-actions { margin-top: 14px; padding-top: 12px; }
