/* ============================================================
 * Dashio Component Library — v1.0
 * Depends on tokens.css. Include this stylesheet in every page.
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--ds-font-sans);
  font-size: var(--ds-text-14);
  line-height: var(--ds-lh-normal);
  color: var(--ds-ink-1);
  background: var(--ds-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

/* Tabular numerals on metrics */
.ds-num,
.ds-metric-value,
.ds-table td.num,
.ds-table th.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ───────── Typography ───────── */
.ds-h1 { font-size: var(--ds-text-28); font-weight: var(--ds-w-semibold); line-height: var(--ds-lh-tight); letter-spacing: -0.01em; margin: 0; }
.ds-h2 { font-size: var(--ds-text-20); font-weight: var(--ds-w-semibold); line-height: var(--ds-lh-snug); margin: 0; }
.ds-h3 { font-size: var(--ds-text-16); font-weight: var(--ds-w-semibold); line-height: var(--ds-lh-snug); margin: 0; }
.ds-body { font-size: var(--ds-text-14); color: var(--ds-ink-1); }
.ds-body-sm { font-size: var(--ds-text-13); color: var(--ds-ink-2); }
.ds-caption { font-size: var(--ds-text-12); color: var(--ds-ink-3); }
.ds-micro { font-size: var(--ds-text-11); color: var(--ds-ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: var(--ds-w-medium); }

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

/* ───────── Application shell ───────── */
.ds-app {
  display: grid;
  grid-template-columns: var(--ds-nav-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.ds-nav {
  background: var(--ds-surface-1);
  border-right: 1px solid var(--ds-hairline);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.ds-nav-brand {
  padding: var(--ds-space-4) var(--ds-space-4);
  border-bottom: 1px solid var(--ds-hairline);
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
}
.ds-nav-brand-mark {
  width: 24px; height: 24px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-accent);
  display: grid; place-items: center;
  color: #fff;
}
.ds-nav-brand-name { font-size: var(--ds-text-14); font-weight: var(--ds-w-semibold); letter-spacing: -0.005em; color: var(--ds-ink-1); }
.ds-nav-brand-env { margin-left: auto; font-size: var(--ds-text-11); color: var(--ds-ink-meta); text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border: 1px solid var(--ds-hairline); border-radius: var(--ds-radius-xs); }

.ds-nav-section {
  padding: var(--ds-space-4) var(--ds-space-4) var(--ds-space-1);
  font-size: var(--ds-text-11);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ds-ink-3);
  font-weight: var(--ds-w-medium);
}
.ds-nav-group { padding: 0 var(--ds-space-2); }
.ds-nav-item {
  display: flex; align-items: center; gap: var(--ds-space-2);
  padding: 6px var(--ds-space-3);
  border-radius: var(--ds-radius-sm);
  color: var(--ds-ink-2);
  font-size: var(--ds-text-13);
  font-weight: var(--ds-w-medium);
  cursor: pointer;
  transition: background var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease);
  text-decoration: none;
  user-select: none;
}
.ds-nav-item:hover { background: var(--ds-surface-2); color: var(--ds-ink-1); text-decoration: none; }
.ds-nav-item[aria-current="page"],
.ds-nav-item.is-active { background: var(--ds-accent-tint); color: var(--ds-ink-1); }
.ds-nav-item[aria-current="page"] .ds-nav-icon,
.ds-nav-item.is-active .ds-nav-icon { color: var(--ds-accent); }
.ds-nav-icon { width: 16px; height: 16px; color: var(--ds-ink-3); flex-shrink: 0; }
.ds-nav-label { flex: 1; }
.ds-nav-count { font-size: var(--ds-text-11); color: var(--ds-ink-3); }
.ds-nav-sub { padding-left: 26px; }
.ds-nav-sub .ds-nav-item { padding: 4px var(--ds-space-3); font-size: var(--ds-text-13); font-weight: var(--ds-w-regular); }

.ds-nav-foot {
  margin-top: auto;
  padding: var(--ds-space-3);
  border-top: 1px solid var(--ds-hairline);
  display: flex; align-items: center; gap: var(--ds-space-2);
}
.ds-nav-avatar { width: 28px; height: 28px; border-radius: var(--ds-radius-full); background: var(--ds-surface-3); display: grid; place-items: center; color: var(--ds-ink-2); font-weight: var(--ds-w-semibold); font-size: var(--ds-text-12); }
.ds-nav-foot-name { font-size: var(--ds-text-13); color: var(--ds-ink-1); line-height: 1.2; font-weight: var(--ds-w-medium); }
.ds-nav-foot-role { font-size: var(--ds-text-11); color: var(--ds-ink-meta); }

/* Main content area */
.ds-main { display: flex; flex-direction: column; min-width: 0; }
.ds-page-head {
  padding: var(--ds-space-5) var(--ds-space-6) var(--ds-space-4);
  border-bottom: 1px solid var(--ds-hairline);
  background: var(--ds-bg);
  display: flex; align-items: center; gap: var(--ds-space-3);
}
.ds-page-head-title { flex: 1; min-width: 0; }
.ds-page-head-title h1 { font-size: var(--ds-text-20); font-weight: var(--ds-w-semibold); margin: 0; letter-spacing: -0.005em; }
.ds-page-head-title p { margin: 2px 0 0; font-size: var(--ds-text-13); color: var(--ds-ink-3); }
.ds-page-body { padding: var(--ds-space-5) var(--ds-space-6); flex: 1; overflow-y: auto; }

/* ───────── Surfaces ───────── */
.ds-card {
  background: var(--ds-surface-1);
  border: 1px solid var(--ds-hairline);
  border-radius: var(--ds-radius-sm);
  overflow: hidden;
}
.ds-card-head {
  padding: var(--ds-space-3) var(--ds-space-4);
  border-bottom: 1px solid var(--ds-hairline);
  display: flex; align-items: center; gap: var(--ds-space-2);
}
.ds-card-head h2,
.ds-card-head h3 { flex: 1; font-size: var(--ds-text-14); font-weight: var(--ds-w-semibold); margin: 0; }
.ds-card-body { padding: var(--ds-space-4); }

/* ───────── Buttons ───────── */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-1);
  height: 32px; padding: 0 var(--ds-space-3);
  border-radius: var(--ds-radius-sm);
  font-family: inherit;
  font-size: var(--ds-text-13);
  font-weight: var(--ds-w-medium);
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ds-ink-1);
  transition: background var(--ds-dur-fast) var(--ds-ease), border-color var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease);
  white-space: nowrap;
  user-select: none;
}
.ds-btn:focus-visible { outline: 2px solid var(--ds-accent-ring); outline-offset: 1px; }
.ds-btn--primary   { background: var(--ds-accent); color: #fff; }
.ds-btn--primary:hover   { background: #1D4ED8; }
.ds-btn--secondary { background: var(--ds-surface-2); border-color: var(--ds-hairline); color: var(--ds-ink-1); }
.ds-btn--secondary:hover { background: var(--ds-surface-3); border-color: var(--ds-hairline-2); }
.ds-btn--ghost     { color: var(--ds-ink-2); }
.ds-btn--ghost:hover { background: var(--ds-surface-2); color: var(--ds-ink-1); }
.ds-btn--danger    { background: var(--ds-danger); color: #fff; }
.ds-btn--danger:hover    { background: #B91C1C; }
.ds-btn--sm        { height: 26px; padding: 0 10px; font-size: var(--ds-text-12); }
.ds-btn--lg        { height: 38px; padding: 0 16px; font-size: var(--ds-text-14); }
.ds-btn--icon      { width: 28px; padding: 0; }

/* Icon glyph baseline for buttons */
.ds-btn .ds-icon { width: 14px; height: 14px; }

/* ───────── Form elements ───────── */
.ds-field { display: flex; flex-direction: column; gap: var(--ds-space-1); }
.ds-label { font-size: var(--ds-text-12); color: var(--ds-ink-2); font-weight: var(--ds-w-medium); }
.ds-input, .ds-select, .ds-textarea {
  width: 100%;
  height: 32px;
  padding: 0 var(--ds-space-3);
  background: var(--ds-surface-2);
  border: 1px solid var(--ds-hairline);
  border-radius: var(--ds-radius-sm);
  color: var(--ds-ink-1);
  font-family: inherit;
  font-size: var(--ds-text-13);
  outline: none;
  transition: border-color var(--ds-dur-fast) var(--ds-ease), box-shadow var(--ds-dur-fast) var(--ds-ease);
}
.ds-textarea { height: auto; padding: var(--ds-space-2) var(--ds-space-3); min-height: 80px; resize: vertical; }
.ds-input:focus, .ds-select:focus, .ds-textarea:focus { border-color: var(--ds-accent); box-shadow: 0 0 0 3px var(--ds-accent-ring); }
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--ds-ink-4); }
.ds-input--lg { height: 38px; }

.ds-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--ds-space-3); }

/* ───────── Tables ───────── */
.ds-table { width: 100%; border-collapse: collapse; font-size: var(--ds-text-13); }
.ds-table th {
  text-align: left;
  padding: var(--ds-space-2) var(--ds-space-3);
  color: var(--ds-ink-3);
  font-weight: var(--ds-w-medium);
  font-size: var(--ds-text-11);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--ds-hairline);
  background: var(--ds-surface-1);
  position: sticky; top: 0;
}
.ds-table td {
  padding: var(--ds-space-2) var(--ds-space-3);
  border-bottom: 1px solid var(--ds-hairline);
  color: var(--ds-ink-1);
  vertical-align: middle;
}
.ds-table tr:last-child td { border-bottom: none; }
.ds-table tbody tr:hover td { background: var(--ds-surface-2); }
.ds-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ───────── Badges & Pills ───────── */
.ds-badge {
  display: inline-flex; align-items: center; gap: var(--ds-space-1);
  padding: 2px 8px;
  border-radius: var(--ds-radius-full);
  font-size: var(--ds-text-11);
  font-weight: var(--ds-w-medium);
  background: var(--ds-surface-2);
  color: var(--ds-ink-2);
  border: 1px solid var(--ds-hairline);
}
.ds-badge--ok { color: var(--ds-ok); background: var(--ds-ok-soft); border-color: transparent; }
.ds-badge--warn { color: var(--ds-warn); background: var(--ds-warn-soft); border-color: transparent; }
.ds-badge--danger { color: var(--ds-danger); background: var(--ds-danger-soft); border-color: transparent; }
.ds-badge--accent { color: var(--ds-accent); background: var(--ds-accent-tint); border-color: transparent; }
.ds-badge .ds-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.ds-tag {
  display: inline-flex; align-items: center; gap: var(--ds-space-1);
  padding: 2px 6px 2px 8px;
  background: var(--ds-surface-3);
  border-radius: var(--ds-radius-xs);
  font-size: var(--ds-text-12);
  color: var(--ds-ink-1);
}
.ds-tag-x { color: var(--ds-ink-3); cursor: pointer; font-size: 12px; line-height: 1; }
.ds-tag-x:hover { color: var(--ds-ink-1); }

/* ───────── Empty / loading / error ───────── */
.ds-empty {
  text-align: center; padding: var(--ds-space-7) var(--ds-space-4);
  color: var(--ds-ink-3); font-size: var(--ds-text-13);
}
.ds-empty-icon { width: 32px; height: 32px; opacity: .5; margin-bottom: var(--ds-space-2); display: inline-block; }
.ds-empty-title { font-size: var(--ds-text-14); color: var(--ds-ink-1); font-weight: var(--ds-w-semibold); margin-bottom: 4px; }
.ds-skeleton { background: linear-gradient(90deg, var(--ds-surface-2) 0%, var(--ds-surface-3) 50%, var(--ds-surface-2) 100%); background-size: 200% 100%; animation: ds-shimmer 1.4s linear infinite; border-radius: var(--ds-radius-sm); }
@keyframes ds-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ───────── Toast ───────── */
.ds-toast {
  position: fixed; bottom: var(--ds-space-5); right: var(--ds-space-5);
  background: var(--ds-surface-1); border: 1px solid var(--ds-hairline);
  border-left: 3px solid var(--ds-accent);
  padding: var(--ds-space-3) var(--ds-space-4);
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-text-13);
  box-shadow: var(--ds-shadow-3);
  display: flex; align-items: center; gap: var(--ds-space-2);
  z-index: 9999;
}
.ds-toast--ok { border-left-color: var(--ds-ok); }
.ds-toast--err { border-left-color: var(--ds-danger); }

/* ───────── Modal ───────── */
.ds-modal-scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: 200;
}
.ds-modal {
  background: var(--ds-surface-1);
  border: 1px solid var(--ds-hairline);
  border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-shadow-3);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow: auto;
}
.ds-modal-head { padding: var(--ds-space-4) var(--ds-space-4) var(--ds-space-3); border-bottom: 1px solid var(--ds-hairline); }
.ds-modal-body { padding: var(--ds-space-4); }
.ds-modal-foot { padding: var(--ds-space-3) var(--ds-space-4); border-top: 1px solid var(--ds-hairline); display: flex; justify-content: flex-end; gap: var(--ds-space-2); background: var(--ds-bg); }

/* ───────── Widget shell (designer + public) ───────── */
.ds-pw {
  background: var(--ds-surface-1);
  border: 1px solid var(--ds-hairline);
  border-radius: var(--ds-radius-md);
  padding: var(--ds-space-3) var(--ds-space-4);
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  position: relative;
  overflow: hidden;
}
.ds-pw__head {
  display: flex; align-items: baseline; gap: var(--ds-space-2);
  margin-bottom: var(--ds-space-2);
}
.ds-pw__title {
  font-size: var(--ds-text-11);
  font-weight: var(--ds-w-semibold);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ds-ink-3);
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ds-pw__period {
  font-size: var(--ds-text-11);
  color: var(--ds-ink-4);
  white-space: nowrap;
}
.ds-pw__body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.ds-pw__foot { margin-top: var(--ds-space-2); padding-top: var(--ds-space-2); border-top: 1px solid var(--ds-hairline); font-size: var(--ds-text-11); color: var(--ds-ink-3); display: flex; justify-content: space-between; }

/* Selected / dragging states (designer) */
.ds-pw.is-selected { border-color: var(--ds-accent); box-shadow: 0 0 0 2px var(--ds-accent-ring); }
.ds-pw.is-dragging { opacity: .92; box-shadow: var(--ds-shadow-3); }

/* ───────── Widget body variants ───────── */
/* Metric — big number */
.ds-w-metric { display: flex; flex-direction: column; gap: 4px; }
.ds-w-metric__value { font-size: var(--ds-text-40); font-weight: var(--ds-w-semibold); letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ds-ink-1); }
.ds-w-metric__delta { font-size: var(--ds-text-13); font-weight: var(--ds-w-medium); display: inline-flex; align-items: center; gap: 4px; }
.ds-w-metric__delta--up { color: var(--ds-ok); }
.ds-w-metric__delta--down { color: var(--ds-danger); }
.ds-w-metric__sub { font-size: var(--ds-text-12); color: var(--ds-ink-3); }

/* Progress — bar */
.ds-w-progress { display: flex; flex-direction: column; gap: var(--ds-space-2); }
.ds-w-progress__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ds-space-3); }
.ds-w-progress__value { font-size: var(--ds-text-28); font-weight: var(--ds-w-semibold); letter-spacing: -0.01em; line-height: 1; font-variant-numeric: tabular-nums; }
.ds-w-progress__target { font-size: var(--ds-text-13); color: var(--ds-ink-3); font-variant-numeric: tabular-nums; }
.ds-w-progress__track { height: 8px; border-radius: var(--ds-radius-full); background: var(--ds-surface-3); overflow: hidden; }
.ds-w-progress__fill { height: 100%; background: var(--ds-accent); border-radius: inherit; transition: width var(--ds-dur-slow) var(--ds-ease); }
.ds-w-progress__fill--ok { background: var(--ds-ok); }
.ds-w-progress__meta { display: flex; justify-content: space-between; font-size: var(--ds-text-11); color: var(--ds-ink-3); }

/* Progress — arc (half + full) */
.ds-w-arc { display: flex; align-items: center; justify-content: center; gap: var(--ds-space-3); height: 100%; }
.ds-w-arc__svg { width: 100%; max-width: 180px; height: auto; }
.ds-w-arc__track { fill: none; stroke: var(--ds-surface-3); stroke-width: 14; }
.ds-w-arc__fill  { fill: none; stroke: var(--ds-accent); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset var(--ds-dur-slow) var(--ds-ease); }
.ds-w-arc__text  { font-size: var(--ds-text-20); font-weight: var(--ds-w-semibold); fill: var(--ds-ink-1); font-variant-numeric: tabular-nums; }
.ds-w-arc__sub   { font-size: var(--ds-text-12); fill: var(--ds-ink-3); }

/* Ranking — podium horizontal */
.ds-w-rank-h { display: flex; align-items: flex-end; justify-content: space-around; height: 100%; gap: var(--ds-space-2); padding-bottom: var(--ds-space-2); }
.ds-w-rank-h__col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.ds-w-rank-h__photo {
  width: 56px; height: 56px; border-radius: var(--ds-radius-full);
  background: var(--ds-surface-3);
  display: grid; place-items: center;
  font-weight: var(--ds-w-semibold);
  color: var(--ds-ink-2);
  border: 2px solid transparent;
  font-size: var(--ds-text-16);
}
.ds-w-rank-h__col[data-rank="1"] .ds-w-rank-h__photo { border-color: var(--ds-rank-1); width: 68px; height: 68px; }
.ds-w-rank-h__col[data-rank="2"] .ds-w-rank-h__photo { border-color: var(--ds-rank-2); }
.ds-w-rank-h__col[data-rank="3"] .ds-w-rank-h__photo { border-color: var(--ds-rank-3); }
.ds-w-rank-h__rank {
  width: 18px; height: 18px; border-radius: var(--ds-radius-full);
  background: var(--ds-surface-3);
  display: grid; place-items: center;
  font-size: var(--ds-text-11); font-weight: var(--ds-w-bold); color: var(--ds-ink-2);
  margin-top: -10px;
}
.ds-w-rank-h__col[data-rank="1"] .ds-w-rank-h__rank { background: var(--ds-rank-1); color: #1A1300; }
.ds-w-rank-h__col[data-rank="2"] .ds-w-rank-h__rank { background: var(--ds-rank-2); color: #0F1419; }
.ds-w-rank-h__col[data-rank="3"] .ds-w-rank-h__rank { background: var(--ds-rank-3); color: #fff; }
.ds-w-rank-h__name { font-size: var(--ds-text-12); font-weight: var(--ds-w-medium); color: var(--ds-ink-1); text-align: center; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-w-rank-h__val  { font-size: var(--ds-text-20); font-weight: var(--ds-w-semibold); letter-spacing: -0.01em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ds-ink-1); }

/* Ranking — list */
.ds-w-rank-v { display: flex; flex-direction: column; gap: 2px; }
.ds-w-rank-v__row {
  display: grid; grid-template-columns: 24px 28px 1fr auto; align-items: center; gap: var(--ds-space-2);
  padding: 6px 8px; border-radius: var(--ds-radius-xs);
}
.ds-w-rank-v__row:hover { background: var(--ds-surface-2); }
.ds-w-rank-v__rank { font-size: var(--ds-text-13); font-weight: var(--ds-w-semibold); color: var(--ds-ink-3); font-variant-numeric: tabular-nums; text-align: center; }
.ds-w-rank-v__row[data-rank="1"] .ds-w-rank-v__rank { color: var(--ds-rank-1); }
.ds-w-rank-v__row[data-rank="2"] .ds-w-rank-v__rank { color: var(--ds-rank-2); }
.ds-w-rank-v__row[data-rank="3"] .ds-w-rank-v__rank { color: var(--ds-rank-3); }
.ds-w-rank-v__photo { width: 24px; height: 24px; border-radius: var(--ds-radius-full); background: var(--ds-surface-3); display: grid; place-items: center; font-size: var(--ds-text-11); color: var(--ds-ink-2); font-weight: var(--ds-w-semibold); }
.ds-w-rank-v__name { font-size: var(--ds-text-13); color: var(--ds-ink-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-w-rank-v__val  { font-size: var(--ds-text-13); font-weight: var(--ds-w-semibold); color: var(--ds-ink-1); font-variant-numeric: tabular-nums; }
.ds-w-rank-v__row.is-pin { border-left: 2px solid var(--ds-accent); background: var(--ds-accent-tint); }

/* Series — table inside widget */
.ds-w-table { width: 100%; font-size: var(--ds-text-12); }
.ds-w-table th, .ds-w-table td { padding: 4px 8px; }

/* ───────── Designer canvas ───────── */
.ds-designer {
  display: grid;
  grid-template-columns: 1fr var(--ds-edit-w);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ds-designer-canvas {
  background: var(--ds-bg);
  background-image:
    linear-gradient(to right, var(--ds-hairline) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ds-hairline) 1px, transparent 1px);
  background-size: calc((100% - 11 * var(--ds-grid-gap)) / 12 + var(--ds-grid-gap)) calc(var(--ds-grid-row) + var(--ds-grid-gap));
  overflow: auto;
  padding: var(--ds-space-4);
}
.ds-canvas-inner {
  display: grid;
  grid-template-columns: repeat(var(--ds-grid-cols), 1fr);
  grid-auto-rows: var(--ds-grid-row);
  gap: var(--ds-grid-gap);
  min-height: 100%;
}
.ds-canvas-inner > .ds-pw { cursor: pointer; }

/* Drop ghost during drag */
.ds-drop-ghost {
  background: var(--ds-accent-tint);
  border: 1px dashed var(--ds-accent);
  border-radius: var(--ds-radius-md);
  pointer-events: none;
}

/* Editor panel */
.ds-editor {
  background: var(--ds-surface-1);
  border-left: 1px solid var(--ds-hairline);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ds-editor-head {
  padding: var(--ds-space-4) var(--ds-space-4) var(--ds-space-3);
  border-bottom: 1px solid var(--ds-hairline);
  display: flex; align-items: center; gap: var(--ds-space-2);
}
.ds-editor-head h3 { flex: 1; font-size: var(--ds-text-14); font-weight: var(--ds-w-semibold); margin: 0; }
.ds-editor-body { padding: var(--ds-space-4); overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: var(--ds-space-3); }
.ds-editor-foot { padding: var(--ds-space-3) var(--ds-space-4); border-top: 1px solid var(--ds-hairline); display: flex; justify-content: space-between; gap: var(--ds-space-2); background: var(--ds-bg); }
.ds-editor-section { font-size: var(--ds-text-11); text-transform: uppercase; letter-spacing: .08em; color: var(--ds-ink-3); font-weight: var(--ds-w-semibold); padding-top: var(--ds-space-2); }

/* ───────── Designer top-bar ───────── */
.ds-designer-top {
  display: flex; align-items: center; gap: var(--ds-space-3);
  padding: var(--ds-space-3) var(--ds-space-4);
  border-bottom: 1px solid var(--ds-hairline);
  background: var(--ds-surface-1);
}
.ds-designer-top h2 { font-size: var(--ds-text-14); font-weight: var(--ds-w-semibold); margin: 0; }
.ds-designer-top .spacer { flex: 1; }

/* ───────── Utilities ───────── */
.ds-flex     { display: flex; }
.ds-row      { display: flex; align-items: center; gap: var(--ds-space-2); }
.ds-col      { display: flex; flex-direction: column; gap: var(--ds-space-2); }
.ds-spacer   { flex: 1; }
.ds-stack-2  { display: flex; flex-direction: column; gap: var(--ds-space-2); }
.ds-stack-3  { display: flex; flex-direction: column; gap: var(--ds-space-3); }
.ds-stack-4  { display: flex; flex-direction: column; gap: var(--ds-space-4); }
.ds-mt-2     { margin-top: var(--ds-space-2); }
.ds-mt-3     { margin-top: var(--ds-space-3); }
.ds-mb-3     { margin-bottom: var(--ds-space-3); }

.ds-divider  { border: 0; border-top: 1px solid var(--ds-hairline); margin: var(--ds-space-3) 0; }

/* Live dot */
.ds-live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ds-ok); margin-right: 6px; animation: ds-pulse 2s ease-in-out infinite; vertical-align: middle; }
@keyframes ds-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Kbd shortcut */
.ds-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  background: var(--ds-surface-3);
  border: 1px solid var(--ds-hairline-2);
  border-bottom-width: 2px;
  border-radius: var(--ds-radius-xs);
  font-family: 'ui-monospace', 'SF Mono', Menlo, Consolas, monospace;
  font-size: var(--ds-text-11);
  color: var(--ds-ink-2);
}

/* Focus visible — global override */
:focus-visible { outline: 2px solid var(--ds-accent-ring); outline-offset: 1px; border-radius: var(--ds-radius-sm); }

/* Sidebar scrollbar slim */
.ds-nav::-webkit-scrollbar { width: 6px; }
.ds-nav::-webkit-scrollbar-thumb { background: var(--ds-hairline); border-radius: 3px; }

/* TV / public-view variant — bigger metrics */
.ds-tv .ds-w-metric__value      { font-size: var(--ds-text-64); }
.ds-tv .ds-pw__title            { font-size: var(--ds-text-13); }
.ds-tv .ds-w-rank-h__name       { font-size: var(--ds-text-14); }
.ds-tv .ds-w-rank-h__val        { font-size: var(--ds-text-28); }
.ds-tv .ds-w-rank-v__name       { font-size: var(--ds-text-16); }
.ds-tv .ds-w-rank-v__val        { font-size: var(--ds-text-20); }
.ds-tv .ds-w-rank-v__row        { padding: 10px var(--ds-space-3); }
.ds-tv .ds-w-rank-v__photo      { width: 32px; height: 32px; font-size: var(--ds-text-13); }
.ds-tv .ds-w-progress__value    { font-size: var(--ds-text-40); }

/* ============================================================
 * F002_v3 hot-fix additions (2026-05-14)
 * ============================================================ */

/* Mobile-gate: viewport < 1024px shows the .ds-mobile-gate element
 * only and hides every other body-child. The gate element is rendered
 * by dashio_head() callers with the `hidden` attribute, so it stays
 * hidden on desktop and is unhidden by the @media rule below. */
@media (max-width: 1023px) {
  body > *:not(noscript):not(script):not(style):not(.ds-mobile-gate) { display: none !important; }
  .ds-mobile-gate { display: grid; place-items: center; min-height: 100vh; padding: 24px; text-align: center; color: var(--ds-ink-1); }
  .ds-mobile-gate h1 { font-size: var(--ds-text-20); margin-bottom: var(--ds-space-2); }
  .ds-mobile-gate p { color: var(--ds-ink-2); font-size: var(--ds-text-14); }
}

/* .ds-text-meta — de-emphasised meta-text utility (uses the new
 * --ds-ink-meta token; WCAG-AA against surface-1). Applied to the
 * "Kan du ikke logge ind?" line on /login.php and reusable elsewhere. */
.ds-text-meta { color: var(--ds-ink-meta); }

/* ============================================================
 * F003_v2-postaudit additions (2026-05-14)
 * ============================================================ */

/* Generic banner utility. Reusable across modules for warn/info
 * surfaces (e.g. /kpi/?section=overview's unknown-disposition
 * warning, F004's lead-status-mapping intro warning). */
.ds-banner {
  display: flex; align-items: flex-start; gap: var(--ds-space-3);
  padding: var(--ds-space-3) var(--ds-space-4);
  border: 1px solid var(--ds-hairline);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-1);
  color: var(--ds-ink-1);
  font-size: var(--ds-text-13);
  margin-bottom: var(--ds-space-3);
}
.ds-banner__icon { flex-shrink: 0; line-height: 1; }
.ds-banner__body { flex: 1; min-width: 0; }
.ds-banner--warn {
  background: var(--ds-warn-soft);
  border-left: 3px solid var(--ds-warn);
  border-color: var(--ds-warn-soft);
}
.ds-banner--info {
  background: var(--ds-accent-tint);
  border-left: 3px solid var(--ds-accent);
  border-color: var(--ds-accent-tint);
}
