:root {
  --bg: #f4f7f9;
  --panel: #ffffff;
  --ink: #0f1f2a;
  --ink-2: #44566a;
  --muted: #7a8a9a;
  --line: #e3e9ef;
  --brand: #0b7a75;
  --brand-2: #0f4c5c;
  --brand-soft: #e3f4f2;
  --side: #0c2f3a;
  --side-ink: #b8ccd3;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --b2b: #2563eb;
  --direct: #db2777;
  --research: #059669;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 31, 42, .05), 0 1px 8px rgba(15, 31, 42, .04);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #14b8a6, #0ea5e9); display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; }
.logo b { display: block; font-size: 15px; }
.logo span { font-size: 11px; color: var(--side-ink); letter-spacing: .04em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: var(--side-ink); font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(20, 184, 166, .18); color: #fff; }
.nav .sep { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #6f8c96; padding: 16px 12px 6px; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding: 12px 6px 0; font-size: 12.5px; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot form { margin-top: 8px; }
.side-foot button { all: unset; cursor: pointer; display: flex; gap: 8px; align-items: center; color: var(--side-ink); }
.side-foot button:hover { color: #fff; }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 28px 0; flex-wrap: wrap; }
.top .sub { color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.content { padding: 18px 28px 40px; }
.btn.menu-btn { display: none; }

/* ---------- elements ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c9d4de; text-decoration: none; background: #fafcfd; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: #096a66; }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn svg.i { width: 16px; height: 16px; }
.inline { display: inline; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 0; }
.card-b { padding: 14px 16px 16px; }
.card-h a { font-size: 12.5px; }

.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.mt { margin-top: 16px; }

.kpi { padding: 16px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--ink-2); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 7px; }
.kpi .val { font-size: 26px; font-weight: 750; margin-top: 6px; letter-spacing: -.02em; }
.kpi .val small { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.kpi .foot { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi .ico svg.i { width: 16px; height: 16px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #eef2f6; color: var(--ink-2); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cat-b2b { background: #e8effe; color: var(--b2b); }
.cat-direct { background: #fde8f2; color: var(--direct); }
.cat-research { background: #e2f5ee; color: var(--research); }
.tag-red { background: #fde8e8; color: var(--danger); }
.tag-amber { background: #fdf2dc; color: var(--warn); }
.tag-green { background: #e3f6e9; color: var(--ok); }

.seg { display: inline-flex; background: #e9eef3; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 550; font-size: 13px; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* category cards */
.catcard { padding: 16px; border-top: 3px solid var(--c); }
.catcard .row { display: flex; justify-content: space-between; align-items: baseline; }
.catcard .big { font-size: 22px; font-weight: 750; }
.catcard dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 12px 0 0; font-size: 13px; }
.catcard dt { color: var(--ink-2); }
.catcard dd { margin: 0; font-weight: 600; text-align: right; }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.f-row { display: grid; grid-template-columns: 190px 1fr 120px; align-items: center; gap: 12px; color: inherit; }
.f-row:hover { text-decoration: none; }
.f-row:hover .f-bar { filter: brightness(.95); }
.f-label { font-weight: 550; font-size: 13px; }
.f-track { background: #f0f4f7; border-radius: 7px; height: 30px; position: relative; }
.f-bar { height: 100%; border-radius: 7px; background: var(--c); min-width: 34px; display: flex; align-items: center; padding: 0 10px; color: #fff; font-weight: 700; font-size: 12.5px; }
.f-val { text-align: right; font-size: 12.5px; color: var(--ink-2); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; }
.list .s { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafcfd; white-space: nowrap; position: sticky; top: 0; }
table.t th a { color: inherit; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:hover td { background: #fafcfd; }
table.t td.r, table.t th.r { text-align: right; }
table.t td.code, table.t td.r, table.t td.nowrap { white-space: nowrap; }
table.t .main-cell { font-weight: 600; color: var(--ink); }
table.t .sub-cell { color: var(--muted); font-size: 12px; }
tfoot td { font-weight: 700; background: #fafcfd; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar select, .toolbar input { height: 34px; width: auto; }

/* forms */
label { display: block; font-weight: 550; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid #d5dee6; border-radius: 9px; font: inherit; color: var(--ink); background: #fff;
}
textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11, 122, 117, .25); border-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
.form-section { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; grid-column: 1 / -1; margin-top: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--ink); }
.radio-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-cards label { margin: 0; flex: 1; min-width: 120px; border: 1px solid #d5dee6; border-radius: 9px; padding: 9px 12px; cursor: pointer; display: flex; gap: 8px; align-items: center; color: var(--ink); }
.radio-cards input { accent-color: var(--brand); }
.radio-cards label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* flash */
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; border: 1px solid; }
.flash.success { background: #ecfbf1; border-color: #bfe9cd; color: #166534; }
.flash.error { background: #fdeeee; border-color: #f5c6c6; color: #991b1b; }
.flash.warning, .flash.info { background: #fff8e8; border-color: #f3dfaa; color: #854d0e; }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eaf0f4; border-radius: var(--radius); padding: 10px; min-height: 300px; display: flex; flex-direction: column; gap: 8px; }
.col.drop { outline: 2px dashed var(--brand); background: var(--brand-soft); }
.col-h { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px; border-bottom: 3px solid var(--c); }
.col-h b { font-size: 13px; }
.col-h small { font-weight: 600; }
.deal-card { background: #fff; border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); border: 1px solid var(--line); cursor: grab; display: block; color: inherit; }
.deal-card:hover { border-color: #b9c8d4; text-decoration: none; }
.deal-card .dc-t { font-weight: 650; font-size: 13px; }
.deal-card .dc-s { color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.deal-card .dc-f { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); gap: 6px; }
.deal-card.dragging { opacity: .5; }

/* detail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 12.5px; }
dl.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.stepper { display: flex; gap: 4px; flex-wrap: wrap; }
.stepper form { flex: 1; min-width: 110px; }
.stepper button { width: 100%; border: 0; background: #edf1f5; color: var(--ink-2); padding: 8px 6px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; border-radius: 6px; }
.stepper button:hover:not(:disabled) { background: #dfe7ee; }
.stepper button.done { background: color-mix(in srgb, var(--c) 18%, white); color: var(--ink); }
.stepper button.cur { background: var(--c); color: #fff; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tdot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--brand-soft); border: 2px solid var(--brand); }
.timeline .meta { color: var(--muted); font-size: 12px; }
.timeline .next { margin-top: 4px; font-size: 12.5px; background: #fff8e8; border-radius: 6px; padding: 4px 8px; display: inline-block; }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: var(--muted); }
.pager .btns { display: flex; gap: 6px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(circle at 20% 20%, #14b8a6 0, transparent 45%), radial-gradient(circle at 80% 70%, #0ea5e9 0, transparent 45%), var(--side); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 34px; line-height: 1.15; max-width: 440px; }
.login-art p { color: #cde3e8; max-width: 420px; font-size: 15px; }
.login-box { display: grid; place-items: center; padding: 32px; }
.login-box form { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.login-box .btn { height: 42px; justify-content: center; }

.chart-box { position: relative; height: 260px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pill-count { background: #e9eef3; border-radius: 999px; padding: 0 8px; font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.overdue { color: var(--danger); font-weight: 600; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.notice { background: var(--brand-soft); border: 1px solid #bfe3df; border-radius: 10px; padding: 12px 14px; }
.notice code { background: #fff; padding: 1px 6px; border-radius: 5px; }

/* responsive */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; width: 250px; left: -260px; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .btn.menu-btn { display: inline-flex; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .f-row { grid-template-columns: 1fr; gap: 4px; }
  .f-val { text-align: left; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
}
@media (max-width: 520px) { .g-4 { grid-template-columns: 1fr; } }
@media print { .side, .top-actions, .toolbar { display: none; } .shell { display: block; } }
