:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-weak: #eff6ff;
  --ok: #16a34a;
  --ok-weak: #ecfdf5;
  --warn: #d97706;
  --warn-weak: #fffbeb;
  --danger: #dc2626;
  --danger-weak: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .04);
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111a2c;
  --text: #e6edf7;
  --muted: #93a4bd;
  --line: #1f2b41;
  --accent: #60a5fa;
  --accent-weak: #15233c;
  --ok: #34d399;
  --ok-weak: #0f2a22;
  --warn: #fbbf24;
  --warn-weak: #2a2210;
  --danger: #f87171;
  --danger-weak: #2a1517;
  --shadow: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { width: min(1180px, 100% - 32px); margin: 0 auto; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50;
}
.skip:focus { left: 16px; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 24px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.brand__mark {
  width: 22px; height: 22px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
}
.brand__name { font-size: 16px; letter-spacing: -.01em; }

.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav__link {
  padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 500;
}
.nav__link:hover { color: var(--text); background: var(--accent-weak); }
.nav__link.is-active { color: var(--accent); background: var(--accent-weak); }

.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot[data-state="ok"] { background: var(--ok); }
.status-dot[data-state="bad"] { background: var(--danger); }
.status-text { font-size: 13px; color: var(--muted); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 15px;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Page head */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 28px 0 16px;
}
.eyebrow { margin: 0 0 4px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -.02em; }
.lead { margin: 6px 0 0; color: var(--muted); }

/* Chips and badges */
.chip {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}
.chip--demo { background: var(--warn-weak); color: var(--warn); }

.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--accent-weak); color: var(--accent);
}
.badge--ok { background: var(--ok-weak); color: var(--ok); }
.badge--warn { background: var(--warn-weak); color: var(--warn); }
.badge--danger { background: var(--danger-weak); color: var(--danger); }
.badge--ai { background: var(--accent-weak); color: var(--accent); }

/* KPI */
.kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.tile__label { margin: 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tile__value { margin: 8px 0 2px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.tile__value--ok { color: var(--ok); }
.tile__value--warn { color: var(--warn); }
.tile__value--danger { color: var(--danger); }
.tile__hint { margin: 0; font-size: 12px; color: var(--muted); }

/* Layout */
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; margin-top: 12px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-top: 12px;
}
.cols .panel { margin-top: 0; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel__head h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.ok { color: var(--ok); }

/* Attention list */
.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attention__row {
  display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
.attention__id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--muted); }
.attention__what { font-size: 14px; }

/* Feed */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.feed li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.feed__dot { width: 8px; height: 8px; border-radius: 50%; }
.feed__dot--ok { background: var(--ok); }
.feed__dot--new { background: var(--accent); }
.feed__dot--done { background: var(--muted); }

/* Filters */
.filters { display: flex; gap: 6px; }
.filter {
  height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
}
.filter:hover { border-color: var(--accent); color: var(--accent); }
.filter.is-active { background: var(--accent-weak); color: var(--accent); border-color: transparent; }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg); }

/* Mobile cards */
.cards-mobile { display: none; }

/* Tasks / KV */
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tasks li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.kv { margin: 0; display: grid; gap: 10px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

.empty { margin: 12px 0 0; padding: 16px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }

/* Footer */
.footer { border-top: 1px solid var(--line); margin-top: 28px; padding: 18px 0 80px; }
.footer__inner { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }

/* Tabbar (mobile) */
.tabbar { display: none; }

@media (max-width: 900px) {
  .kpi { grid-template-columns: repeat(2, 1fr); }
  .activity__grid { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar__inner { height: 56px; gap: 12px; }
  .nav { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; padding: 20px 0 12px; }
  h1 { font-size: 22px; }
  .table-wrap { display: none; }
  .cards-mobile { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
  .lead-card {
    border: 1px solid var(--line); border-radius: 10px; padding: 12px;
    display: grid; gap: 8px; background: var(--bg);
  }
  .lead-card__top { display: flex; justify-content: space-between; align-items: center; }
  .lead-card__title { font-weight: 600; }
  .lead-card__meta { display: flex; gap: 8px; flex-wrap: wrap; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar__item {
    display: grid; justify-items: center; gap: 2px;
    font-size: 11px; color: var(--muted); padding: 6px 0; border-radius: 8px;
    min-height: 44px; align-content: center;
  }
  .tabbar__item.is-active { color: var(--accent); }
  .footer { padding-bottom: 96px; }
}

/* Hero with progress */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: stretch;
  margin: 20px 0 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(900px 300px at 10% -20%, rgba(37, 99, 235, .12), transparent 60%),
    radial-gradient(600px 240px at 100% 0%, rgba(34, 211, 238, .10), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: auto -60px -120px auto;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(37, 99, 235, .16), transparent 60%);
  pointer-events: none;
}
.hero__text { position: relative; z-index: 1; display: grid; align-content: center; gap: 10px; }
.hero h1 { font-size: 34px; letter-spacing: -.03em; }
.hero .lead { font-size: 16px; max-width: 52ch; }
.hero__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip--soft { background: var(--accent-weak); color: var(--accent); }

.progress {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(6px);
}
.progress__ring { position: relative; width: 132px; height: 132px; }
.progress__ring svg { width: 132px; height: 132px; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--line); stroke-width: 10; }
.ring__value {
  fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 78;
  transition: stroke-dashoffset .8s ease;
}
.progress__num {
  position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center;
  padding-top: 46px;
  font-size: 30px; font-weight: 700; letter-spacing: -.03em;
}
.progress__num small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 2px; align-self: center; }
.progress__title { margin: 0 0 2px; font-weight: 600; }
.progress__list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 7px; }
.progress__item { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); line-height: 1.35; }
.progress__item > span:first-child { min-width: 0; }
.progress__bar { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #22d3ee); border-radius: 999px; }

/* Activity windows */
.activity { margin: 12px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.activity__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.activity__head h2 { margin: 0; font-size: 16px; }
.activity__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.activity__card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg); }
.activity__period { margin: 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.activity__value { margin: 6px 0 2px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.activity__hint { margin: 0; font-size: 12px; color: var(--muted); }
.activity__delta { color: var(--ok); }

/* Subtle depth on cards */
.tile, .panel { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.tile:hover, .panel:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.tile { position: relative; overflow: hidden; }
.tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), #22d3ee); opacity: .55;
}
.tile:nth-child(2)::before { background: linear-gradient(180deg, var(--warn), #f59e0b); }
.tile:nth-child(3)::before { background: linear-gradient(180deg, var(--ok), #34d399); }
.tile:nth-child(4)::before { background: linear-gradient(180deg, var(--danger), #f87171); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 20px; }
  .hero h1 { font-size: 28px; }
  .progress { grid-template-columns: 112px 1fr; }
  .progress__ring, .progress__ring svg { width: 112px; height: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* SITE-101: anchor offset under sticky topbar, smooth scroll */
html{scroll-behavior:smooth}
@media (max-width:720px){section[id]{scroll-margin-top:64px}}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
/* SITE-101: mobile + a11y */
:focus-visible{box-shadow:0 0 0 2px var(--accent); border-radius:6px}
.tile__value{font-variant-numeric:tabular-nums}
.badge--sla{white-space:nowrap}
@media(max-width:720px){.lead-card__title{font-size:15px; line-height:1.3}.filter{min-height:36px}}
@media(max-width:380px){.tabbar__item{font-size:10px}.kpi{gap:8px}}
/* SITE-101-r2 */
.tabbar{padding-bottom:env(safe-area-inset-bottom)}
.table-wrap{overflow-x:auto}
table.leads{min-width:720px}
a,button,.tabbar__item,.badge,.tile{-webkit-tap-highlight-color:transparent}
@media(max-width:720px){body{overflow-x:hidden}.tile__value{font-size:20px}.empty{padding:24px 12px}}
/* WORK-002 design v2: hero, icons, progress, hovers */
.hero{position:relative;overflow:hidden;background:radial-gradient(120% 140% at 0% 0%, color-mix(in srgb,var(--accent) 16%,transparent), transparent 55%), radial-gradient(90% 120% at 100% 0%, rgba(34,211,238,.14), transparent 60%), var(--surface)}
.hero::after{content:"";position:absolute;inset:auto -40px -70px auto;width:240px;height:240px;border-radius:50%;background:radial-gradient(circle, rgba(34,211,238,.18), transparent 65%);pointer-events:none}
.hero__actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.btn{display:inline-flex;align-items:center;gap:8px;min-height:40px;padding:0 16px;border-radius:10px;font-size:14px;font-weight:600;text-decoration:none;cursor:pointer;border:1px solid transparent;transition:transform .18s ease,box-shadow .18s ease,background .18s ease}
.btn--accent{background:linear-gradient(135deg,var(--accent),#22d3ee);color:#fff;box-shadow:0 8px 20px -10px var(--accent)}
.btn--accent:hover{transform:translateY(-1px);box-shadow:0 12px 24px -10px var(--accent)}
.btn--ghost{border-color:var(--line);color:var(--fg);background:transparent}
.btn--ghost:hover{border-color:color-mix(in srgb,var(--accent) 40%,var(--line));background:var(--accent-weak)}
.btn__count{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:var(--accent-weak);color:var(--accent);font-size:12px}
.progressbar{height:8px;border-radius:999px;background:var(--accent-weak);overflow:hidden;margin-top:10px}
.progress__bar{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--accent),#22d3ee);transition:width .5s ease}
.progress__label{display:flex;justify-content:space-between;font-size:12px;color:var(--muted);margin-top:6px}
@media(max-width:720px){.hero__actions .btn{flex:1 1 46%;justify-content:center}.tile__icon{width:26px;height:26px}}
@media (prefers-reduced-motion: reduce){.tile:hover{transform:none}.progress__bar{transition:none}}

/* v2 hero+kpi */
.hero{position:relative;overflow:hidden;border-radius:24px;padding:clamp(20px,3vw,36px);background:radial-gradient(120% 140% at 100% 0%,rgba(34,211,238,.16),transparent 60%),radial-gradient(100% 120% at 0% 0%,rgba(37,99,235,.14),transparent 55%),var(--surface,#fff)}
.hero h1{letter-spacing:-.02em;text-wrap:balance}
.hero .chip--soft{border:1px solid rgba(37,99,235,.18)}
.hero__actions .btn{transition:transform .18s ease,box-shadow .18s ease}
.hero__actions .btn:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(37,99,235,.22)}
.tile{position:relative;transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease}
.tile:hover{transform:translateY(-3px);box-shadow:0 14px 30px rgba(15,23,42,.10)}
.tile__icon{display:inline-flex;transition:transform .18s ease,background .18s ease;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;background:rgba(37,99,235,.10);color:var(--accent,#2563eb);margin-bottom:8px}
.tile--wait .tile__icon{background:rgba(245,158,11,.14);color:#b45309}
.tile--ai .tile__icon{background:rgba(16,185,129,.14);color:#047857}
.tile--late .tile__icon{background:rgba(239,68,68,.14);color:#b91c1c}
.tile__icon svg{width:18px;height:18px}
.progress__ring .ring__value{transition:stroke-dashoffset .8s ease}
.tile:hover .tile__icon{transform:translateY(-1px) scale(1.06)}
.hero__tags .chip--soft:hover{background:rgba(37,99,235,.08);border-color:rgba(37,99,235,.35)}

/* WORK-002-r2: reduced-motion guard for v2 animations */
@media (prefers-reduced-motion: reduce){
  .btn,.hero__actions .btn,.tile,.tile__icon,.progress__bar,.progress__ring .ring__value{transition:none}
  .btn:hover,.hero__actions .btn:hover,.tile:hover,.tile:hover .tile__icon{transform:none}
}
/* WORK-002-r3: icon contrast (WCAG AA) */
.tile--wait .tile__icon{color:#8a4b06}
.tile--ai .tile__icon{color:#055f45}
.tile--late .tile__icon{color:#9f1010}
