/* Abreco Hub – Compact Minimal Design System */

:root {
  --bg-canvas: #f6f8fb;
  --bg-surface: #ffffff;
  --bg-subtle: #eff3f8;
  --bg-hover: #f1f5f9;
  --bg-selected: rgba(37, 99, 235, 0.07);
  --bg-sidebar: #fbfcfe;

  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --border-selected: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: rgba(37, 99, 235, 0.1);
  --brand-fg: #2563eb;

  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.11);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --rose: #e11d48;
  --rose-soft: rgba(225, 29, 72, 0.1);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.11);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 22px 48px -12px rgba(15, 23, 42, 0.18);

  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --bg-canvas: #090d16;
  --bg-surface: #101624;
  --bg-subtle: #161f32;
  --bg-hover: #192338;
  --bg-selected: rgba(59, 130, 246, 0.14);
  --bg-sidebar: #0b101b;

  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-selected: #3b82f6;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --brand: #3b82f6;
  --brand-hover: #2563eb;
  --brand-soft: rgba(59, 130, 246, 0.16);
  --brand-fg: #60a5fa;

  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, 0.72);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-fg);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Auth Screen
   -------------------------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 15%, var(--brand-soft), transparent 42%),
    var(--bg-canvas);
}

.auth-card {
  width: 100%;
  max-width: 340px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

.auth-brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.auth-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-domain {
  font-size: 11.5px;
  color: var(--text-muted);
}

.auth-error {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--rose-soft);
  color: var(--rose);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   App Shell & Compact Sidebar
   -------------------------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 8px 14px;
  cursor: pointer;
}

.brand-row img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
}

.brand-title {
  font-weight: 650;
  font-size: 13.5px;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.brand-sub span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
}

.pulse-dot.paused {
  background: var(--amber);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 9px 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--brand-soft);
  color: var(--brand-fg);
  font-weight: 600;
}

.nav-btn-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.nav-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.nav-btn.active .nav-count {
  background: var(--brand);
  color: #fff;
}

.nav-count.warn {
  background: var(--rose-soft);
  color: var(--rose);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 4px;
}

.user-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-fg);
  font-weight: 700;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-weight: 600;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-bar-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

/* Mobile Bars */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 25;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 14px;
}

.mobile-brand img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.mobile-bottomnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
  z-index: 25;
  justify-content: space-around;
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
  padding: 5px 4px;
  cursor: pointer;
}

.mobile-tab.active {
  color: var(--brand-fg);
  font-weight: 600;
}

.mobile-tab svg {
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   Workspace, Topbars & Controls
   -------------------------------------------------------------------------- */
.workspace {
  min-width: 0;
  padding: 18px 22px 36px;
  max-width: 1520px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

/* Pill Switcher (Sub-navigation & Filter segments) */
.pill-nav {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 2px;
  flex-wrap: wrap;
}

.pill-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.pill-tab:hover {
  color: var(--text-primary);
}

.pill-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.pill-count {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.pill-tab.active .pill-count {
  color: var(--brand-fg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

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

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

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

.btn-danger {
  color: var(--rose);
  border-color: transparent;
  background: var(--rose-soft);
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--rose);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11.5px;
}

.btn-block {
  width: 100%;
}

/* Inputs & Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.field label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.input, select.input, textarea.input {
  width: 100%;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  transition: border-color 0.12s;
}

.input:hover {
  border-color: var(--border-strong);
}

.input:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-soft);
}

textarea.input {
  resize: vertical;
  min-height: 72px;
  line-height: 1.45;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 6.5px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-neutral { background: var(--bg-subtle); color: var(--text-secondary); }
.badge-brand { background: var(--brand-soft); color: var(--brand-fg); }
.badge-success { background: var(--emerald-soft); color: var(--emerald); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-danger { background: var(--rose-soft); color: var(--rose); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }

/* --------------------------------------------------------------------------
   Hub Overview Cards ('/')
   -------------------------------------------------------------------------- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.hub-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hub-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.hub-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hub-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hub-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hub-icon svg {
  width: 18px;
  height: 18px;
}

.hub-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
}

.hub-stat-val {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
}

.hub-stat-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.hub-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hub-slot {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  min-height: 90px;
}

/* --------------------------------------------------------------------------
   Lead-Radar Inbox (Toolbar + Split View)
   -------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-controls .search-input {
  width: 210px;
}

.filter-controls select.input {
  width: auto;
  min-width: 112px;
}

.inbox-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(370px, 0.96fr);
  gap: 12px;
  align-items: start;
}

.lead-list-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lead-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  align-items: center;
}

.lead-row:last-child {
  border-bottom: none;
}

.lead-row:hover {
  background: var(--bg-hover);
}

.lead-row.selected {
  background: var(--bg-selected);
  box-shadow: inset 2.5px 0 0 var(--brand);
}

.score-pill {
  width: 34px;
  height: 30px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
}

.score-high { background: var(--emerald-soft); color: var(--emerald); }
.score-medium { background: var(--amber-soft); color: var(--amber); }
.score-low { background: var(--bg-subtle); color: var(--text-muted); }

.lead-row-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin: 0 0 3px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 7px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Inspector */
.inspector-pane {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

.inspector-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.inspector-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 5;
}

.mobile-close-btn {
  display: none;
}

.inspector-body {
  padding: 13px 15px 16px;
}

.inspector-title {
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.35;
  margin: 0 0 4px;
}

.inspector-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.status-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.status-chip {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.status-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.status-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.status-chip.active[data-status="Verworfen"] {
  background: var(--rose);
  border-color: var(--rose);
}

.status-chip.active[data-status="Kunde"] {
  background: var(--emerald);
  border-color: var(--emerald);
}

.rule-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 11.5px;
  margin-bottom: 10px;
}

.rule-strip.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.signal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.tiny-link {
  border: none;
  background: none;
  color: var(--brand-fg);
  font-size: 11px;
  padding: 0;
  cursor: pointer;
}

.tiny-link:hover {
  text-decoration: underline;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  accent-color: var(--brand);
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Compact Cards, Tables & Collapsibles
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}

table.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

details.subtle-details {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

details.subtle-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
}

details.subtle-details summary:hover {
  color: var(--text-primary);
}

.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.removable-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 11.5px;
}

.removable-chip button {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  line-height: 1;
}

.removable-chip button:hover {
  color: var(--rose);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
}

.template-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.template-body-clamp {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.code-preview {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-box {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* Modal & Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.toast-stack {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 340px;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  font-weight: 500;
}

.toast.success { border-left-color: var(--emerald); }
.toast.error { border-left-color: var(--rose); }

/* Responsive */
@media (max-width: 1080px) {
  .inbox-split {
    grid-template-columns: 1fr;
  }

  .inspector-pane {
    display: none;
  }

  .inspector-pane.mobile-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .mobile-close-btn {
    display: inline-flex;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-topbar, .mobile-bottomnav {
    display: flex;
  }

  .workspace {
    padding: 12px 12px 80px;
  }

  .grid-2, .grid-3, .grid-4, .hub-grid {
    grid-template-columns: 1fr;
  }

  .filter-controls, .filter-controls .search-input {
    width: 100%;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 68px;
    max-width: none;
  }
}
