/* younalyse — design tokens + base */
:root {
  --accent: #2563EB;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --accent-fg: #ffffff;

  --bg: #ffffff;
  --bg-elev: #fafafa;
  --bg-sunk: #f5f5f6;
  --bg-hover: #f2f2f3;

  --fg: #0a0a0c;
  --fg-muted: #5b5b62;
  --fg-faint: #8a8a92;

  --border: rgba(10, 10, 12, 0.08);
  --border-strong: rgba(10, 10, 12, 0.14);

  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;

  --row-h: 48px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  --shadow-sm: 0 1px 2px rgba(10, 10, 12, 0.04);
  --shadow-md: 0 4px 12px rgba(10, 10, 12, 0.06), 0 1px 3px rgba(10, 10, 12, 0.04);
  --shadow-lg: 0 12px 32px rgba(10, 10, 12, 0.10), 0 4px 8px rgba(10, 10, 12, 0.04);
}

[data-theme="dark"] {
  --bg: #0c0c0f;
  --bg-elev: #131317;
  --bg-sunk: #18181d;
  --bg-hover: #1c1c22;

  --fg: #f4f4f5;
  --fg-muted: #a0a0aa;
  --fg-faint: #6b6b75;

  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
}

[data-density="compact"] { --row-h: 36px; }
[data-density="comfortable"] { --row-h: 56px; }

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--fg);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, border 0.12s, transform 0.06s;
  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: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.danger { color: var(--bad); border-color: var(--border); }
.btn.danger:hover { background: rgba(220, 38, 38, 0.08); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14px; }

/* ---- inputs ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.01em;
}
.input, .textarea, .select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  outline: none;
  font-size: 13px;
  transition: border 0.12s, box-shadow 0.12s;
  width: 100%;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.55; font-family: var(--sans); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.sm { height: 30px; padding: 0 8px; font-size: 12px; }
.input[type="number"] { width: 88px; }
.help { font-size: 11.5px; color: var(--fg-faint); }

/* checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
}
.check input { display: none; }
.check .box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  flex-shrink: 0;
}
.check input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}
.check input:checked + .box::after {
  content: '';
  width: 8px;
  height: 4.5px;
  border-left: 1.8px solid white;
  border-bottom: 1.8px solid white;
  transform: rotate(-45deg) translate(1px, -1px);
}
.check span.lbl { font-size: 13px; }

/* card */
.card {
  background: var(--bg);
  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-header h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.card-body { padding: 18px; }

/* tag/chip */
.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: 11.5px;
  border-radius: 4px;
  background: var(--bg-sunk);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  font-family: var(--mono);
  letter-spacing: -0.01em;
}
.chip.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* sidebar */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.sidebar.collapsed { width: 56px; }
.sidebar-brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--fg-muted);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.1s, color 0.1s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--fg); }
.nav-item.active { background: var(--bg-hover); color: var(--fg); }
.nav-item.active .nav-ico { color: var(--accent); }
.nav-ico { width: 16px; height: 16px; flex-shrink: 0; color: var(--fg-faint); }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklch, var(--accent), white 40%));
  color: white;
  font-weight: 600;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; line-height: 1.2; }
.user-meta .name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .email { font-size: 11px; color: var(--fg-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* layout */
.app { display: flex; height: 100%; }
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.topbar h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.topbar .subtitle { color: var(--fg-faint); font-size: 13px; }
.scroll-area { flex: 1; overflow: auto; }
.page { padding: 28px 32px 60px; max-width: 1280px; margin: 0 auto; }
.page-header { margin-bottom: 24px; }
.page-header h2 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.page-header p { margin: 0; color: var(--fg-muted); font-size: 13.5px; }

/* table */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
}
.table-toolbar {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--bg-elev);
}
.table-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-faint);
  padding: 10px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
}
table.data th:hover { color: var(--fg); }
table.data th .sort { color: var(--accent); margin-left: 4px; }
table.data td {
  padding: 0 14px;
  height: var(--row-h);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr { cursor: pointer; transition: background 0.08s; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; text-align: right; }
table.data .title-cell {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.engagement-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 12.5px;
}
.engagement-bar .bar {
  width: 36px; height: 4px; border-radius: 2px; background: var(--bg-sunk);
  overflow: hidden;
}
.engagement-bar .fill { height: 100%; background: var(--accent); border-radius: 2px; }

/* progress */
.progress-shell {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
  height: 100%;
  min-height: 480px;
}
@media (max-width: 900px) { .progress-shell { grid-template-columns: 1fr; } }
.steps { display: flex; flex-direction: column; gap: 0; }
.step-row {
  display: flex;
  gap: 12px;
  padding: 12px 4px;
  position: relative;
}
.step-row + .step-row::before {
  content: ''; position: absolute;
  left: 11px; top: -2px; bottom: calc(100% - 14px);
  width: 1px; background: var(--border-strong);
}
.step-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--fg-faint);
  position: relative; z-index: 1;
}
.step-dot.done { background: var(--accent); border-color: var(--accent); color: white; }
.step-dot.active { border-color: var(--accent); color: var(--accent); }
.step-dot.active::after {
  content: '';
  position: absolute; inset: -4px;
  border: 1.5px solid var(--accent); border-radius: 50%;
  opacity: 0.3;
  animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(1.6); opacity: 0; }
}
.step-meta { flex: 1; min-width: 0; }
.step-meta .name { font-size: 13px; font-weight: 500; }
.step-meta .desc { font-size: 12px; color: var(--fg-faint); margin-top: 2px; }
.step-meta .desc .channel { color: var(--fg-muted); }

/* console */
.console {
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 360px;
}
.console-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.console-dot { width: 6px; height: 6px; border-radius: 50%; background: #ef4444; }
.console-dot.live { background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74, 0.5); animation: live 1.6s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); } 100% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } }
.console-body { padding: 12px 14px; overflow: auto; flex: 1; }
.console-body .ts { color: var(--fg-faint); }
.console-body .ok { color: var(--good); }
.console-body .warn { color: var(--warn); }
.console-body .err { color: var(--bad); }
.console-body .info { color: var(--accent); }

/* toolbar pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--bg);
  font-size: 12px; color: var(--fg-muted);
  cursor: pointer;
}
.pill input { all: unset; width: 60px; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.pill.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* status pill */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; height: 20px; border-radius: 10px;
  font-size: 11px; font-weight: 500;
  background: var(--bg-sunk); color: var(--fg-muted);
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--good); background: rgba(22, 163, 74, 0.10); }
.status.run { color: var(--accent); background: var(--accent-soft); }
.status.err { color: var(--bad); background: rgba(220, 38, 38, 0.10); }

/* search */
.search {
  display: flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  min-width: 200px;
}
.search input { all: unset; flex: 1; font-size: 13px; }
.search svg { color: var(--fg-faint); flex-shrink: 0; }

/* segmented */
.segmented {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 2px;
  gap: 1px;
  background: var(--bg);
}
.segmented button {
  border: none; background: transparent; cursor: pointer;
  padding: 4px 10px; font-size: 12px;
  color: var(--fg-muted);
  border-radius: 4px;
  font-weight: 500;
}
.segmented button.active { background: var(--bg-hover); color: var(--fg); }

/* full-screen detail */
.detail-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex; flex-direction: column;
  animation: slideUp 0.22s ease-out;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.detail-topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  flex-shrink: 0;
}
.detail-body { flex: 1; overflow: auto; }
.detail-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  padding: 28px 32px 60px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }

.video-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, color-mix(in oklch, var(--accent), black 30%), color-mix(in oklch, var(--accent), black 60%));
  border-radius: var(--radius-lg);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.video-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 12px, transparent 12px 24px);
}
.video-thumb .play {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,0.95); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.video-thumb .meta {
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(0,0,0,0.7); color: white;
  padding: 3px 8px; border-radius: 4px;
  font-family: var(--mono); font-size: 12px;
}

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.kpi { background: var(--bg); padding: 14px 16px; }
.kpi .label { font-size: 11px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.kpi .value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi .delta { font-size: 11px; color: var(--good); margin-top: 2px; font-family: var(--mono); }

.section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--fg-faint); margin: 0 0 10px;
}

.transcript {
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--fg);
}
.transcript .ts-tag { font-family: var(--mono); font-size: 11px; color: var(--fg-faint); margin-right: 8px; }

.comment {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--bg);
}
.comment .head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.comment .author { font-weight: 600; }
.comment .likes { color: var(--fg-faint); font-family: var(--mono); font-size: 11.5px; }
.comment .text { font-size: 13px; color: var(--fg); }
.comment .cats { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }

.summary-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.summary-card .head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--fg-faint);
}
.summary-card .ai-mark {
  width: 14px; height: 14px; border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklch, var(--accent), magenta 25%));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; color: white; font-weight: 700;
}
.summary-card .body { font-size: 13.5px; line-height: 1.6; }

/* mobile shell */
.phone {
  width: 360px;
  height: 720px;
  border-radius: 36px;
  border: 8px solid #18181b;
  background: #18181b;
  box-shadow: 0 30px 60px rgba(0,0,0,0.18), 0 8px 16px rgba(0,0,0,0.08);
  overflow: hidden;
  position: relative;
}
.phone-screen {
  width: 100%; height: 100%;
  background: var(--bg);
  border-radius: 28px;
  overflow: hidden;
  position: relative;
}

/* login screen */
.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
}
@media (max-width: 800px) { .login-shell { grid-template-columns: 1fr; } }
.login-art {
  background: var(--bg-sunk);
  border-right: 1px solid var(--border);
  padding: 40px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-art-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, var(--accent-soft), transparent 50%),
    radial-gradient(circle at 80% 70%, color-mix(in oklch, var(--accent), magenta 30%) 0%, transparent 40%);
  opacity: 0.5;
}
.login-art > * { position: relative; z-index: 1; }
.login-art h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; max-width: 380px; margin: 0; }
.login-art p { color: var(--fg-muted); margin-top: 12px; max-width: 380px; }
.login-form {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-form-inner { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 20px; }
.login-form-inner h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.02em; }

/* run-summary */
.run-summary {
  display: flex; gap: 24px;
  padding: 14px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.run-summary .stat { display: flex; flex-direction: column; gap: 2px; }
.run-summary .stat .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.run-summary .stat .l { font-size: 11px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.04em; }

/* form sections */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; } }
.form-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.form-card h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.form-card .hint { font-size: 12.5px; color: var(--fg-muted); margin: 0 0 16px; }

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.checkbox-row:last-child { border-bottom: none; }
.checkbox-row .right { display: flex; align-items: center; gap: 8px; }

.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }

/* mobile bottom-tab */
.mtabs {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 64px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  display: flex; align-items: center; justify-content: space-around;
  padding: 0 12px 8px;
}
.mtab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 12px;
  font-size: 10.5px;
  color: var(--fg-faint);
  background: none; border: none; cursor: pointer;
}
.mtab.active { color: var(--accent); }
.mtab svg { width: 20px; height: 20px; }

/* canvas wrap */
.canvas {
  min-height: 100vh;
  background: #f0f0f1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
[data-theme="dark"] .canvas { background: #0a0a0c; }
.canvas-row {
  display: flex; gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.canvas-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-faint); margin: 0 0 12px;
  font-weight: 500;
}
.artboard {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.04);
  overflow: hidden;
  position: relative;
}
.artboard-label {
  position: absolute;
  top: -22px; left: 0;
  font-size: 11px; color: var(--fg-faint);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.tag-input-wrap {
  position: relative;
}
.tag-input-wrap .help-row { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11.5px; color: var(--fg-faint); }

/* responsive grid for run page */
.run-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 900px) { .run-grid { grid-template-columns: 1fr; } }

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  /* Скрываем sidebar */
  .sidebar { display: none; }

  /* Контент на всю ширину */
  .app { flex-direction: column; }
  .main { width: 100%; }

  /* Топбар компактнее */
  .topbar { padding: 0 16px; height: 48px; }
  .topbar h1 { font-size: 14px; }

  /* Страница */
  .page { padding: 16px 16px 80px; }
  .page-header h2 { font-size: 18px; }

  /* Форм грид в одну колонку */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Таблица скроллится */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-toolbar { gap: 6px; padding: 8px 10px; }

  /* Run grid в одну колонку */
  .run-grid { grid-template-columns: 1fr; }
  .run-summary { flex-wrap: wrap; gap: 12px; }

  /* Detail overlay */
  .detail-grid { grid-template-columns: 1fr; padding: 16px 16px 80px; }
  .detail-topbar { padding: 0 12px; gap: 8px; }

  /* KPI grid 2x2 на мобилке */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  /* Bottom navigation */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
    z-index: 50;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px 4px;
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--fg-faint);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
  }
  .mobile-nav-item.active { color: var(--accent); }
  .mobile-nav-item svg { width: 22px; height: 22px; }

  /* Login на мобилке */
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form { padding: 32px 24px; align-items: flex-start; padding-top: 60px; }
}

@media (min-width: 769px) {
  .mobile-nav { display: none; }
}
