/* ═══════════════════════════════════════════════════════════════
   CORE.CSS  —  Base layout, variables, sidebar, drag & effects
   App-specifik styling er i styles.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Design tokens ────────────────────────────────────────────── */
:root {
  /* Farvepalette */
  --ink:          #1e2436;
  --text:         #3a4259;
  --muted:        #7a839a;
  --panel:        #ffffff;
  --bg:           #f5f4ef;
  --line:         #e6e4dc;
  --line-soft:    #eeece6;
  --green:        #8eb838;
  --green-d:      #7aa030;
  --green-bg:     rgba(142,184,56,.1);
  --yellow:       #c8a020;
  --danger:       #c0392b;
  --shadow:       0 2px 12px rgba(0,0,0,.1);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.18);

  /* Sidebar */
  --sb-bg:        #1e2436;
  --sb-text:      rgba(255,255,255,.72);
  --sb-text-muted:rgba(255,255,255,.42);
  --sb-active-bg: rgba(255,255,255,.12);
  --sb-hover-bg:  rgba(255,255,255,.06);
  --sb-width:     240px;
  --sb-section-head: rgba(255,255,255,.38);

  /* Topbar */
  --tb-height:    52px;
  --tb-bg:        var(--sb-bg);

  /* Motion */
  --ease-spring:  cubic-bezier(.34,1.56,.64,1);
  --ease-out:     cubic-bezier(.22,1,.36,1);
  --dur-fast:     120ms;
  --dur-mid:      220ms;
  --dur-slow:     380ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #dde2ef; --text: #b0b8cc; --muted: #636b82;
    --panel: #222840; --bg: #161b2e;
    --line: #2d3451; --line-soft: #252c42;
    --green: #8eb838; --green-d: #9fc840; --green-bg: rgba(142,184,56,.12);
    --yellow: #c8a020; --danger: #e05050;
    --shadow: 0 2px 12px rgba(0,0,0,.4); --shadow-lg: 0 8px 40px rgba(0,0,0,.5);
  }
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Force native hidden attribute to win over component display rules. */
[hidden],
.modal[hidden],
.voice-panel[hidden],
.bulk-bar[hidden],
.toast[hidden],
.undo-bar[hidden] {
  display: none !important;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit; color: inherit; border-radius: 0;
  background: none; border: none; outline: none;
}
button { cursor: pointer; }
svg { display: block; flex-shrink: 0; }

/* ── App layout: sidebar + main body ─────────────────────────── */
.app-shell { overflow: hidden; height: 100dvh; }

.app-layout {
  display: grid;
  grid-template-columns: var(--sb-width) 1fr;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  background: var(--sb-bg);
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  position: relative; z-index: 40;
  transition: transform var(--dur-mid) var(--ease-out);
}

.sb-workspace {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sb-dot {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-d) 100%);
  flex-shrink: 0;
}
.sb-ws-name {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700; font-size: 14px; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-ws-name em { font-style: normal; color: var(--green); }

/* Search */
.sb-search {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 10px;
  background: rgba(255,255,255,.07);
  border-radius: 8px; padding: 7px 10px;
  flex-shrink: 0;
}
.sb-search svg { width: 14px; height: 14px; color: var(--sb-text-muted); flex-shrink: 0; }
.sb-search input {
  background: transparent; color: rgba(255,255,255,.85);
  font-size: 13px; width: 100%;
}
.sb-search input::placeholder { color: var(--sb-text-muted); }

/* Nav */
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 0 8px; }
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-track { background: transparent; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.sb-section { margin-bottom: 4px; }

.sb-section-head {
  padding: 12px 16px 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--sb-section-head);
  display: flex; align-items: center; justify-content: space-between;
  cursor: default; user-select: none;
}

/* Nav items */
.sb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 16px;
  font-size: 13.5px; font-weight: 500;
  color: var(--sb-text);
  border-radius: 6px; margin: 1px 6px;
  cursor: pointer; transition: background var(--dur-fast);
  position: relative; user-select: none;
  text-decoration: none;
}
.sb-item:hover { background: var(--sb-hover-bg); color: rgba(255,255,255,.9); }
.sb-item.active, .sb-item[aria-current="page"] {
  background: var(--sb-active-bg);
  color: #fff; font-weight: 600;
}
.sb-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.sb-item.active .sb-icon, .sb-item:hover .sb-icon { opacity: 1; }

/* Channel-style items (stages) */
.sb-channel::before {
  content: '#';
  font-weight: 700; font-size: 14px;
  color: var(--sb-text-muted);
  width: 16px; text-align: center; flex-shrink: 0;
}
.sb-channel.active::before { color: rgba(255,255,255,.7); }

/* DM-style items (owners) */
.sb-dm-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; border: 1.5px solid var(--sb-bg);
}
.sb-dm-dot.online { background: #4caf50; }
.sb-dm-dot.offline { background: var(--sb-text-muted); }

/* Badge (card count) */
.sb-badge {
  margin-left: auto; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.14); color: rgba(255,255,255,.8);
  flex-shrink: 0;
}
.sb-item.active .sb-badge { background: rgba(255,255,255,.22); color: #fff; }
.sb-badge.has-items { background: var(--green); color: #1b2a00; }

/* Sidebar footer */
.sb-footer {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 10px 12px; flex-shrink: 0;
}
.sb-user {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 8px;
  transition: background var(--dur-fast);
}
.sb-user:hover { background: var(--sb-hover-bg); }
.sb-avatar {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--green); color: #1b2a00;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; flex-shrink: 0;
}
.sb-username { flex: 1; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-logout {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--sb-text-muted);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.sb-logout:hover { background: rgba(255,255,255,.1); color: rgba(255,255,255,.9); }
.sb-logout svg { width: 15px; height: 15px; }

/* Mobile overlay */
.sb-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 39;
}

/* ── Main body ────────────────────────────────────────────────── */
.app-body {
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  min-width: 0;
}

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar {
  height: var(--tb-height); min-height: var(--tb-height);
  background: var(--tb-bg);
  display: flex; align-items: center;
  padding: 0 16px; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  z-index: 30; flex-shrink: 0;
}
.topbar-left {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.topbar-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 16px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto; flex-wrap: wrap;
}
.topbar .btn-ghost { color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.18); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar .btn-primary { background: var(--green); color: #1b2a00; border: none; }

/* ── Content area ─────────────────────────────────────────────── */
.content-area {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
}

/* Page loading spinner */
.page-loading {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loading bar ──────────────────────────────────────────────── */
.load-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--green-d), var(--green), #9fcf40);
  z-index: 9999; pointer-events: none; opacity: 0;
  transition: width .3s ease, opacity .3s;
}
.load-bar.active { opacity: 1; }

/* ── Drag & Drop effects ──────────────────────────────────────── */

/* Ghost card (clone following cursor) */
.drag-ghost {
  position: fixed !important;
  z-index: 999 !important;
  pointer-events: none !important;
  transform: rotate(2.5deg) scale(1.05) !important;
  box-shadow: 0 24px 60px rgba(0,0,0,.35), 0 4px 16px rgba(0,0,0,.2) !important;
  opacity: .97;
  transition: transform .08s var(--ease-spring);
  will-change: left, top;
}

/* Source card while drag in progress */
.dragging-source {
  opacity: .22 !important;
  pointer-events: none !important;
  border-style: dashed !important;
  transition: opacity .15s;
}

/* Before drag threshold: subtle scale to signal intent */
.drag-armed {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0,0,0,.16);
  transition: transform .12s var(--ease-spring), box-shadow .12s;
  z-index: 2;
  position: relative;
}

/* Board while drag in progress */
.board-dragging .cell:not(.drag-over):not(.drag-accepting) {
  opacity: .72;
  transition: opacity .2s;
}

/* Target cell accepting drop */
.cell.drag-accepting {
  background: color-mix(in srgb, var(--green) 10%, var(--panel)) !important;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--green) 55%, transparent) !important;
  transition: background .12s, box-shadow .12s;
}

/* Drop flash on success */
@keyframes dropFlash {
  0%   { background-color: color-mix(in srgb, var(--green) 28%, var(--panel)); }
  100% { background-color: transparent; }
}
.cell.drop-flash { animation: dropFlash .45s ease-out; }

/* Insert indicator line */
.drag-insert-line {
  height: 3px; background: var(--green); border-radius: 3px;
  margin: 3px 0; pointer-events: none;
  animation: insertPop .15s var(--ease-spring);
}
@keyframes insertPop { from { transform: scaleX(.4); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* ── Ripple click effect ──────────────────────────────────────── */
.ripple {
  position: absolute; border-radius: 50%;
  width: 60px; height: 60px; margin: -30px 0 0 -30px;
  background: rgba(255,255,255,.25);
  animation: rippleOut .55s ease-out forwards;
  pointer-events: none;
}
@keyframes rippleOut {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(4); opacity: 0; }
}

/* ── FX canvas (confetti / loss) ──────────────────────────────── */
.fx-canvas {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9998;
  width: 100vw; height: 100vh;
}

/* ── Toast ────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 9px 20px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; z-index: 8000;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  animation: toastIn .22s var(--ease-spring);
}
.toast-error { background: var(--danger); }
.toast-success { background: var(--green-d); color: #1b2a00; }
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(12px); } }

/* ── Undo bar ─────────────────────────────────────────────────── */
.undo-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 12px;
  display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  box-shadow: var(--shadow-lg); z-index: 7000; font-size: 13.5px;
}
.undo-bar .btn-ghost { color: var(--green); border: none; font-weight: 700; padding: 0; }

/* ── Buttons base ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
  user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--green); color: #1b2a00; border-color: transparent; }
.btn-primary:hover { background: var(--green-d); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.btn-icon { padding: 7px; border: none; }
.btn-danger-ghost { background: transparent; border-color: #e3b4b4; color: var(--danger); }

/* ── Icons ────────────────────────────────────────────────────── */
.ico { width: 18px; height: 18px; display: inline-block; }
.ico svg { width: 100%; height: 100%; }
[data-ico] svg { width: 100%; height: 100%; }

/* ── Mobile responsive ────────────────────────────────────────── */
@media (max-width: 720px) {
  .app-layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sb-width); z-index: 50;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .app-body .sb-overlay { display: block; }

  .sb-overlay { display: block; }
  .app-body   { grid-column: 1; }
}


/* Final compact/theme/date/autocomplete improvements */
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #dde2ef;
  --text: #c5ccdc;
  --muted: #8a93aa;
  --panel: #222840;
  --bg: #161b2e;
  --line: #2d3451;
  --line-soft: #252c42;
  --green-bg: rgba(142,184,56,.12);
  --shadow: 0 2px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.5);
}
html[data-theme="dark"] body,
html[data-theme="dark"] .app-body,
html[data-theme="dark"] .content-area { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .modal,
html[data-theme="dark"] .voice-panel,
html[data-theme="dark"] .board,
html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .kpi-strip,
html[data-theme="dark"] .snapshot-strip { background: var(--panel); color: var(--text); border-color: var(--line); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: #171d31; color: var(--text); border-color: var(--line); }

.filter-bar { gap: 6px; padding: 6px 8px; min-height: 42px; }
.filter-bar .btn, .filter-bar select { min-height: 32px; padding: 5px 8px; }
.theme-select, .language-select { max-width: 96px; }
body.is-compact .kpi-strip,
body.is-compact .legend,
body.is-compact .snapshot-strip { display: none !important; }
body.is-compact .filter-bar { padding: 4px 6px; }
body.is-compact .topbar { min-height: 42px; height: 42px; }
body.is-board-focus .filter-bar,
body.is-board-focus .kpi-strip,
body.is-board-focus .legend,
body.is-board-focus .snapshot-strip { display: none !important; }
body.is-board-focus .content-area { padding-top: 4px; }
.board-wrap { flex: 1 1 auto; min-height: 0; }
.content-area { display: flex; flex-direction: column; min-height: 0; }
.board { min-height: 100%; }

.ac-drop { max-height: min(380px, 70vh); overflow: auto; }
.ac-item { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; cursor: pointer; }
.ac-item:hover, .ac-item[aria-selected="true"] { background: var(--green-bg); }
.ac-more { justify-content: center; font-weight: 700; color: var(--green-d); }
.ac-new { color: var(--green-d); }

label.has-date-picker { position: relative; }
.date-input { padding-right: 36px !important; }
.date-picker-button {
  position: absolute;
  right: 6px;
  bottom: 7px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.date-picker-button:hover { color: var(--green-d); border-color: var(--green-d); }
.date-picker-button svg { width: 15px; height: 15px; }

[modalAction], [modalaction] { cursor: pointer; }


/* ============================================================
   Runtime layout fixes: scrolling, compact board and admin pages
   ============================================================ */
.app-body {
  min-height: 0;
  overflow: hidden;
}
.content-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}
.content-area.board-content {
  overflow: hidden;
  padding: 0;
}
.content-area.scroll-content,
.content-area.settings-content,
.content-area.customers-content {
  overflow: auto;
  display: block;
}
.board-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  min-height: 42px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 12;
}
.board-toolbar .filter-search {
  flex: 1 1 260px;
  min-width: 180px;
  max-width: 420px;
}
.board-toolbar .filter-chips {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}
.board-toolbar .btn,
.board-toolbar select,
.board-tools summary {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12.5px;
  white-space: nowrap;
}
.board-tools {
  position: relative;
  flex: 0 0 auto;
}
.board-tools summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.board-tools summary::-webkit-details-marker { display: none; }
.board-tools-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 70;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 220px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg, var(--shadow));
}
.board-tools:not([open]) .board-tools-menu { display: none; }
.board-panels {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.board-panels:empty { display: none; }
.board-panels .kpi-strip,
.board-panels .legend,
.board-panels .snapshot-strip {
  margin: 0;
  padding: 6px 8px;
  box-shadow: none;
}
.board-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 8px 48px;
  -webkit-overflow-scrolling: touch;
}
body.is-compact .board-panels,
body.is-board-focus .board-panels,
body.is-board-focus .board-toolbar .filter-chips,
body.is-board-focus .board-tools {
  display: none !important;
}
body.is-compact .board-toolbar {
  min-height: 34px;
  padding: 3px 6px;
}
body.is-board-focus .board-toolbar {
  min-height: 32px;
  padding: 3px 6px;
}
.settings-main.admin-main {
  width: min(1180px, 100%);
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px;
}
.settings-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 0 10px;
  background: var(--bg);
}
.admin-panel.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  align-items: start;
  padding-bottom: 40px;
}
.settings-card {
  padding: 12px;
  border-radius: 12px;
}
.settings-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}
.admin-table {
  max-height: 260px;
  overflow: auto;
}
.admin-row {
  grid-template-columns: 54px 1fr minmax(64px, auto);
  padding: 6px 8px;
  gap: 8px;
}
.admin-form {
  gap: 8px;
}
.admin-form input,
.admin-form select,
.admin-form textarea {
  min-height: 32px;
  padding: 6px 8px;
}
@media (max-width: 760px) {
  .board-toolbar { flex-wrap: wrap; }
  .board-toolbar .filter-search { max-width: none; flex-basis: 100%; }
  .board-tools { margin-left: auto; }
  .board-tools-menu { right: auto; left: 0; }
  .settings-main.admin-main { padding: 10px; }
}


/* UI/UX visibility base override v3 */
html, body, .app-shell, .app-layout, .app-body { height: 100dvh; min-height: 0; }
.app-layout { display: grid; grid-template-columns: var(--sidebar-width-fixed, 248px) minmax(0,1fr); overflow: hidden; }
.app-body { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.content-area.board-content { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }


/* ============================================================
   FINAL RUNTIME/UI FIXES – board-first, accessible focus, theme
   ============================================================ */
html[data-theme="light"] {
  --ink:#111827;
  --text:#1f2937;
  --muted:#6b7280;
  --panel:#ffffff;
  --bg:#ffffff;
  --paper:#ffffff;
  --card:#ffffff;
  --line:#d9dee8;
  --line-soft:#edf0f5;
  --sb-bg:#f6f7fb;
  --sb-text:#263042;
  --sb-text-muted:#7b8495;
  --sb-active-bg:#e8f1dd;
  --sb-hover-bg:#edf0f5;
}
html[data-theme="light"] body,
html[data-theme="light"] .app-body,
html[data-theme="light"] .content-area,
html[data-theme="light"] .content-area.board-content,
html[data-theme="light"] .board-wrap { background:#ffffff !important; color:var(--text) !important; }
html[data-theme="light"] .sidebar { background:#f6f7fb !important; color:#263042 !important; border-right:1px solid #d9dee8 !important; }
html[data-theme="light"] .sb-ws-name,
html[data-theme="light"] .sb-item,
html[data-theme="light"] .sb-section-head { color:#263042 !important; }
html[data-theme="light"] .sb-search,
html[data-theme="light"] .filter-search,
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea { background:#ffffff !important; color:#111827 !important; border-color:#d9dee8 !important; }
html[data-theme="light"] input::placeholder { color:#8a94a6 !important; }
html[data-theme="light"] .topbar,
html[data-theme="light"] .board-toolbar { background:#ffffff !important; color:#111827 !important; border-color:#d9dee8 !important; box-shadow:none !important; }
html[data-theme="light"] .board,
html[data-theme="light"] .board-status-card,
html[data-theme="light"] .board-empty-card,
html[data-theme="light"] .modal,
html[data-theme="light"] .voice-panel,
html[data-theme="light"] .board-tools-menu { background:#ffffff !important; color:#1f2937 !important; border-color:#d9dee8 !important; }
html[data-theme="light"] .cell,
html[data-theme="light"] .ownerhead,
html[data-theme="light"] .colhead { background:#ffffff !important; border-color:#edf0f5 !important; color:#1f2937 !important; }
html[data-theme="light"] .colhead { background:#f8fafc !important; }
html[data-theme="light"] .card { background:#ffffff !important; color:#1f2937 !important; border-color:#d9dee8 !important; }
html[data-theme="light"] .btn { color:#1f2937; border-color:#d9dee8; background:#ffffff; }
html[data-theme="light"] .btn-primary { background:var(--green) !important; color:#17220d !important; border-color:transparent !important; }

html[data-theme="dark"] {
  --ink:#dde2ef;
  --text:#d7deea;
  --muted:#8e99ad;
  --panel:#1b2132;
  --bg:#0f1420;
  --paper:#0f1420;
  --card:#202739;
  --line:#2e374b;
  --line-soft:#273044;
}

svg, .ico svg, .filter-search svg, .sb-search svg, .btn svg { max-width:18px; max-height:18px; width:18px; height:18px; flex:0 0 auto; }
.btn-icon svg, .btn-icon .ico, .btn-icon .ico svg { max-width:18px; max-height:18px; width:18px; height:18px; }
.filter-search svg, .sb-search svg { max-width:16px; max-height:16px; width:16px; height:16px; }
.board-status-icon svg { max-width:26px; max-height:26px; width:26px; height:26px; }

.snapshot-rail { display:none !important; }
body.is-board-route .snapshot-rail:not([hidden]) { display:flex !important; }
body:not(.is-board-route) .snapshot-rail { display:none !important; }

.focus-exit-button {
  position: fixed;
  right: 14px;
  top: 12px;
  z-index: 1200;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-weight: 700;
}
body:not(.is-board-focus) .focus-exit-button { display:none !important; }
body.is-board-focus .topbar { display:none !important; }
body.is-board-focus .app-layout { grid-template-columns: 1fr !important; }
body.is-board-focus .sidebar { display:none !important; }
body.is-board-focus .content-area.board-content { height:100dvh !important; }
body.is-board-focus .board-wrap { height:100dvh !important; }

.voice-controls { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.voice-clear { min-height:36px; }
.voice-json { max-height:180px; overflow:auto; font-size:11px; }

.board-tools { position:relative; }
.board-tools-menu { position:absolute; right:0; top:calc(100% + 8px); z-index:1000; min-width:260px; max-height:min(70dvh, 560px); overflow:auto; padding:10px; border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow-lg); }
.content-area, .board-toolbar, .topbar { overflow:visible !important; }
.board-wrap { overflow:auto !important; }
