:root {
  /* Light — cool slate/indigo */
  --bg: #eef0f6;
  --surface: #ffffff;
  --surface-raised: #f5f6fa;
  --border: #dde1ed;
  --border-light: #eaecf4;
  --hover-bg: #f0f2f9;
  --text: #0f1020;
  --text-sec: #363a5c;
  --text-dim: #6b72a0;
  --accent: #6d28d9;
  --accent-light: #ede9fe;
  --accent-text: #5b21b6;
  --green: #059669;
  --green-bg: #ecfdf5;
  --green-text: #065f46;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-text: #991b1b;
  --yellow: #d97706;
  --yellow-bg: #fffbeb;
  --yellow-text: #92400e;
  --tag-bg: #eef0f6;
  --modal-bg: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

[data-theme="dark"] {
  /* Dark — deep navy/violet */
  --bg: #06070d;
  --surface: #0e1019;
  --surface-raised: #161a2a;
  --border: #252840;
  --border-light: #1e2035;
  --hover-bg: #1e2138;
  --text: #e2e4f0;
  --text-sec: #8b90b8;
  --text-dim: #7a7fa3;
  --accent: #a78bfa;
  --accent-light: #2d2458;
  --accent-text: #c4b5fd;
  --green: #34d399;
  --green-bg: #042f1e;
  --green-text: #6ee7b7;
  --red: #f87171;
  --red-bg: #2d1515;
  --red-text: #fca5a5;
  --yellow: #fbbf24;
  --yellow-bg: #2d1f04;
  --yellow-text: #fde68a;
  --tag-bg: #1a1d2e;
  --modal-bg: #0e1019;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

::selection { background: var(--accent-light); }

input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: 4px;
}

/* ── Animations ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes float1 { 0%, 100% { transform: translate(0,0) rotate(0deg); } 50% { transform: translate(12px,-18px) rotate(3deg); } }
@keyframes float2 { 0%, 100% { transform: translate(0,0) rotate(0deg); } 50% { transform: translate(-10px,14px) rotate(-2deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login Screen ── */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; position: relative; overflow: hidden;
}

.login-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.login-orb { position: absolute; border-radius: 50%; }
.login-orb-1 { top: 8%; left: 10%; width: 320px; height: 320px; background: radial-gradient(circle, rgba(37,99,235,0.06) 0%, transparent 70%); animation: float1 8s ease-in-out infinite; }
.login-orb-2 { bottom: 10%; right: 8%; width: 400px; height: 400px; background: radial-gradient(circle, rgba(139,92,246,0.05) 0%, transparent 70%); animation: float2 10s ease-in-out infinite; }
.login-dots { position: absolute; inset: 0; opacity: 0.3; }

.login-card {
  position: relative; width: 420px; background: var(--surface); border-radius: 20px;
  border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,0.06);
  padding: 48px 40px; text-align: center; animation: fadeUp 0.6s ease;
}

.login-logo {
  width: 200px; height: 200px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
}

/* Theme-aware logos */
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }


.login-subtitle { font-size: 14.5px; color: var(--text-dim); margin-bottom: 36px; line-height: 1.5; }

.login-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 14px 24px; background: #1a1a18; border: none; border-radius: 12px;
  color: #fff; font-size: 15px; font-weight: 600; font-family: inherit;
  text-decoration: none; cursor: pointer; transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.login-btn:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.15); transform: translateY(-1px); }

.login-divider {
  display: flex; align-items: center; gap: 14px; margin: 28px 0 24px;
}
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-divider span { font-size: 11px; color: #c5c3be; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }

.login-features { display: flex; justify-content: center; gap: 24px; }
.login-feature { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.login-feature-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--tag-bg); display: flex; align-items: center; justify-content: center; color: var(--text-sec); }
.login-feature span { font-size: 11px; color: var(--text-dim); font-weight: 500; }

/* Footer links on the login screen */
.login-page-links {
  display: flex; justify-content: center; gap: 10px;
  margin-top: 24px; font-size: 12px; color: var(--text-dim);
}
.login-page-links a { color: var(--text-sec); text-decoration: none; transition: color 0.15s; }
.login-page-links a:hover { color: var(--text); text-decoration: underline; }
.login-page-links span { user-select: none; }

/* ── Static info pages (Privacy & Terms, About) ── */
.static-page-body { background: var(--bg); color: var(--text); min-height: 100vh; }
.static-page {
  max-width: 760px; margin: 0 auto; padding: 32px 24px 64px;
  display: flex; flex-direction: column; min-height: 100vh;
}
.static-page-header { margin-bottom: 24px; }
.static-page-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-sec); text-decoration: none;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  transition: background 0.15s, color 0.15s;
}
.static-page-back:hover { background: var(--hover-bg); color: var(--text); }

.static-page-content { flex: 1; line-height: 1.65; }
.static-page-content h1 {
  font-size: 32px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.static-page-meta { font-size: 13px; color: var(--text-dim); margin: 0 0 32px; }
.static-page-content h2 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  margin: 32px 0 16px; padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
.static-page-content section:first-of-type h2 { border-top: none; padding-top: 0; margin-top: 16px; }
.static-page-content h3 {
  font-size: 16px; font-weight: 600;
  margin: 24px 0 8px; color: var(--text);
}
.static-page-content p, .static-page-content ul { margin: 0 0 14px; color: var(--text-sec); }
.static-page-content ul { padding-left: 20px; }
.static-page-content li { margin-bottom: 6px; }
.static-page-content strong { color: var(--text); font-weight: 600; }
.static-page-content a { color: var(--accent-text); text-decoration: underline; text-decoration-color: var(--border); transition: text-decoration-color 0.15s; }
.static-page-content a:hover { text-decoration-color: var(--accent); }
.static-page-content code {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.92em;
  background: var(--tag-bg); padding: 1px 6px; border-radius: var(--radius-xs);
  color: var(--text);
}

.static-page-hero {
  text-align: center; margin: 8px 0 32px;
}
.static-page-hero h1 { margin: 8px 0 4px; }
.static-page-tagline { font-size: 15px; color: var(--text-sec); margin: 0 auto; max-width: 480px; }

.static-page-footer {
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border-light);
  display: flex; justify-content: center; gap: 10px;
  font-size: 12px; color: var(--text-dim);
}
.static-page-footer a { color: var(--text-sec); text-decoration: none; }
.static-page-footer a:hover { color: var(--text); text-decoration: underline; }
.static-page-footer span { user-select: none; }

/* ── App Layout ── */
.app { display: none; }
.app.active { display: flex; flex-direction: column; min-height: 100vh; }
.app-body { display: flex; flex: 1; }

/* ── Top Bar ── */
.topbar {
  height: 96px; display: flex; align-items: center; justify-content: space-between;
  padding: 3px 24px; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.topbar-brand { display: flex; align-items: center; gap: 8px; min-width: 196px; }
.topbar-logo { width: 90px; height: 90px; display: flex; align-items: center; justify-content: center; }
.topbar-selectors { display: flex; gap: 16px; }
.topbar-selectors select {
  background-color: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 500; padding: 9px 28px 9px 5px;
  border-radius: var(--radius-sm); cursor: pointer; min-width: 200px; max-width: 280px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpolygon points='0,2 10,2 5,8' fill='%236b72a0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
}
.topbar-selectors select:focus { outline: none; border-color: var(--accent); }
.topbar-selectors select:disabled { opacity: 0.5; cursor: default; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ── User Menu Dropdown ── */
.user-menu-wrap { position: relative; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s; user-select: none;
}
.topbar-user:hover { background: var(--hover-bg); }
.topbar-user.open { background: var(--hover-bg); }
.user-menu-caret { color: var(--text-dim); transition: transform 0.2s; flex-shrink: 0; }
.topbar-user.open .user-menu-caret { transform: rotate(180deg); }

.user-menu-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  min-width: 220px; z-index: 50; animation: fadeUp 0.15s ease;
  overflow: hidden;
}
.user-menu-dropdown.open { display: block; }

.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 13.5px; font-weight: 500;
  color: var(--text); cursor: pointer; transition: background 0.12s;
}
.user-menu-item:hover { background: var(--hover-bg); }
.user-menu-item-icon { display: flex; align-items: center; color: var(--text-sec); }
.user-menu-item-danger { color: var(--red); }
.user-menu-item-danger .user-menu-item-icon { color: var(--red); }
.user-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
}
.topbar-user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.topbar-user-email { font-size: 11px; color: var(--text-dim); }


/* ── Sidebar ── */
.sidebar {
  width: 220px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.sidebar-section-label {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1.2px; padding: 0 12px; margin-bottom: 4px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-size: 13.5px; font-weight: 400; font-family: inherit;
  text-transform: capitalize; transition: all 0.15s;
  background: transparent; color: var(--text); text-align: left; width: 100%;
}
.sidebar-item svg { opacity: 0.55; }
.sidebar-item:hover { background: var(--hover-bg); }
.sidebar-item.active { background: var(--accent-light); color: var(--accent-text); font-weight: 600; }
.sidebar-item.active svg { opacity: 1; color: var(--accent); }
.sidebar-item:disabled { opacity: 0.45; cursor: not-allowed; }
.sidebar-item:disabled:hover { background: transparent; }
.sidebar-item.cc-danger { color: var(--red); }
.sidebar-item.cc-danger:disabled { color: var(--text-dim); }

.sidebar-count {
  margin-left: auto; font-size: 11px; font-weight: 500;
  color: var(--text-dim); background: var(--tag-bg); padding: 1px 7px; border-radius: 10px;
}
.sidebar-item.active .sidebar-count { color: var(--accent); background: var(--accent-light); }

.sidebar-divider { height: 1px; background: var(--border); margin: 16px 8px; }
.sidebar-spacer { flex: 1; }

/* ── Main Content ── */
.main { flex: 1; padding: 24px 28px; overflow: auto; }

.main-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.main-title { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }
.main-subtitle { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

.selection-badge {
  padding: 6px 14px; background: var(--accent-light); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: var(--accent); animation: fadeUp 0.2s ease;
}

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 10px; flex-wrap: wrap;
}

.search-wrap {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; width: 260px;
}
.search-wrap svg { color: var(--text-dim); flex-shrink: 0; }
.search-input {
  border: none; outline: none; padding: 9px 8px; font-size: 13px;
  font-family: inherit; background: transparent; color: var(--text); width: 100%;
}
.search-input::placeholder { color: var(--text-dim); }

.toolbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Filter chips above the table */
.filter-bar {
  display: flex; gap: 8px; padding: 0 28px 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light); margin-bottom: 0;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; font-family: inherit; font-size: 12px; font-weight: 500;
  border-radius: 999px; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-sec);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-chip:hover { background: var(--hover-bg); color: var(--text); }
.filter-chip.active {
  background: var(--accent-light); color: var(--accent-text);
  border-color: var(--accent-light);
}
.filter-chip[hidden] { display: none; }
.filter-chip-count {
  font-size: 11px; font-weight: 600; padding: 1px 7px;
  border-radius: 999px; background: var(--bg); color: var(--text-dim);
  min-width: 18px; text-align: center;
}
.filter-chip.active .filter-chip-count { background: rgba(255,255,255,0.7); color: var(--accent-text); }
[data-theme="dark"] .filter-chip.active .filter-chip-count { background: rgba(0,0,0,0.3); color: var(--accent-text); }
.filter-chip-count:empty { display: none; }
.filter-chip-count.loading::after { content: '…'; }

/* Download report — sits inline with the filter chips with a small visual
   separator before it so it reads as an action, not a filter. */
.report-download-wrap {
  position: relative;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
/* Trigger button: same shape as filter chips but transparent fill so it reads
   as an action (download), not a state toggle (filter). */
.report-download-trigger {
  background: transparent;
  border-style: dashed;
}
.report-download-trigger:hover {
  background: var(--hover-bg);
  border-style: solid;
  color: var(--text);
}
.report-download-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: none; flex-direction: column; gap: 2px;
  z-index: 50;
}
.report-download-menu.open { display: flex; }
.report-download-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px 10px; border-radius: var(--radius-xs);
  background: transparent; border: none; cursor: pointer;
  font-family: inherit; text-align: left; width: 100%;
  transition: background 0.15s;
}
.report-download-item:hover:not([disabled]) { background: var(--hover-bg); }
.report-download-item[disabled] { opacity: 0.45; cursor: not-allowed; }
.report-download-item-fmt { font-size: 12.5px; font-weight: 600; color: var(--text); }
.report-download-item-desc { font-size: 11px; color: var(--text-dim); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-family: inherit; font-size: 12.5px; font-weight: 500;
  border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--border);
  background: var(--tag-bg); color: var(--text); transition: all 0.15s;
}
.pill:hover { background: var(--hover-bg); border-color: var(--border); }
.pill:disabled { opacity: 0.4; cursor: not-allowed; }
.pill-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill-accent:hover { filter: brightness(1.1); }
.pill-danger { background: var(--red-bg); color: var(--red); border-color: #fecaca; }
.pill-danger:hover { filter: brightness(0.95); }

/* ── Table ── */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead tr { border-bottom: 1px solid var(--border); }

th {
  text-align: left; padding: 11px 16px; font-weight: 600;
  color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
}

td { padding: 12px 16px; }
tr:not(:last-child) td { border-bottom: 1px solid var(--border-light); }
tbody tr { transition: background 0.1s; animation: fadeUp 0.25s ease both; }
tbody tr:hover { background: var(--hover-bg); }

td.name-cell { font-weight: 500; }
.type-badge {
  font-size: 12px; padding: 3px 10px; border-radius: var(--radius-xs);
  background: var(--tag-bg); color: var(--text-sec); font-weight: 500;
}
.entity-id {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--text-dim);
}

/* "Used by" count cell */
.used-by-empty { color: var(--text-dim); font-size: 13px; }
.used-by-zero  { color: var(--text-dim); font-size: 12px; font-weight: 500; padding: 2px 8px; }
.used-by-count {
  font-family: inherit; font-size: 12px; font-weight: 600;
  background: var(--accent-light); color: var(--accent-text);
  border: 1px solid transparent; border-radius: 999px;
  padding: 2px 10px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.used-by-count:hover { border-color: var(--accent); }

/* Expandable detail row showing the list of referrers */
.ref-detail-row td.ref-detail-cell {
  background: var(--surface-raised);
  padding: 12px 18px 14px 60px;
  border-top: 1px dashed var(--border);
}
.ref-detail-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-dim); margin-bottom: 8px;
}
.ref-detail-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ref-detail-list li {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; padding: 4px 8px; border-radius: var(--radius-xs);
  background: var(--surface);
}
.ref-detail-list .ref-kind  { font-size: 13px; flex-shrink: 0; }
.ref-detail-list .ref-name  { font-weight: 500; color: var(--text); flex: 1; min-width: 0;
                              overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-detail-list .ref-where { font-size: 11px; color: var(--text-dim); font-style: italic; flex-shrink: 0; }

/* Inline badge for orphan / broken-ref rows */
.row-badge {
  display: inline-block; margin-left: 8px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 7px; border-radius: 999px; vertical-align: middle;
  cursor: help;
}
.row-badge.orphan { background: var(--yellow-bg); color: var(--yellow-text); }
.row-badge.broken { background: var(--red-bg);    color: var(--red-text); }

.btn-view {
  background: none; border: none; cursor: pointer; color: var(--text-dim);
  padding: 4px; border-radius: var(--radius-xs); display: flex; transition: color 0.15s;
}
.btn-view:hover { color: var(--accent); }

/* ── Empty & Loading States ── */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-title { font-size: 15px; font-weight: 600; margin: 12px 0 4px; }
.empty-sub { font-size: 13px; color: var(--text-dim); }

.loading { text-align: center; padding: 60px; color: var(--text-sec); font-size: 14px; }
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.6s linear infinite;
  margin-right: 8px; vertical-align: middle;
}

.table-footer {
  margin-top: 12px; font-size: 12px; color: var(--text-dim);
  display: flex; justify-content: space-between;
}

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.18); backdrop-filter: blur(3px);
  z-index: 100; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--modal-bg); border-radius: 16px; width: 92%; max-width: 520px;
  max-height: 82vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25); animation: slideIn 0.25s ease;
}
.modal-wide { max-width: 820px; }
.modal-narrow { max-width: 400px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }

.modal-close {
  background: var(--tag-bg); border: none; width: 28px; height: 28px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
  color: var(--text-sec); display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }

.modal-body { padding: 22px; overflow-y: auto; flex: 1; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 22px; border-top: 1px solid var(--border);
}

/* ── File Drop ── */
.file-drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 44px 20px; text-align: center; cursor: pointer; transition: all 0.2s;
  color: var(--text-dim);
}
.file-drop:hover, .file-drop.drag-over {
  border-color: var(--accent); background: var(--accent-light); color: var(--accent);
}
.file-drop input { display: none; }
.drop-title { font-size: 14px; font-weight: 500; color: var(--text); margin: 8px 0 4px; }
.drop-sub { font-size: 12px; margin: 0; }

.json-preview {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-all;
  color: var(--text-sec); line-height: 1.6;
}

.preview-label { margin-bottom: 8px; font-size: 13px; color: var(--text-sec); }

/* ── Cross-Container ── */
.cc-label { font-size: 13px; color: var(--text-sec); margin-bottom: 14px; }
.cc-list { max-height: 260px; overflow-y: auto; }

.cc-account-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.cc-account-card:hover { border-color: var(--accent); background: var(--accent-light); }
.cc-account-card-name { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.cc-account-card-meta { font-size: 12px; color: var(--text-dim); }


/* Container row wraps the checkbox row + the workspace picker that appears
   when checked. */
.cc-container-row {
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}
.cc-container-row.current { opacity: 0.4; }

.cc-container-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: background 0.1s;
}
.cc-container-item:hover { background: var(--hover-bg); }
.cc-container-row.current .cc-container-item { cursor: default; }
.cc-container-item .current-badge {
  font-size: 11px; color: var(--text-dim); background: var(--tag-bg);
  padding: 2px 8px; border-radius: var(--radius-xs);
}

/* Workspace picker shown beneath a checked container */
.cc-workspace-picker {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 8px 38px;  /* indent past the checkbox column */
  font-size: 12px;
}
.cc-workspace-label { color: var(--text-dim); font-weight: 500; }
.cc-workspace-select {
  font-family: inherit; font-size: 12px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 3px 8px; cursor: pointer;
  flex: 1; min-width: 0; max-width: 280px;
}

.cc-option-box {
  margin-top: 14px; padding: 12px 14px; background: var(--bg);
  border-radius: 10px; border: 1px solid var(--border);
}
.cc-checkbox-label { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }

.cc-conflict-header {
  font-size: 12px; font-weight: 600; color: var(--text-sec);
  padding: 8px 12px; background: var(--bg); border-radius: var(--radius-sm); margin-top: 8px;
}

.cc-conflict-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border-light); font-size: 13px; gap: 8px;
}
.cc-conflict-row:last-child { border-bottom: none; }
.cc-conflict-id { color: var(--text-dim); font-size: 12px; }

.cc-conflict-actions { display: flex; gap: 4px; }
.cc-mini-btn {
  font-family: inherit; font-size: 11.5px; font-weight: 500;
  padding: 4px 12px; border-radius: var(--radius-xs); cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-sec);
  transition: all 0.15s;
}
.cc-mini-btn.active-skip { border-color: var(--yellow); background: var(--yellow-bg); color: var(--yellow); }
.cc-mini-btn.active-overwrite { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

.cc-ok-row { padding: 8px 12px; font-size: 13px; color: var(--green); display: flex; align-items: center; gap: 6px; }

.cc-result-item {
  padding: 14px 16px; background: var(--bg); border-radius: 10px; margin-bottom: 8px;
  animation: fadeUp 0.25s ease both;
}
.cc-result-name { font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.cc-result-stats { display: flex; gap: 14px; font-size: 12px; }
.cc-stat-green { color: var(--green); font-weight: 500; }
.cc-stat-dim { color: var(--text-dim); font-weight: 500; }
.cc-stat-red { color: var(--red); font-weight: 500; }

/* Delete-preview summary header (cross-container delete review step) */
.cc-delete-preview-summary {
  padding: 12px 14px; margin-bottom: 12px;
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: 10px;
}
.cc-delete-preview-headline {
  font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 6px;
}
.cc-delete-preview-totals {
  display: flex; gap: 14px; font-size: 12.5px;
}

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 400px; width: calc(100vw - 48px); }

.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12); animation: toastIn 0.3s ease;
  display: flex; align-items: flex-start; gap: 10px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.toast-message { line-height: 1.4; color: var(--text); word-break: break-word; }
.toast-detail {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; font-weight: 400;
  color: var(--red); background: var(--red-bg);
  border-radius: 6px; padding: 6px 8px;
  line-height: 1.5; white-space: pre-wrap; word-break: break-all;
  max-height: 100px; overflow-y: auto;
}
.toast-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }

.toast-copy {
  background: none; border: 1px solid var(--border); border-radius: 5px;
  cursor: pointer; padding: 3px 5px; color: var(--text-dim); display: flex; align-items: center;
  transition: color 0.15s, border-color 0.15s;
}
.toast-copy:hover { color: var(--text); border-color: var(--text-dim); }

.toast-close {
  background: none; border: none; cursor: pointer; font-size: 16px; line-height: 1;
  color: var(--text-dim); padding: 0;
}
.toast-close:hover { color: var(--text); }

.cc-result-item-list { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.cc-result-item-list-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
  padding: 4px 0 2px; margin-bottom: 2px;
}
.cc-result-item-list-label.success { color: var(--green); }
.cc-result-item-list-label.error { color: var(--red); }
.cc-result-item-list-label.dim { color: var(--text-dim); }
.cc-result-item-list-label.warn { color: var(--yellow-text); }

.cc-result-item-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding: 6px 10px; border-radius: var(--radius-xs);
}
.cc-result-item-row.success { background: var(--green-bg); }
.cc-result-item-row.error { background: var(--red-bg); flex-direction: column; align-items: stretch; gap: 4px; }
.cc-result-item-row.dim { background: var(--tag-bg); }
.cc-result-item-name { font-weight: 500; flex: 1; min-width: 0; word-break: break-word; }
.cc-result-item-row.success .cc-result-item-name { color: var(--green-text); }
.cc-result-item-row.error .cc-result-item-name { color: var(--red-text); }
.cc-result-item-row.dim .cc-result-item-name { color: var(--text-dim); }
.cc-result-item-action { font-size: 11px; color: var(--green-text); font-weight: 500; flex-shrink: 0; text-align: right; word-break: break-word; max-width: 60%; }
.cc-result-item-err { font-size: 11.5px; color: var(--red-text); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

/* Progress bar */
.cc-progress-header { font-size: 13px; color: var(--text-sec); margin-bottom: 8px; font-weight: 500; }
.cc-progress-track { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
.cc-progress-fill { height: 100%; background: var(--accent); border-radius: 99px; width: 0%; transition: width 0.35s ease; }

/* Confirm modal */
.confirm-icon {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--red-bg); color: var(--red);
  margin: 8px auto 16px;
}
.confirm-message { font-size: 15px; font-weight: 500; color: var(--text); text-align: center; margin: 0 0 6px; }
.confirm-warning { font-size: 13px; color: var(--text-dim); text-align: center; margin: 0; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { width: 60px; padding: 12px 8px; }
  .sidebar-item { font-size: 0; padding: 10px; justify-content: center; }
  .sidebar-item svg { margin: 0; }
  .sidebar-count, .sidebar-section-label, .sidebar-divider, .sidebar-spacer { display: none; }
  .topbar-selectors { flex-direction: column; gap: 2px; }
  .main { padding: 16px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { width: 100%; }
}
