/* DataNegocio — Design tokens & base styles */
:root {
  --bg-deep: #07101f;
  --bg-base: #0a1628;
  --bg-surface: #0f1d33;
  --bg-elevated: #15263f;
  --bg-hover: #1a2e4d;
  --bg-input: #0c1a2e;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-input: rgba(255, 255, 255, 0.10);

  --text-primary: #e8edf5;
  --text-secondary: #b6c2d6;
  --text-muted: #7d8da6;
  --text-faint: #4f5e78;

  --accent: oklch(0.65 0.18 250);
  --accent-strong: oklch(0.72 0.18 250);
  --accent-soft: oklch(0.65 0.18 250 / 0.14);
  --accent-line: oklch(0.65 0.18 250 / 0.35);

  --success: oklch(0.72 0.14 155);
  --success-soft: oklch(0.72 0.14 155 / 0.14);
  --warning: oklch(0.78 0.14 75);
  --warning-soft: oklch(0.78 0.14 75 / 0.14);
  --danger: oklch(0.66 0.20 25);
  --danger-soft: oklch(0.66 0.20 25 / 0.14);
  --purple: oklch(0.68 0.18 295);
  --purple-soft: oklch(0.68 0.18 295 / 0.14);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.55);

  --header-h: 56px;
  --tab-h: 44px;

  --font-ui: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--text-primary); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); border: 2px solid transparent; background-clip: padding-box; }

/* ---------- Login ---------- */
.login-root {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, oklch(0.32 0.12 250 / 0.55), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, oklch(0.40 0.16 260 / 0.35), transparent 60%),
    linear-gradient(180deg, #050b18 0%, #0a1628 60%, #07101f 100%);
  transition: opacity 480ms ease, transform 480ms cubic-bezier(.6, .0, .2, 1), filter 480ms ease;
}
.login-root::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 30%, transparent 80%);
  pointer-events: none;
}
.login-root.is-leaving { opacity: 0; transform: scale(1.03); filter: blur(6px); pointer-events: none; }

.login-card {
  position: relative; width: 380px; max-width: calc(100vw - 32px);
  padding: 36px 32px 28px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, oklch(0.20 0.04 250 / 0.7), oklch(0.14 0.03 250 / 0.85));
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 30px 80px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.login-mark { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px;
  background: linear-gradient(180deg, oklch(0.55 0.18 250), oklch(0.42 0.18 252));
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 0 0 1px oklch(0.35 0.15 250), 0 8px 24px oklch(0.30 0.18 252 / 0.5);
}
.brand-mark svg { width: 22px; height: 22px; display: block; }
.login-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin: 4px 0 0; text-align: center; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 500; }
.input {
  height: 40px; padding: 0 12px;
  background: var(--bg-input); border: 1px solid var(--border-input);
  border-radius: var(--radius); font-size: 14px; outline: none;
  transition: border-color 120ms, box-shadow 120ms, background 120ms; width: 100%;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); background: oklch(0.18 0.03 250); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; letter-spacing: -0.005em;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text-primary);
  transition: background 120ms, border-color 120ms, transform 80ms; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, oklch(0.65 0.18 250), oklch(0.55 0.18 252));
  border-color: oklch(0.45 0.18 250); color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 4px 14px oklch(0.40 0.18 250 / 0.30);
}
.btn-primary:hover { background: linear-gradient(180deg, oklch(0.70 0.18 250), oklch(0.60 0.18 252)); }
.btn-primary.lg { height: 42px; padding: 0 18px; font-size: 14px; width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-danger { background: oklch(0.55 0.20 25); border-color: oklch(0.42 0.20 25); color: white; }
.btn-danger:hover { background: oklch(0.60 0.20 25); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { width: 32px; padding: 0; }

.demo-pill {
  display: flex; align-items: center; gap: 8px; margin-top: 18px;
  padding: 10px 12px; background: rgba(255,255,255,0.03);
  border: 1px dashed var(--border-strong); border-radius: 8px;
  font-size: 11px; color: var(--text-muted);
}
.demo-pill code { font-family: var(--font-mono); color: var(--text-secondary); background: rgba(255,255,255,0.04); padding: 1px 6px; border-radius: 4px; }

.role-switch { display: flex; gap: 6px; margin-top: 10px; }
.role-chip {
  flex: 1; padding: 6px 8px; border-radius: 6px; text-align: center; font-size: 11px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; transition: all 120ms;
}
.role-chip:hover { background: rgba(255,255,255,0.06); }
.role-chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text-primary); }

/* ---------- App shell ---------- */
.app-root {
  min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-base);
  opacity: 0; animation: appEnter 450ms 80ms cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes appEnter { from { opacity: 0; transform: scale(0.99) translateY(4px); } to { opacity: 1; transform: none; } }

.app-header {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  background: rgba(10, 22, 40, 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 12px;
}
.app-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.app-brand .mark-sm {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px;
  background: linear-gradient(180deg, oklch(0.55 0.18 250), oklch(0.42 0.18 252));
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset;
}
.app-brand .mark-sm svg { width: 14px; height: 14px; }

.tabs { display: flex; gap: 2px; margin-left: 18px; padding: 3px; border-radius: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); }
.tab {
  display: flex; align-items: center; gap: 7px; padding: 5px 12px;
  border-radius: 6px; background: transparent; border: none;
  color: var(--text-muted); font-size: 13px; font-weight: 500; transition: all 120ms;
}
.tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.tab.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 1px 4px rgba(0,0,0,0.4); }
.tab .tab-num { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.tab.active .tab-num { color: var(--accent-strong); }
.header-spacer { flex: 1; }

.cookie-widget {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 8px;
  border-radius: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary); cursor: pointer; transition: all 120ms;
}
.cookie-widget:hover { background: rgba(255,255,255,0.06); }
.cookie-widget .dot { width: 7px; height: 7px; border-radius: 50%; }
.cookie-widget.fresh .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.cookie-widget.stale .dot { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.cookie-widget.missing .dot { background: var(--danger); }

.user-pill { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, oklch(0.45 0.16 250), oklch(0.32 0.16 290)); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: white; letter-spacing: 0; }
.user-pill .meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-pill .name { font-size: 12px; font-weight: 500; }
.user-pill .role { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.role-badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; font-family: var(--font-mono); }
.role-badge.admin { background: var(--accent-soft); color: oklch(0.78 0.16 250); }
.role-badge.fijo { background: var(--success-soft); color: oklch(0.82 0.14 155); }
.role-badge.movil { background: var(--purple-soft); color: oklch(0.78 0.16 295); }

/* ---------- Layout ---------- */
.app-main { flex: 1; min-height: 0; }
.page { display: flex; flex-direction: column; min-height: calc(100vh - var(--header-h)); }
.page-header { padding: 22px 28px 14px; border-bottom: 1px solid var(--border); }
.page-title { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.015em; }
.page-sub { color: var(--text-muted); font-size: 13px; margin: 4px 0 0; }
.page-body { padding: 22px 28px; flex: 1; }
.split { display: grid; grid-template-columns: 1fr 380px; gap: 24px; padding: 22px 28px; min-height: calc(100vh - var(--header-h) - 1px); }

.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 13px; font-weight: 600; margin: 0; letter-spacing: -0.005em; }
.card-sub { font-size: 11px; color: var(--text-muted); }
.card-body { padding: 18px; }
.section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; margin: 0 0 10px; }

/* ---------- Upload & terminal ---------- */
.upload-zone {
  position: relative; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; background: rgba(255,255,255,0.015); transition: all 160ms; cursor: pointer;
}
.upload-zone:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.upload-zone.has-file { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); }
.upload-zone .file-name { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); }
.upload-zone .file-info { font-size: 12px; color: var(--text-muted); }

.terminal {
  background: #04080f; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 14px 16px; font-family: var(--font-mono); font-size: 12px; line-height: 1.55;
  color: var(--text-secondary); height: 320px; overflow-y: auto; position: relative;
}
.terminal::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 28px; background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent); pointer-events: none; }
.term-line { white-space: pre-wrap; word-break: break-all; }
.term-time { color: var(--text-faint); margin-right: 8px; }
.term-info { color: var(--text-secondary); }
.term-ok { color: oklch(0.78 0.14 155); }
.term-warn { color: oklch(0.82 0.14 75); }
.term-err { color: oklch(0.72 0.20 25); }
.term-ctx { color: oklch(0.78 0.16 250); }
.term-cursor { display: inline-block; width: 7px; height: 13px; background: var(--accent); vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.progress { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; position: relative; }
.progress > .bar { height: 100%; background: linear-gradient(90deg, oklch(0.60 0.18 250), oklch(0.72 0.18 250)); border-radius: 999px; transition: width 300ms ease; box-shadow: 0 0 12px oklch(0.65 0.18 250 / 0.5); position: relative; }
.progress > .bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.progress.idle > .bar::after { display: none; }

.metric { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-right: 1px solid var(--border); }
.metric:last-child { border-right: none; }
.metric .label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.metric .value { font-family: var(--font-mono); font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.metric .value.accent { color: oklch(0.85 0.16 250); }
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255,255,255,0.015); }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.02); position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.row { cursor: pointer; transition: background 100ms; }
.tbl tr.row:hover td { background: rgba(255,255,255,0.025); }
.tbl tr.row.active td { background: var(--accent-soft); color: var(--text-primary); }
.tbl td .sub { font-size: 11px; color: var(--text-muted); }
.tbl .num { font-family: var(--font-mono); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--text-secondary); white-space: nowrap; }
.badge.fijo { background: var(--success-soft); color: oklch(0.82 0.14 155); border-color: oklch(0.72 0.14 155 / 0.3); }
.badge.movil { background: var(--purple-soft); color: oklch(0.80 0.16 295); border-color: oklch(0.68 0.18 295 / 0.3); }
.badge.success { background: var(--success-soft); color: oklch(0.82 0.14 155); border-color: oklch(0.72 0.14 155 / 0.3); }
.badge.warning { background: var(--warning-soft); color: oklch(0.86 0.14 75); border-color: oklch(0.78 0.14 75 / 0.3); }
.badge.danger { background: var(--danger-soft); color: oklch(0.78 0.18 25); border-color: oklch(0.66 0.20 25 / 0.3); }
.badge.accent { background: var(--accent-soft); color: oklch(0.82 0.16 250); border-color: var(--accent-line); }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary); font-weight: 500; }
.stage-dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.search-input { flex: 1; min-width: 220px; position: relative; }
.search-input input { width: 100%; height: 34px; background: var(--bg-input); border: 1px solid var(--border-input); border-radius: var(--radius); padding: 0 12px 0 34px; font-size: 13px; outline: none; transition: all 120ms; }
.search-input input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.seg { display: inline-flex; padding: 3px; background: var(--bg-input); border: 1px solid var(--border-input); border-radius: 7px; }
.seg button { background: transparent; border: none; color: var(--text-muted); padding: 4px 10px; border-radius: 5px; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: all 120ms; }
.seg button:hover { color: var(--text-primary); }
.seg button.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* ---------- Detail panel ---------- */
.detail-panel { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; position: sticky; top: calc(var(--header-h) + 22px); max-height: calc(100vh - var(--header-h) - 44px); }
.detail-empty { padding: 60px 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.detail-empty svg { color: var(--text-faint); margin-bottom: 8px; }
.detail-head { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.detail-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
.detail-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.detail-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 12.5px; }
.kv .k { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 2px; }
.kv .v { color: var(--text-secondary); }
.kv .v.mono { font-family: var(--font-mono); font-size: 12px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.contact-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: rgba(255,255,255,0.025); border: 1px solid var(--border); font-size: 12px; }
.contact-card .who { font-weight: 500; color: var(--text-primary); }
.contact-card .role-tag { font-size: 11px; color: var(--text-muted); }
.contact-card .data { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }

.note { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: rgba(255,255,255,0.025); border: 1px solid var(--border); border-left: 2px solid var(--accent-line); font-size: 12.5px; margin-bottom: 8px; }
.note .meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; }
.note .text { color: var(--text-primary); white-space: pre-wrap; }

.detail-actions { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: rgba(255,255,255,0.015); }
.detail-actions .btn { flex: 1; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(4,8,15,0.75); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; animation: fadeIn 180ms ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 460px; max-width: calc(100vw - 32px); background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); overflow: hidden; animation: modalIn 220ms cubic-bezier(.2,.7,.2,1); }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: flex-start; }
.modal-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--danger-soft); color: oklch(0.78 0.18 25); display: grid; place-items: center; flex: 0 0 auto; }
.modal-icon.warn { background: var(--warning-soft); color: oklch(0.82 0.14 75); }
.modal-icon.info { background: var(--accent-soft); color: oklch(0.78 0.16 250); }
.modal-title { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.modal-msg { font-size: 13px; color: var(--text-muted); }
.modal-body { padding: 18px 22px; }
.modal-footer { padding: 14px 22px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); background: rgba(255,255,255,0.015); }

.textarea { width: 100%; background: var(--bg-input); border: 1px solid var(--border-input); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; outline: none; resize: vertical; min-height: 70px; transition: border-color 120ms, box-shadow 120ms; }
.textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Sub-tabs ---------- */
.subtabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 28px; gap: 4px; margin-top: -1px; background: rgba(255,255,255,0.015); }
.subtab { padding: 11px 16px; background: transparent; border: none; color: var(--text-muted); font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 8px; transition: color 120ms, border-color 120ms; }
.subtab:hover { color: var(--text-primary); }
.subtab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.subtab .count { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,0.05); color: var(--text-muted); }
.subtab.active .count { background: var(--accent-soft); color: var(--accent-strong); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; height: 100%; overflow-x: auto; }
.kanban-col { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 0; }
.kanban-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.kanban-title { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kanban-title .stage-dot { width: 8px; height: 8px; }
.kanban-count { font-family: var(--font-mono); font-size: 11px; background: rgba(255,255,255,0.05); padding: 1px 7px; border-radius: 999px; color: var(--text-muted); }
.kanban-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.kanban-card { padding: 10px 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; cursor: pointer; transition: all 120ms; }
.kanban-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.kanban-card.active { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
.kanban-card .name { font-weight: 500; color: var(--text-primary); margin-bottom: 4px; line-height: 1.3; }
.kanban-card .client { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.kanban-card .row { display: flex; justify-content: space-between; align-items: center; }
.kanban-card .fcv { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }

/* ---------- Misc ---------- */
.empty { padding: 80px 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.empty .em-title { font-size: 15px; font-weight: 500; color: var(--text-primary); margin: 12px 0 4px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: oklch(0.65 0.18 250); box-shadow: 0 0 0 0 oklch(0.65 0.18 250 / 0.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 oklch(0.65 0.18 250 / 0.55); } 70% { box-shadow: 0 0 0 8px oklch(0.65 0.18 250 / 0); } 100% { box-shadow: 0 0 0 0 oklch(0.65 0.18 250 / 0); } }

.history-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.history-row:last-child { border-bottom: none; }
.history-row:hover { background: rgba(255,255,255,0.02); }
.history-row .when { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.history-row .keywords { color: var(--text-secondary); flex: 1; }
.history-row .keywords code { font-family: var(--font-mono); padding: 1px 5px; border-radius: 3px; background: rgba(255,255,255,0.04); font-size: 11px; margin-right: 4px; }
.history-row .count { font-family: var(--font-mono); color: var(--text-primary); font-weight: 500; }
.tablewrap { overflow: auto; max-height: calc(100vh - var(--header-h) - 230px); }
.tablewrap.tall { max-height: calc(100vh - var(--header-h) - 180px); }
.row-action { opacity: 0; transition: opacity 120ms; }
.tbl tr.row:hover .row-action { opacity: 1; }

/* Extra helpers */
.alert-err { padding: 10px 14px; background: var(--danger-soft); border: 1px solid oklch(0.66 0.20 25 / 0.35); border-radius: var(--radius); font-size: 13px; color: oklch(0.82 0.18 25); margin-bottom: 12px; }
.loading-ring { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 700ms linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.kbd { font-family: var(--font-mono); font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-muted); }
