/* me2 — premium command center UI. Light default; [data-theme="dark"] switches.
   Accent (--primary) is overridable at runtime from settings.accent. */
:root {
  --canvas: #f1f1f2;
  --background: #ffffff;
  --foreground: #1a1a1a;
  --card: #ffffff;
  --muted: #f4f4f5;
  --hover: #ededee;
  --muted-foreground: #6b7280;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --input: #cbcbd1;
  --ring: #1a1a1a;
  --primary: #6366f1;
  --primary-foreground: #ffffff;
  --btn: #1f1f23;
  --btn-hover: #000000;
  --btn-foreground: #ffffff;
  --sidebar: #fafafa;
  --green: #16a34a; --red: #dc2626; --amber: #d97706; --blue: #2563eb;
  --radius: 9px;
  --radius-card: 14px;
  --shadow-sm: 0 1px 0 rgb(0 0 0 / .04), 0 1px 2px rgb(0 0 0 / .04);
  --shadow-card: 0 0 0 1px rgb(0 0 0 / .02), 0 1px 3px rgb(0 0 0 / .05);
  --shadow-lg: 0 18px 48px -12px rgb(0 0 0 / .28);
  --btn-shadow: inset 0 1px 0 rgb(255 255 255 / .15), 0 1px 2px rgb(0 0 0 / .14);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --canvas: #161618; --background: #232327; --foreground: #e7e7ea;
  --card: #1f1f23; --muted: #26262b; --hover: #2d2d33; --muted-foreground: #a1a1aa;
  --border: #303036; --border-strong: #3f3f46; --input: #45454d; --ring: #e7e7ea;
  --btn: #e7e7ea; --btn-hover: #ffffff; --btn-foreground: #18181b;
  --sidebar: #19191c;
  --green: #4ade80; --red: #f87171; --amber: #fbbf24; --blue: #60a5fa;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .4);
  --shadow-card: 0 0 0 1px rgb(255 255 255 / .03), 0 1px 3px rgb(0 0 0 / .4);
  --shadow-lg: 0 18px 48px -12px rgb(0 0 0 / .7);
  --btn-shadow: 0 1px 2px rgb(0 0 0 / .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--foreground); font-family: var(--font);
  font-size: 14px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: var(--font); }
.ico { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted-foreground); }

/* ------------------------------ login ------------------------------ */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1000px 520px at 50% -14%, color-mix(in srgb, var(--primary) 16%, transparent), transparent); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 34px; box-shadow: var(--shadow-lg); }
.auth-card .logo { width: 50px; height: 50px; border-radius: 14px; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 50%, #000));
  display: grid; place-items: center; color: #fff; box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--primary) 60%, transparent); }
.auth-card h1 { font-size: 23px; margin: 0 0 4px; letter-spacing: -.02em; font-weight: 750; }
.auth-card .sub { color: var(--muted-foreground); margin: 0 0 24px; font-size: 14px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; color: var(--muted-foreground); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ------------------------------ shell ------------------------------ */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--sidebar); border-right: 1px solid var(--border); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side .brand { font-weight: 750; font-size: 17px; padding: 4px 8px 20px; display: flex; align-items: center; gap: 11px; letter-spacing: -.03em; }
.side .brand .logo { width: 30px; height: 30px; border-radius: 9px; color: #fff; font-size: 16px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 50%, #000)); display: grid; place-items: center;
  box-shadow: 0 4px 12px -3px color-mix(in srgb, var(--primary) 55%, transparent); }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: var(--radius);
  color: var(--foreground); font-weight: 500; font-size: 13.5px; cursor: pointer; transition: background .12s; }
.side nav a .ico { color: var(--muted-foreground); transition: color .12s; }
.side nav a:hover { background: var(--hover); }
.side nav a.active { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--foreground); font-weight: 600; }
.side nav a.active .ico { color: var(--primary); }
.side nav a .badge { margin-left: auto; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; display: grid; place-items: center; background: var(--red); color: #fff; }
.side .foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--canvas); }
.side-user .av { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 50%, #000)); }
.side-user .who { min-width: 0; }
.side-user .who .nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who .em { font-size: 11px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { padding: 26px 32px 60px; overflow: auto; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; }
.topbar h2 { margin: 0; font-size: 23px; font-weight: 750; letter-spacing: -.03em; }
.topbar .sub { color: var(--muted-foreground); font-size: 13.5px; margin-top: 3px; }
.topbar .actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.mobile-bar { display: none; }

/* ------------------------------ stats ------------------------------ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 17px 19px; box-shadow: var(--shadow-card); position: relative; overflow: hidden; }
.stat .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat .label { color: var(--muted-foreground); font-size: 12.5px; font-weight: 600; }
.stat .si { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary); }
.stat .value { font-size: 28px; font-weight: 760; margin-top: 10px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; margin-top: 4px; color: var(--muted-foreground); }
.stat .delta.up { color: var(--green); } .stat .delta.down { color: var(--red); }
.stat.warn .si { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }
.stat.warn .value { color: var(--red); }

/* ------------------------- grid / panels ------------------------- */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border); gap: 12px; }
.panel-head h3 { margin: 0; font-size: 14.5px; font-weight: 680; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.panel-head h3 .ico { color: var(--muted-foreground); }
.panel-body { padding: 18px 20px; }
.panel-body.flush { padding: 0; }

/* ------------------------------ tables/lists ------------------------------ */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); transition: background .1s; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--muted); }
.empty { text-align: center; padding: 46px 20px; color: var(--muted-foreground); }
.empty .ico { display: block; margin: 0 auto 12px; color: var(--border-strong); }

/* ------------------------------ buttons ------------------------------ */
.btn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; border: 1px solid transparent; border-radius: var(--radius);
  padding: 9px 15px; font-size: 13px; font-weight: 620; transition: background .12s, box-shadow .12s, border-color .12s; white-space: nowrap; line-height: 1.2; }
.btn-primary { background: var(--btn); color: var(--btn-foreground); border-color: color-mix(in srgb, var(--btn) 70%, #000); box-shadow: var(--btn-shadow); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-accent { background: var(--primary); color: var(--primary-foreground); border-color: color-mix(in srgb, var(--primary) 65%, #000); box-shadow: var(--btn-shadow); }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--background); color: var(--foreground); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: var(--muted); }
.btn-danger { background: var(--background); color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 9%, var(--background)); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--background); color: var(--foreground); cursor: pointer; box-shadow: var(--shadow-sm); transition: background .12s; }
.icon-btn:hover { background: var(--muted); }
.icon-btn.sm { width: 30px; height: 30px; }
.seg { display: inline-flex; background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted-foreground); font-weight: 600; font-size: 12.5px; padding: 6px 12px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.seg button.active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }

/* ------------------------------ form ------------------------------ */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 560; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--background); border: 1px solid var(--input);
  border-radius: var(--radius); color: var(--foreground); padding: 10px 12px; font-size: 14px; outline: none; transition: box-shadow .12s, border-color .12s; }
.field input::placeholder, .field textarea::placeholder { color: color-mix(in srgb, var(--muted-foreground) 75%, transparent); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 1px var(--ring); }
.field textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.field .hint { font-size: 12.5px; color: var(--muted-foreground); margin-top: 6px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
input[type="color"] { height: 42px; padding: 4px; cursor: pointer; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; }

/* pro toggle switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas); }
.switch-row .switch-label { font-size: 14px; font-weight: 600; color: var(--foreground); }
.switch-row .switch-sub { font-size: 12.5px; color: var(--muted-foreground); margin-top: 2px; font-weight: 400; }
.switch-side { display: flex; align-items: center; gap: 10px; }
.switch-state { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); }
.switch-state.on { color: var(--green); }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider { position: absolute; inset: 0; cursor: pointer; background: var(--border-strong); border-radius: 999px; transition: background .18s ease; }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--ring); }

/* search box */
.searchbox { position: relative; }
.searchbox .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.searchbox input { padding-left: 34px; width: 240px; background: var(--background); border: 1px solid var(--input); border-radius: var(--radius); color: var(--foreground); padding-top: 8px; padding-bottom: 8px; font-size: 13.5px; outline: none; }
.searchbox input:focus { border-color: var(--ring); box-shadow: 0 0 0 1px var(--ring); }

/* ------------------------- pills / chips ------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .9; }
.pill.todo { background: color-mix(in srgb, var(--muted-foreground) 16%, transparent); color: var(--muted-foreground); }
.pill.doing, .pill.active { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
.pill.done { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.pill.planning { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.pill.paused { background: color-mix(in srgb, var(--muted-foreground) 16%, transparent); color: var(--muted-foreground); }
.prio { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.prio.low { background: color-mix(in srgb, var(--muted-foreground) 14%, transparent); color: var(--muted-foreground); }
.prio.med { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.prio.high { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.prio.urgent { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border); }

/* ------------------------- task list rows ------------------------- */
.task-row { display: flex; align-items: center; gap: 13px; padding: 13px 20px; border-bottom: 1px solid var(--border); transition: background .1s; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--muted); }
.tcheck { width: 20px; height: 20px; border-radius: 7px; border: 2px solid var(--border-strong); background: var(--background); cursor: pointer; flex: none; display: grid; place-items: center; color: transparent; transition: .12s; }
.tcheck:hover { border-color: var(--primary); }
.tcheck.done { background: var(--green); border-color: var(--green); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 550; font-size: 14px; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--muted-foreground); }
.task-meta { display: flex; align-items: center; gap: 9px; margin-top: 4px; flex-wrap: wrap; }
.task-meta .mi { font-size: 12px; color: var(--muted-foreground); display: inline-flex; align-items: center; gap: 4px; }
.task-meta .mi.over { color: var(--red); font-weight: 600; }
.task-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .12s; flex: none; }
.task-row:hover .task-actions { opacity: 1; }

/* ------------------------- kanban ------------------------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kcol { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); display: flex; flex-direction: column; min-height: 200px; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 13px 15px; border-bottom: 1px solid var(--border); font-weight: 650; font-size: 13.5px; }
.kcol-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.kcol-head .count { margin-left: auto; font-size: 12px; color: var(--muted-foreground); font-weight: 600; background: var(--muted); border-radius: 999px; padding: 1px 8px; }
.kcol-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kcol-body.drag-over { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.kcard { background: var(--background); border: 1px solid var(--border); border-radius: 11px; padding: 12px 13px; box-shadow: var(--shadow-sm); cursor: grab; transition: box-shadow .12s, transform .12s; border-left: 3px solid var(--primary); }
.kcard:hover { box-shadow: var(--shadow-card); }
.kcard.dragging { opacity: .5; }
.kcard .kc-title { font-weight: 580; font-size: 13.5px; line-height: 1.35; }
.kcard .kc-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.kcard .kc-sub { font-size: 11.5px; color: var(--muted-foreground); margin-top: 8px; display: flex; align-items: center; gap: 5px; }
.kadd { border: 1px dashed var(--border-strong); background: transparent; color: var(--muted-foreground); border-radius: 9px; padding: 9px; font-size: 12.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.kadd:hover { background: var(--muted); color: var(--foreground); }

/* ------------------------- calendar ------------------------- */
.cal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.cal-head .month { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { padding: 9px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); border-bottom: 1px solid var(--border); text-align: left; }
.cal-cell { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 7px 8px; cursor: pointer; transition: background .1s; position: relative; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--muted); }
.cal-cell.dim { background: color-mix(in srgb, var(--canvas) 60%, transparent); }
.cal-cell.dim .cal-date { color: var(--muted-foreground); opacity: .6; }
.cal-date { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-date { background: var(--primary); color: #fff; }
.cal-ev { font-size: 11px; font-weight: 560; padding: 2px 6px; border-radius: 5px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.cal-ev.task { background: var(--muted) !important; color: var(--foreground); border-left: 3px solid var(--primary); border-radius: 4px; }
.cal-more { font-size: 10.5px; color: var(--muted-foreground); margin-top: 3px; font-weight: 600; }

/* ------------------------- campaigns ------------------------- */
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.camp-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 18px; position: relative; overflow: hidden; }
.camp-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cc, var(--primary)); }
.camp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.camp-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.camp-chan { font-size: 12.5px; color: var(--muted-foreground); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.camp-prog { margin: 16px 0 6px; }
.camp-bar { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.camp-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--cc, var(--primary)), color-mix(in srgb, var(--cc, var(--primary)) 55%, #fff)); transition: width .5s ease; }
.camp-prog-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-foreground); margin-top: 6px; }
.camp-stats { display: flex; gap: 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.camp-stat .v { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.camp-stat .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); margin-top: 1px; }
.camp-actions { position: absolute; top: 14px; right: 14px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.camp-card:hover .camp-actions { opacity: 1; }

/* ------------------------- KPI summary bar ------------------------- */
.kpibar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow-card); }
.kpi { background: var(--card); padding: 16px 18px; }
.kpi .kl { font-size: 11.5px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.kpi .kl .ico { color: var(--muted-foreground); }
.kpi .kv { font-size: 24px; font-weight: 770; margin-top: 8px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .ks { font-size: 11.5px; margin-top: 3px; color: var(--muted-foreground); }
.kpi.profit { background: linear-gradient(135deg, color-mix(in srgb, var(--green) 14%, var(--card)), var(--card)); }
.kpi.profit.neg { background: linear-gradient(135deg, color-mix(in srgb, var(--red) 14%, var(--card)), var(--card)); }
.pos { color: var(--green); } .neg-t { color: var(--red); }

/* ------------------------- campaign board (ClickUp-style grouped table) ------------------------- */
.cmp-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-card); }
.cmp-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1500px; font-size: 13px; }
/* explicit column widths (cells use full-width inputs which otherwise collapse) */
.cmp-table th:nth-child(1), .cmp-table td:nth-child(1) { min-width: 210px; }
.cmp-table th:nth-child(2), .cmp-table td:nth-child(2) { min-width: 120px; }
.cmp-table th:nth-child(3), .cmp-table td:nth-child(3) { min-width: 108px; }
.cmp-table th:nth-child(4), .cmp-table td:nth-child(4) { min-width: 110px; }
.cmp-table th:nth-child(5), .cmp-table td:nth-child(5) { min-width: 120px; }
.cmp-table th:nth-child(6), .cmp-table td:nth-child(6) { min-width: 96px; }
.cmp-table th:nth-child(7), .cmp-table td:nth-child(7) { min-width: 90px; }
.cmp-table th:nth-child(8), .cmp-table td:nth-child(8) { min-width: 90px; }
.cmp-table th:nth-child(9), .cmp-table td:nth-child(9) { min-width: 175px; }
.cmp-table th:nth-child(10), .cmp-table td:nth-child(10) { min-width: 200px; }
.cmp-table th:nth-child(n+11):nth-child(-n+16), .cmp-table td:nth-child(n+11):nth-child(-n+16) { min-width: 96px; }
.cmp-table th:last-child, .cmp-table td:last-child { min-width: 84px; }
.cmp-table th { position: sticky; top: 0; z-index: 6; background: var(--muted); color: var(--muted-foreground); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.cmp-table th .ico { vertical-align: -.2em; opacity: .7; margin-right: 3px; }
.cmp-table td { padding: 0; border-bottom: 1px solid var(--border); vertical-align: middle; background: var(--card); }
.cmp-table .num { text-align: right; }
/* sticky name column */
.cmp-table th.sticky-c, .cmp-table td.sticky-c { position: sticky; left: 0; z-index: 5; background: var(--card); box-shadow: 1px 0 0 var(--border); }
.cmp-table th.sticky-c { z-index: 7; background: var(--muted); }
.crow:hover td { background: var(--muted); }
.crow:hover td.sticky-c { background: var(--hover); }
/* group header */
.grp-row td { padding: 0; border-bottom: 1px solid var(--border); }
.grp-head { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 9px; padding: 11px 14px; font-weight: 700; font-size: 13px; }
.grp-row { background: var(--muted); }
.grp-row td { background: var(--muted); }
.grp-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 7px; font-size: 12px; font-weight: 700; color: #fff; letter-spacing: .02em; }
.grp-count { color: var(--muted-foreground); font-weight: 600; font-size: 12px; }
.grp-tot { margin-left: 16px; display: inline-flex; gap: 14px; font-size: 12px; font-weight: 600; }
.grp-tot .gt-l { color: var(--muted-foreground); font-weight: 500; }
/* inline editors */
.ce { width: 100%; border: 1px solid transparent; background: transparent; color: var(--foreground); padding: 11px 12px; font-size: 13px; font-family: var(--font); outline: none; border-radius: 0; transition: box-shadow .1s, background .1s; }
.ce:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.ce:focus { box-shadow: inset 0 0 0 2px var(--primary); background: var(--background); position: relative; z-index: 2; }
.ce.num { text-align: right; font-variant-numeric: tabular-nums; }
.ce.name { font-weight: 600; }
.ce-money { position: relative; }
td.money .ce { text-align: right; font-variant-numeric: tabular-nums; }
/* status & step select pills */
.csel { -webkit-appearance: none; appearance: none; border: 0; cursor: pointer; font-weight: 700; font-size: 11.5px; padding: 11px 12px; width: 100%; outline: none; background: transparent; color: var(--foreground); font-family: var(--font); }
.cpill { display: flex; align-items: center; justify-content: center; margin: 7px 10px; border-radius: 7px; }
.cpill select { color: #fff; text-align: center; text-align-last: center; padding: 5px 8px; border-radius: 7px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.cpill.step select { text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.cpill select option { color: var(--foreground); background: var(--card); }
/* traffic source chips cell */
.tsrc { display: flex; flex-wrap: wrap; gap: 4px; padding: 9px 12px; align-items: center; cursor: pointer; min-height: 40px; }
.tsrc:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.ts-chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); white-space: nowrap; }
.tsrc .muted { font-size: 12px; }
.cprofit { font-weight: 700; font-variant-numeric: tabular-nums; padding: 11px 12px; text-align: right; }
.cy { padding: 9px 12px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1.35; }
.cy .yp { font-weight: 700; }
.cact { display: flex; gap: 3px; padding: 6px; justify-content: center; }
.addrow td { padding: 0; background: var(--card); }
.addrow .add-in { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--muted-foreground); font-size: 12.5px; font-weight: 600; cursor: pointer; position: sticky; left: 0; }
.addrow .add-in:hover { color: var(--primary); }

/* ------------------------- notes ------------------------- */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.note-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 16px 17px; position: relative; cursor: pointer; transition: box-shadow .12s, transform .12s; border-top: 3px solid var(--nc, var(--primary)); display: flex; flex-direction: column; min-height: 120px; }
.note-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.note-title { font-weight: 700; font-size: 15px; letter-spacing: -.01em; padding-right: 22px; }
.note-body { font-size: 13px; color: var(--muted-foreground); margin-top: 8px; line-height: 1.5; white-space: pre-wrap; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; }
.note-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.note-pin { position: absolute; top: 13px; right: 13px; color: var(--muted-foreground); }
.note-pin.on { color: var(--amber); }

/* ------------------------- charts ------------------------- */
.rev-chart { position: relative; }
.rc-grid { stroke: var(--border); stroke-width: 1; }
.rc-axis { font-size: 10px; fill: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.rc-area { opacity: 0; animation: rc-fade .8s ease .25s forwards; }
@keyframes rc-fade { to { opacity: 1; } }
.rc-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.rc-mark { fill: var(--background); stroke: var(--primary); stroke-width: 0; opacity: 0; transition: opacity .12s, r .12s; }
.rc-mark.active { opacity: 1; stroke-width: 2.5; r: 5; }
.rc-crosshair { stroke: var(--primary); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0; transition: opacity .12s; pointer-events: none; }
.rc-crosshair.on { opacity: .5; }
.rc-zone { cursor: crosshair; fill: transparent; }
.rc-tip { position: absolute; transform: translate(-50%, -100%); background: var(--background); color: var(--foreground); border: 1px solid var(--border); padding: 8px 11px; border-radius: 10px; pointer-events: none; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.16); z-index: 5; min-width: 120px; }
.rc-tip-d { font-size: 11px; color: var(--muted-foreground); padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px solid var(--border); }
.rc-tip-v { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.rc-tip-row { display: flex; align-items: center; gap: 7px; }
.rc-tip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: center; }
.donut { position: relative; width: 168px; height: 168px; flex: none; }
.donut .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut .center .big { font-size: 30px; font-weight: 780; letter-spacing: -.03em; }
.donut .center .small { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); }
.legend { display: flex; flex-direction: column; gap: 11px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-row .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-row .ln { color: var(--muted-foreground); }
.legend-row .lv { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; padding-left: 18px; }

/* horizontal bars (projects) */
.hbar { margin-bottom: 13px; }
.hbar:last-child { margin-bottom: 0; }
.hbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.hbar-top strong { font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.hbar-track span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #8b5cf6)); transition: width .5s ease; }

/* ------------------------- agenda (today) ------------------------- */
.agenda-row { display: flex; gap: 13px; padding: 11px 20px; border-bottom: 1px solid var(--border); }
.agenda-row:last-child { border-bottom: 0; }
.agenda-time { font-size: 12px; font-weight: 700; color: var(--muted-foreground); width: 58px; flex: none; font-variant-numeric: tabular-nums; padding-top: 1px; }
.agenda-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.agenda-main { flex: 1; min-width: 0; }
.agenda-title { font-weight: 560; font-size: 13.5px; }
.agenda-sub { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }

/* ------------------------- subtasks (modal) ------------------------- */
.subtask { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.subtask .tcheck { width: 18px; height: 18px; }
.subtask input.st-title { flex: 1; border: 0; background: transparent; color: var(--foreground); font-size: 13.5px; outline: none; padding: 2px 0; }
.subtask.done input.st-title { text-decoration: line-through; color: var(--muted-foreground); }
.subtask .rm { color: var(--muted-foreground); cursor: pointer; opacity: 0; }
.subtask:hover .rm { opacity: 1; }

/* ------------------------- modal ------------------------- */
.modal-bg { position: fixed; inset: 0; background: rgb(0 0 0 / .48); display: none; place-items: center; z-index: 100; padding: 20px; backdrop-filter: blur(3px); }
.modal-bg.show { display: grid; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 680px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 17px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 22px; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; position: sticky; bottom: 0; background: var(--card); }
.modal-foot .right { display: flex; gap: 10px; }
.close-x { cursor: pointer; color: var(--muted-foreground); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; }
.close-x:hover { color: var(--foreground); background: var(--muted); }
.section-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-foreground); margin: 22px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--foreground); color: var(--canvas);
  padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; transition: .2s; pointer-events: none; font-weight: 560; font-size: 13.5px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------- responsive ------------------------- */
@media (max-width: 920px) {
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 90; width: 240px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: translateX(0); }
  .side-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .4); z-index: 89; display: none; }
  .side-backdrop.show { display: block; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--card); position: sticky; top: 0; z-index: 50; }
  .mobile-bar .brand { font-weight: 750; letter-spacing: -.02em; }
  .main { padding: 18px 16px 60px; }
  .row, .row-3 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .topbar .actions { width: 100%; }
  .searchbox input { width: 100%; }
}
