/* =========================================================================
   FastDatalists v2 — Design System
   Linear/Notion-inspired clean & minimal. Light + dark via [data-theme].
   ========================================================================= */

/* ── Tokens ────────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand: #ff7a00;            /* refined orange — more saturated than legacy */
  --brand-soft: #ff7a0014;
  --brand-hover: #e86d00;

  /* Neutrals — light theme defaults */
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #f7f7f8;
  --bg-hover: #f0f0f1;
  --bg-active: #e7e7e9;

  --border: #e6e6e8;
  --border-strong: #d4d4d8;

  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --text-disabled: #a1a1aa;

  /* Semantic */
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;

  /* Tier ramp (kept conceptually, modernised) */
  --tier-s: #ff6b6b;
  --tier-a: #ff9f43;
  --tier-b: #feca57;
  --tier-c: #fff48f;
  --tier-d: #b8e994;
  --tier-e: #6dd47e;
  --tier-f: #5ed4d4;
  --tier-na: #95afc0;

  /* Kanban column subtle backgrounds (light) */
  --col-1: #ecfdf5;
  --col-2: #fffbeb;
  --col-3: #fff7ed;
  --col-4: #eff6ff;
  --col-5: #fef2f2;

  /* Geometry */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.05);

  /* Spacing scale (8pt) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --slideover-w: 480px;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Roboto Mono', monospace;

  /* Transitions */
  --t-fast: 120ms ease;
  --t: 180ms ease;
  --t-slow: 280ms cubic-bezier(.2,.8,.2,1);
}

[data-theme='dark'] {
  --bg: #0b0b0d;
  --bg-elevated: #131316;
  --bg-subtle: #18181b;
  --bg-hover: #232327;
  --bg-active: #2a2a2f;

  --border: #26262a;
  --border-strong: #3a3a3f;

  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-disabled: #52525b;

  --col-1: #06281c;
  --col-2: #2c2010;
  --col-3: #2c1c10;
  --col-4: #102036;
  --col-5: #2a1414;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow:    0 4px 12px rgba(0,0,0,.45);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.6);

  --brand-soft: #ff7a0022;
}

/* ── Reset + base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--brand-soft); color: var(--text); }

/* ── App shell ────────────────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
}

[data-sidebar-collapsed='true'] #app {
  grid-template-columns: 56px 1fr;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-subtle);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s4) var(--s4);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  color: var(--text);
  height: var(--topbar-h);
  flex: 0 0 auto;
}
.sidebar-brand .bolt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  flex: 0 0 auto;
}
.sidebar-brand-text {
  white-space: nowrap;
  overflow: hidden;
}
[data-sidebar-collapsed='true'] .sidebar-brand-text,
[data-sidebar-collapsed='true'] .sidebar-section-label,
[data-sidebar-collapsed='true'] .sidebar-link-text,
[data-sidebar-collapsed='true'] .sidebar-user { display: none; }

[data-sidebar-collapsed='true'] .sidebar-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-section {
  padding: var(--s2) var(--s3);
}
.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: var(--s2) var(--s2);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s2);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  user-select: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.sidebar-link:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-link.active {
  background: var(--bg-active);
  color: var(--text);
}
.sidebar-link .icon {
  width: 16px;
  text-align: center;
  flex: 0 0 16px;
  color: var(--text-muted);
}
.sidebar-link.active .icon { color: var(--brand); }

.sidebar-spacer { flex: 1 1 auto; }

.sidebar-footer {
  padding: var(--s3);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  flex: 0 0 auto;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 12px;
  color: var(--text-muted);
  padding: var(--s2);
  word-break: break-all;
}
.sidebar-user .avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
}

/* ── Main column ──────────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0 var(--s5);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
}
.topbar-spacer { flex: 1 1 auto; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { background: var(--bg-active); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
}
.btn-block { width: 100%; }
.btn-lg { padding: 10px 16px; font-size: 14px; }

/* ── Segmented view switcher ──────────────────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}
.segmented button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ── Search input ─────────────────────────────────────────────────────── */
.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 280px;
  max-width: 100%;
}
.search input {
  width: 100%;
  height: 32px;
  padding: 0 var(--s3) 0 32px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.search input::placeholder { color: var(--text-muted); }
.search input:focus { border-color: var(--brand); background: var(--bg-elevated); }
.search .search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 12px;
}

/* ── Content area ─────────────────────────────────────────────────────── */
.content { padding: var(--s5); min-height: calc(100vh - var(--topbar-h)); }

/* ── Sort chips ───────────────────────────────────────────────────────── */
.sort-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}
.sort-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: var(--s2);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip:hover { background: var(--bg-hover); color: var(--text); }
.chip.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
.chip .arrow {
  font-size: 10px;
  opacity: .8;
}

/* ── Metrics row ──────────────────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s5);
}
.metric-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.metric-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.metric-card .metric-icon {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  flex: 0 0 auto;
}
.metric-card .metric-name { font-weight: 600; font-size: 13px; color: var(--text); line-height: 1.2; }
.metric-card .metric-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.metric-card .metric-value {
  margin-left: auto;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── List view ────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.list-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.list-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.list-item-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-disabled);
}
.list-item-body { flex: 1 1 auto; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 14px; color: var(--text); }
.list-item-title .year { font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.list-item-sub {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.list-item-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-item-platform {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
}
.badge.badge-c1 { background: var(--col-1); color: var(--success); border-color: transparent; }
.badge.badge-c2 { background: var(--col-2); color: var(--warning); border-color: transparent; }
.badge.badge-c3 { background: var(--col-3); color: var(--warning); border-color: transparent; }
.badge.badge-c4 { background: var(--col-4); color: var(--info); border-color: transparent; }
.badge.badge-c5 { background: var(--col-5); color: var(--danger); border-color: transparent; }

.score-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 32px;
  padding: 0 var(--s3);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: var(--bg-subtle);
  color: var(--text);
  flex: 0 0 auto;
}
.score-pill.score-good { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.score-pill.score-mid  { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning); }
.score-pill.score-bad  { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* ── Kanban view ──────────────────────────────────────────────────────── */
.kanban {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(220px, 1fr));
  gap: var(--s3);
  align-items: start;
}
.kanban-col {
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  padding: var(--s2);
  display: flex;
  flex-direction: column;
  min-height: 200px;
  border: 1px solid var(--border);
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s2) var(--s3);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.kanban-col-count {
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}
.kanban-col-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s1);
  min-height: 60px;
}

.kanban-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: grab;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.kanban-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card .poster {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-subtle);
}
.kanban-card .label {
  padding: var(--s2) var(--s3);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Tier list ────────────────────────────────────────────────────────── */
.tier {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tier-row {
  display: flex;
  min-height: 96px;
  background: var(--bg-elevated);
}
.tier-label {
  width: 96px;
  flex: 0 0 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 28px;
  color: #1a1a1a;
  letter-spacing: -.02em;
}
.tier-row[data-tier='s-tier']  .tier-label { background: var(--tier-s); }
.tier-row[data-tier='a-tier']  .tier-label { background: var(--tier-a); }
.tier-row[data-tier='b-tier']  .tier-label { background: var(--tier-b); }
.tier-row[data-tier='c-tier']  .tier-label { background: var(--tier-c); }
.tier-row[data-tier='d-tier']  .tier-label { background: var(--tier-d); }
.tier-row[data-tier='e-tier']  .tier-label { background: var(--tier-e); }
.tier-row[data-tier='f-tier']  .tier-label { background: var(--tier-f); }
.tier-row[data-tier='u-tier']  .tier-label { background: var(--tier-na); font-size: 18px; }
.tier-row[data-tier='unsorted'] {
  background: var(--bg-subtle);
}
.tier-row[data-tier='unsorted'] .tier-label {
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.tier-cell {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  padding: var(--s2);
  align-content: flex-start;
  min-height: 96px;
}
.tier-tile {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: grab;
  background: var(--bg-subtle);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.tier-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tier-tile:active { cursor: grabbing; }

/* SortableJS visual cues */
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 0 0 2px var(--brand); border-radius: var(--radius); }

/* ── Slide-over panel ─────────────────────────────────────────────────── */
.slideover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
  z-index: 50;
}
.slideover-overlay.open { opacity: 1; visibility: visible; }

.slideover {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--slideover-w);
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--t-slow);
  z-index: 51;
  display: flex;
  flex-direction: column;
}
.slideover.open { transform: translateX(0); }

.slideover-header {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.slideover-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1 1 auto;
}
.slideover-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--s4);
}
.slideover-footer {
  border-top: 1px solid var(--border);
  padding: var(--s3) var(--s4);
  display: flex;
  gap: var(--s2);
  justify-content: flex-end;
  flex: 0 0 auto;
}

/* ── Forms ────────────────────────────────────────────────────────────── */
.field { margin-bottom: var(--s3); }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.input, .textarea, .select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast);
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); }
.textarea { min-height: 72px; resize: vertical; font-family: inherit; }
.search-term {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  min-height: 36px;
  color: var(--text);
}
.search-term:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

.preview-img {
  width: 96px;
  height: 96px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.lookup-results { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); }
.lookup-result {
  display: flex;
  gap: var(--s3);
  padding: var(--s3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.lookup-result:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.lookup-result img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--bg-subtle);
}
.lookup-result .name { font-weight: 600; font-size: 13px; color: var(--text); }
.lookup-result .desc { font-size: 12px; color: var(--text-muted); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── Login screen ─────────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, var(--brand-soft), transparent 40%),
    radial-gradient(circle at 80% 80%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 40%),
    var(--bg);
  padding: var(--s4);
}
.auth-card {
  width: 380px;
  max-width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--s6);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  justify-content: center;
  margin-bottom: var(--s5);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.auth-brand .bolt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
}
.auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: var(--s4); font-size: 13px; }
.auth-link { color: var(--text-muted); font-size: 12px; text-align: center; display: block; margin-top: var(--s3); }
.auth-link:hover { color: var(--text); }
.auth-footer { text-align: center; margin-top: var(--s5); font-size: 11px; color: var(--text-muted); }
.auth-error { color: var(--danger); font-size: 12px; text-align: center; margin-top: var(--s2); min-height: 16px; }
.auth-ok    { color: var(--success); font-size: 12px; text-align: center; margin-top: var(--s2); min-height: 16px; }

.notice {
  background: var(--brand-soft);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: var(--s3);
}

/* ── Loading skeleton ─────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-subtle) 0%,
    var(--bg-hover) 50%,
    var(--bg-subtle) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--s2);
}
.skeleton-thumb { width: 64px; height: 64px; border-radius: var(--radius-sm); }
.skeleton-line { height: 12px; }

/* ── Empty states ─────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: var(--s7) var(--s4);
  color: var(--text-muted);
}
.empty .empty-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-muted);
  margin-bottom: var(--s3);
}
.empty .empty-title { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.empty .empty-desc  { font-size: 13px; }

/* ── Toast notifications ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--s4);
  right: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s3) var(--s4);
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 240px;
  max-width: 360px;
  pointer-events: auto;
  animation: toastIn .18s ease;
}
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-info    { border-left: 3px solid var(--info); }
@keyframes toastIn {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 30;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform var(--t);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-mobile-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0; visibility: hidden;
    transition: opacity var(--t), visibility var(--t);
    z-index: 29;
  }
  .sidebar-mobile-backdrop.open { opacity: 1; visibility: visible; }
  .topbar { padding: 0 var(--s3); }
  .search { width: 160px; }
  .slideover { width: 100vw; }
  .content { padding: var(--s3); }
  .kanban { grid-template-columns: minmax(220px, 1fr); }
  .tier-label { width: 64px; flex-basis: 64px; font-size: 22px; }
  .field-row { grid-template-columns: 1fr; }
}

/* ── Utility classes ──────────────────────────────────────────────────── */
.d-md-none { display: none; }
.d-hide-sm { display: inline; margin-left: 4px; }
@media (max-width: 768px) {
  .d-md-none { display: inline-flex; }
  .d-hide-sm { display: none; }
}

/* Hide legacy classes that may still be referenced but are no-ops */
#particles-js, .modal-backdrop-custom { display: none !important; }

/* ── Utility classes ──────────────────────────────────────────────────── */
.d-md-none { display: none; }
.d-hide-sm { display: inline; }
@media (max-width: 768px) {
  .d-md-none { display: inline-flex; }
  .d-hide-sm { display: none; }
}
