/* Values follow the workload.zero theme tokens (kette-tokens 5.26, theme_zero) */
:root {
  --background: #ffffff;
  --surface: #ffffff;
  --muted: #f1f5f9;
  --hover: #f6f8fb;
  --foreground: #0f172a;
  --text-secondary: #475569;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.04);
  --input-border: #8492a6;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --selected-bg: #eff6ff;
  --destructive: #dc2626;
  --destructive-hover: #b91c1c;
  --destructive-text: #b91c1c;
  --success-bg: #f0fdf4; --success-text: #047857;
  --info-bg: #eff6ff; --info-text: #2563eb;
  --neutral-bg: #f1f5f9; --neutral-text: #475569;
  --dot-email: #0d9488;
  --dot-social: #7c3aed;
  --dot-newsletter: #ea580c;
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-badge: 6px;
  --shadow-dialog: 0 16px 32px -8px rgba(0, 0, 0, 0.05), 0 32px 64px -16px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.03);
  --scrim: rgba(15, 23, 42, 0.28);
  --content: 1120px;
  font-family: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--background); color: var(--foreground); -webkit-font-smoothing: antialiased; font-size: 13px; line-height: 1.25; letter-spacing: -0.006em; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.appbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.appbar-inner { max-width: var(--content); margin: 0 auto; padding: 0 28px; height: 52px; display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark { width: 28px; height: 28px; border-radius: var(--radius-control); border: 1px solid var(--border); display: grid; place-items: center; color: var(--foreground); flex-shrink: 0; }
.brand-name { font-size: 14px; font-weight: 600; }

.wrap { max-width: var(--content); margin: 0 auto; padding: 28px 28px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title { min-width: 0; }
.page-title h1 { margin: 0; font-size: 24px; line-height: 29px; font-weight: 600; letter-spacing: -0.02em; }
.page-sub { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; line-height: 16px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--surface); color: var(--foreground); font: 500 13px/16px Inter, system-ui, sans-serif; letter-spacing: -0.006em; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--muted); }
.btn:disabled { cursor: progress; opacity: .7; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--muted); }
.btn-danger { background: var(--destructive); border-color: var(--destructive); color: #fff; }
.btn-danger:hover { background: var(--destructive-hover); border-color: var(--destructive-hover); }
.btn-danger-outline { color: var(--destructive-text); }
.btn-sm { height: 28px; padding: 0 10px; }

.tabs { display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 2px; background: var(--muted); border-radius: var(--radius-control); margin-bottom: 12px; max-width: 100%; overflow-x: auto; scrollbar-width: none; position: relative; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-badge); flex-shrink: 0;
  background: transparent; color: var(--text-secondary); font: 500 13px/16px Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--foreground); }
.tab:focus-visible { outline-offset: 0; }
.tab[aria-pressed="true"] { background: var(--surface); border-color: var(--border-strong); color: var(--foreground); font-weight: 600; box-shadow: var(--shadow-xs); }
.tab-count { color: var(--text-secondary); font-weight: 400; font-variant-numeric: tabular-nums; }

.scope { margin: 0 0 8px; font-size: 12px; color: var(--muted-foreground); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); margin-bottom: 20px; }
.kpi { padding: 12px 16px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { font-size: 11px; line-height: 16px; color: var(--muted-foreground); }
.kpi-value { font-size: 16px; line-height: 22px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-top: 2px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; display: flex; flex-direction: column; }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-name {
  margin: 0; font-weight: 600; font-size: 14px; line-height: 20px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
}
.card-meta { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 6px 8px; }
.status { font-size: 12px; line-height: 15px; font-weight: 500; padding: 2px 6px; border-radius: var(--radius-badge); white-space: nowrap; }
.status-running { color: var(--success-text); background: var(--success-bg); }
.status-planned { color: var(--info-text); background: var(--info-bg); }
.status-ended { color: var(--neutral-text); background: var(--neutral-bg); }
.chan { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 15px; font-weight: 500; padding: 1px 6px; border: 1px solid var(--border); border-radius: var(--radius-badge); color: var(--foreground); white-space: nowrap; }
.chan-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chan-email { background: var(--dot-email); }
.chan-social { background: var(--dot-social); }
.chan-newsletter { background: var(--dot-newsletter); }
.card-dates { font-size: 13px; line-height: 20px; color: var(--muted-foreground); }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.metric .ml { font-size: 11px; line-height: 16px; color: var(--muted-foreground); }
.metric .mv { font-size: 16px; line-height: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--muted); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--text-secondary); border-radius: 3px; }
.card-foot { display: flex; gap: 6px; margin-top: auto; }
@supports (grid-template-rows: subgrid) {
  .card { display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; }
  .card-body { grid-row: span 4; display: grid; grid-template-rows: subgrid; row-gap: 12px; }
}

.empty, .loading { grid-column: 1 / -1; text-align: center; color: var(--muted-foreground); padding: 48px 20px; }
.empty .btn { margin-left: 8px; }
.error-state { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 32px 24px; text-align: center; }
.error-state h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.error-state p { margin: 0 0 16px; color: var(--muted-foreground); }

dialog.modal { border: 1px solid var(--border); padding: 0; background: var(--surface); color: var(--foreground); border-radius: var(--radius-card); width: calc(100% - 32px); max-width: 460px; max-height: calc(100% - 32px); box-shadow: var(--shadow-dialog); }
dialog.modal-sm { max-width: 400px; }
dialog.modal::backdrop { background: var(--scrim); }
.modal-head { padding: 20px 20px 4px; }
.modal-head h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.modal-body { padding: 12px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.modal-body p { margin: 0; color: var(--text-secondary); line-height: 19px; }
.modal-foot { padding: 12px 20px 20px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.foot-spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--foreground); }
.field input, .field select {
  width: 100%; min-width: 0; height: 32px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: var(--radius-control);
  font: 400 13px/16px Inter, system-ui, sans-serif; color: var(--foreground); background: var(--surface);
}
.field input:focus-visible, .field select:focus-visible { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 1px; }
.field input[aria-invalid="true"] { border-color: var(--destructive); }
.field-err, .form-err { margin: 0; font-size: 12px; line-height: 15px; font-weight: 500; color: var(--destructive-text); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100% - 32px); }
.toast { display: flex; align-items: center; gap: 12px; background: var(--foreground); color: #fff; padding: 10px 14px; border-radius: var(--radius-control); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-dialog); }
.toast-action { background: transparent; border: 1px solid rgba(255,255,255,.7); color: #fff; border-radius: var(--radius-badge); height: 24px; padding: 0 8px; font: inherit; font-weight: 600; cursor: pointer; }
.toast-action:focus-visible { outline-color: #fff; }

@media (max-width: 720px) {
  .wrap, .appbar-inner { padding-left: 16px; padding-right: 16px; }
  .wrap { padding-top: 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .field-row { grid-template-columns: 1fr; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .modal-foot { padding: 12px 16px 16px; flex-wrap: nowrap; }
}
@media (max-width: 359px) {
  .btn-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
