/* ============================================
   TaskFlow — Design Tokens & Base Styles
   ============================================ */

:root {
  /* Accent (default — overridden by tweak) */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #dbeafe;
  --accent-fg: #ffffff;

  /* Surfaces */
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-sunken: #eef0f3;
  --bg-hover: #f1f3f6;

  /* Borders */
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  /* Text */
  --fg: #0f172a;
  --fg-muted: #475569;
  --fg-subtle: #94a3b8;
  --fg-on-accent: #ffffff;

  /* Semantic */
  --p1: #dc2626;       /* červená — urgent */
  --p2: #ea580c;       /* oranžová — high */
  --p3: #ca8a04;       /* žltá — medium */
  --p4: #64748b;       /* sivá — low */
  --p1-bg: #fee2e2;
  --p2-bg: #ffedd5;
  --p3-bg: #fef3c7;
  --p4-bg: #e2e8f0;

  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --info: #0284c7;

  /* Tag palette (muted) */
  --tag-blue:   #1d4ed8; --tag-blue-bg:   #dbeafe;
  --tag-purple: #6d28d9; --tag-purple-bg: #ede9fe;
  --tag-pink:   #be185d; --tag-pink-bg:   #fce7f3;
  --tag-teal:   #0f766e; --tag-teal-bg:   #ccfbf1;
  --tag-amber:  #92400e; --tag-amber-bg:  #fef3c7;
  --tag-slate:  #334155; --tag-slate-bg:  #e2e8f0;

  /* Avatar palette */
  --av-1: #2563eb; --av-2: #db2777; --av-3: #0d9488;
  --av-4: #ea580c; --av-5: #7c3aed; --av-6: #65a30d;
  --av-7: #b45309; --av-8: #0284c7;

  /* Radii */
  --r-sm: 4px;
  --r: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow:    0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 4px 8px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 24px 60px rgba(15, 23, 42, 0.18);

  /* Density */
  --row-h: 40px;
  --pad: 16px;
  --pad-sm: 12px;
  --pad-xs: 8px;

  /* Type scale */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 32px;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 56px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-elev: #14171d;
  --bg-sunken: #0a0c11;
  --bg-hover: #1c2029;

  --border: #22262f;
  --border-strong: #2d323d;

  --fg: #e6e9ef;
  --fg-muted: #9aa3b2;
  --fg-subtle: #6b7384;

  --accent-soft: #1e3a8a40;

  --p1-bg: #7f1d1d40;
  --p2-bg: #7c2d1240;
  --p3-bg: #78350f40;
  --p4-bg: #33415540;

  --tag-blue-bg:   #1e3a8a40;
  --tag-purple-bg: #4c1d9540;
  --tag-pink-bg:   #83184340;
  --tag-teal-bg:   #134e4a40;
  --tag-amber-bg:  #78350f40;
  --tag-slate-bg:  #33415540;

  --success-bg: #14532d40;
  --warning-bg: #78350f40;

  --shadow-xs: 0 1px 1px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow:    0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.6);
}

:root[data-density="compact"] {
  --row-h: 32px;
  --pad: 12px;
  --pad-sm: 8px;
  --pad-xs: 6px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-md);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  overflow: hidden;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--fg-subtle);
}

/* ============================================
   App shell
   ============================================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  background: var(--bg);
}

.app.no-sidebar {
  grid-template-columns: 1fr;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  background: var(--accent);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.sidebar-brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.workspace-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.12s;
}
.workspace-switcher:hover { background: var(--bg-hover); }

.workspace-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--r);
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: grid;
  place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
}

.workspace-info {
  flex: 1;
  min-width: 0;
}
.workspace-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-meta {
  font-size: 11px;
  color: var(--fg-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 16px;
}

.sidebar-section {
  margin-top: 14px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section-title button {
  color: var(--fg-subtle);
  width: 18px;
  height: 18px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
}
.sidebar-section-title button:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: background 0.12s, color 0.12s;
  margin: 1px 0;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--bg-sunken);
  color: var(--fg-muted);
  padding: 1px 6px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
}
.nav-item.active .badge {
  background: var(--accent);
  color: white;
}

.project-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  flex: 1;
  cursor: pointer;
  min-width: 0;
}
.user-chip:hover { background: var(--bg-hover); }

.user-chip-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-email {
  font-size: 11px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   Top bar
   ============================================ */

.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-muted);
  min-width: 0;
}
.crumbs .sep { color: var(--fg-subtle); }
.crumbs strong {
  color: var(--fg);
  font-weight: 600;
}

.search {
  flex: 1;
  max-width: 480px;
  position: relative;
  margin-left: auto;
}
.search input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  outline: none;
  font-size: 13px;
  transition: border 0.12s, box-shadow 0.12s;
}
.search input::placeholder {
  color: var(--fg-subtle);
}
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--fg-subtle);
}
.search .kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
}

.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.kbd kbd {
  font-family: var(--font);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  font-size: 10.5px;
  color: var(--fg-muted);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
}
.icon-btn .icon {
  width: 18px;
  height: 18px;
}
.icon-btn .dot-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--p1);
  border: 2px solid var(--bg-elev);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.12s;
}
.btn .icon { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elev);
  color: var(--fg);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

/* ============================================
   Content area
   ============================================ */

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 80px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
}
.page-subtitle {
  color: var(--fg-muted);
  font-size: 13.5px;
  margin-top: 4px;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================
   Card
   ============================================ */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 13.5px;
  font-weight: 600;
}
.card-body { padding: 16px; }

/* ============================================
   Avatar
   ============================================ */

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  border: 2px solid var(--bg-elev);
  box-sizing: border-box;
  letter-spacing: -0.02em;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; border-width: 1.5px; }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.avatar.xl { width: 56px; height: 56px; font-size: 18px; }

.avatar-group {
  display: inline-flex;
  align-items: center;
}
.avatar-group .avatar:not(:first-child) {
  margin-left: -8px;
}
.avatar-group.sm .avatar:not(:first-child) {
  margin-left: -6px;
}
.avatar-extra {
  background: var(--bg-sunken);
  color: var(--fg-muted);
  border: 2px solid var(--bg-elev);
}

/* ============================================
   Badges & pills
   ============================================ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
}

.tag.blue   { background: var(--tag-blue-bg);   color: var(--tag-blue); }
.tag.purple { background: var(--tag-purple-bg); color: var(--tag-purple); }
.tag.pink   { background: var(--tag-pink-bg);   color: var(--tag-pink); }
.tag.teal   { background: var(--tag-teal-bg);   color: var(--tag-teal); }
.tag.amber  { background: var(--tag-amber-bg);  color: var(--tag-amber); }
.tag.slate  { background: var(--tag-slate-bg);  color: var(--tag-slate); }

.priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}
.priority .flag {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.priority.p1 { color: var(--p1); } .priority.p1 .flag { background: var(--p1); }
.priority.p2 { color: var(--p2); } .priority.p2 .flag { background: var(--p2); }
.priority.p3 { color: var(--p3); } .priority.p3 .flag { background: var(--p3); }
.priority.p4 { color: var(--p4); } .priority.p4 .flag { background: var(--p4); }

/* ============================================
   Kanban
   ============================================ */

.kanban {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  height: 100%;
  padding-bottom: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.column {
  width: 296px;
  flex-shrink: 0;
  background: var(--bg-sunken);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  scroll-snap-align: start;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
}
.column-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.column-title .col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.column-count {
  background: var(--bg-elev);
  color: var(--fg-muted);
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-full);
}
.column-actions { margin-left: auto; display: flex; gap: 2px; }

.column-body {
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.column-add {
  margin: 4px 8px 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--fg-muted);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.column-add:hover { background: var(--bg-hover); color: var(--fg); }

/* Kanban card */
.kanban-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: box-shadow 0.12s, border-color 0.12s, transform 0.12s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.kanban-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.kanban-card .card-cover {
  height: 80px;
  border-radius: var(--r);
  margin: -10px -12px 0;
  border-bottom: 1px solid var(--border);
}

.kanban-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--fg);
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--fg-muted);
  flex-wrap: wrap;
}
.kanban-card-meta .item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kanban-card-meta .icon { width: 13px; height: 13px; }

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

/* Compact kanban */
.kanban.compact .column { width: 264px; }
.kanban.compact .kanban-card { padding: 7px 10px; gap: 5px; }
.kanban.compact .kanban-card-title { font-size: 12.5px; }
.kanban.compact .kanban-card .card-cover { display: none; }

/* ============================================
   List view
   ============================================ */

.list-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elev);
  font-size: 13px;
}
.list-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  z-index: 1;
}
.list-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.list-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.list-table tbody tr:hover { background: var(--bg-hover); }

.list-group-header td {
  background: var(--bg-sunken);
  font-weight: 600;
  font-size: 12px;
  color: var(--fg-muted);
  padding: 8px 12px;
}

.checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  background: var(--bg-elev);
  transition: border 0.1s, background 0.1s;
  flex-shrink: 0;
}
.checkbox:hover { border-color: var(--accent); }
.checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.checkbox.checked svg { display: block; }
.checkbox svg { width: 12px; height: 12px; display: none; }

/* ============================================
   Modal
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal {
  background: var(--bg-elev);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 920px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease-out;
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.modal-main {
  padding: 20px 24px;
  overflow-y: auto;
}

.modal-side {
  border-left: 1px solid var(--border);
  background: var(--bg);
  padding: 20px;
  overflow-y: auto;
}

/* ============================================
   Notifications dropdown
   ============================================ */

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  animation: slideUp 0.15s ease-out;
}

/* ============================================
   Skeleton
   ============================================ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-sunken) 0%, var(--bg-hover) 50%, var(--bg-sunken) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r);
}

/* ============================================
   Toast
   ============================================ */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  animation: slideInRight 0.2s ease-out;
  pointer-events: auto;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast .icon { width: 16px; height: 16px; }
.toast.success .icon { color: var(--success); }
.toast.info .icon { color: var(--info); }
.toast.danger .icon { color: var(--p1); }

/* ============================================
   Mobile bottom nav
   ============================================ */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  z-index: 40;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  color: var(--fg-subtle);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
}
.bottom-nav-item .icon {
  width: 22px;
  height: 22px;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item .bn-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  background: var(--p1);
  color: white;
  border-radius: var(--r-full);
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  border: 1.5px solid var(--bg-elev);
}

.fab {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 41;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-lg);
  align-items: center;
  justify-content: center;
}
.fab .icon { width: 22px; height: 22px; }

/* ============================================
   Mobile responsive
   ============================================ */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 60;
    transition: left 0.25s ease;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { left: 0; }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 55;
    animation: fadeIn 0.2s;
  }

  .topbar { padding: 0 12px; gap: 8px; }
  .search { max-width: none; }
  .search .kbd { display: none; }
  .crumbs .crumb-hide { display: none; }
  .topbar-action-hide { display: none; }

  .content { padding: 16px 12px 96px; }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions { width: 100%; flex-wrap: wrap; }

  .bottom-nav { display: block; }
  .fab { display: flex; }

  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none;
    max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    width: 100%;
  }
  .modal-body { grid-template-columns: 1fr; overflow-y: auto; }
  .modal-side { border-left: none; border-top: 1px solid var(--border); }
}

/* utility */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.empty-grow { flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shrink-0 { flex-shrink: 0; }

/* Click-to-edit illusion */
.clickable { cursor: pointer; user-select: none; }

/* iframe stage helpers for canvas embeds */
html.embed body { background: var(--bg); }
