/* ════════════════════════════════════════════════════════════════
   7DegreeMarketing — Design System
   Editorial · Warm · Precise
   ════════════════════════════════════════════════════════════════ */

:root {
  /* Color — warm paper palette */
  --ink: #1a1612;
  --ink-2: #2a241e;
  --ink-3: #4a4039;
  --paper: #faf6f1;
  --paper-2: #f4ede3;
  --paper-3: #ede4d5;
  --line: #e3d7c1;
  --line-2: #d4c4a8;
  --muted: #8a7d6c;
  --muted-2: #b0a08c;

  /* Accent — terracotta */
  --accent: #c75d3a;
  --accent-hover: #b04d2c;
  --accent-soft: #f3e3db;
  --accent-soft-2: #e8c8b8;

  /* Semantic */
  --success: #4a7c3a;
  --success-soft: #e3eddb;
  --warn: #b8821a;
  --warn-soft: #f5ead0;
  --danger: #a8413a;
  --danger-soft: #f0d8d4;
  --info: #3a5c7c;
  --info-soft: #d8e3ed;

  /* Type */
  --serif: 'Fraunces', 'Georgia', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Menlo', monospace;

  /* Radius */
  --r-sm: 4px;
  --r: 8px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Spacing — 4pt grid */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  /* Shadows — soft, paper-like */
  --shadow-sm: 0 1px 2px rgba(60, 40, 20, 0.04), 0 1px 1px rgba(60, 40, 20, 0.02);
  --shadow: 0 2px 8px rgba(60, 40, 20, 0.06), 0 1px 3px rgba(60, 40, 20, 0.04);
  --shadow-lg: 0 12px 32px rgba(60, 40, 20, 0.08), 0 4px 12px rgba(60, 40, 20, 0.04);

  /* Transition */
  --t-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --t: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  height: 100%;
  overflow: hidden;
}

body { display: flex; flex-direction: column; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Brand mark ──────────────────────────────────────────────── */
.brand-mark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.brand-num { font-size: 24px; color: var(--accent); }
.brand-degree { font-size: 18px; color: var(--accent); margin-left: 1px; }
.brand-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-left: var(--s-2);
}

/* ── Loader ──────────────────────────────────────────────────── */
.loader {
  position: fixed; inset: 0;
  background: var(--paper);
  z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--s-3);
  transition: opacity var(--t-slow);
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-mark {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1;
  display: flex; align-items: baseline;
  animation: fade-in 0.6s ease;
}
.loader-num { font-size: 48px; color: var(--accent); }
.loader-degree {
  font-size: 32px;
  color: var(--accent);
  margin-left: 2px;
  animation: pulse-degree 1.5s ease-in-out infinite;
}
.loader-text {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: lowercase;
}
@keyframes pulse-degree {
  0%, 100% { opacity: 0.7; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Toast ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: var(--s-6); right: var(--s-6);
  z-index: 10000;
  display: flex; flex-direction: column;
  gap: var(--s-2);
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--paper);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--s-2);
  max-width: 360px;
  animation: toast-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.toast.toast-exit { animation: toast-out 0.2s ease forwards; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warn); }
.toast-icon {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
@keyframes toast-in { from { opacity: 0; transform: translate(0, 16px); } to { opacity: 1; transform: translate(0, 0); } }
@keyframes toast-out { to { opacity: 0; transform: translate(16px, 0); } }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-container { position: fixed; inset: 0; z-index: 9000; pointer-events: none; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26, 22, 18, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: auto;
  animation: fade-in 0.2s ease;
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  max-width: 540px;
  width: calc(100% - 32px);
  max-height: 86vh;
  display: flex; flex-direction: column;
  pointer-events: auto;
  animation: modal-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.modal.modal-lg { max-width: 720px; }
.modal.modal-xl { max-width: 960px; }
@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal-header {
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.modal-close {
  background: transparent; border: none;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--t-fast);
}
.modal-close:hover { background: var(--paper-2); color: var(--ink); }
.modal-body { padding: var(--s-6); overflow-y: auto; flex: 1; }
.modal-footer {
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--line);
  display: flex; gap: var(--s-2); justify-content: flex-end;
}

/* ── Login ───────────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0;
  display: flex;
  background: var(--paper);
  z-index: 100;
  transition: opacity 0.5s var(--t), transform 0.5s var(--t);
}
.login-screen.hide { opacity: 0; transform: translateY(-12px); pointer-events: none; }

.login-canvas {
  flex: 1;
  background: linear-gradient(135deg, #f4ede3 0%, #ede4d5 100%);
  padding: var(--s-12) var(--s-10);
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  pointer-events: none;
}
.login-orb-1 { width: 400px; height: 400px; background: var(--accent-soft-2); top: -100px; right: -50px; }
.login-orb-2 { width: 300px; height: 300px; background: #d4c4a8; bottom: 10%; left: -80px; }
.login-orb-3 { width: 250px; height: 250px; background: #f0d8b8; top: 40%; right: 30%; }

.login-brand {
  display: flex; align-items: baseline;
  position: relative; z-index: 1;
}
.login-headline {
  max-width: 460px;
  position: relative; z-index: 1;
}
.login-headline h1 {
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: var(--s-5);
}
.login-headline h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.login-headline p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-3);
  max-width: 380px;
}

.login-features {
  display: flex; flex-direction: column;
  gap: var(--s-3);
  position: relative; z-index: 1;
}
.login-feature {
  display: flex; align-items: center;
  gap: var(--s-3);
  font-size: 13px;
  color: var(--ink-3);
}
.lf-icon {
  color: var(--accent);
  font-size: 14px;
  width: 20px;
  text-align: center;
}
.login-feature strong {
  color: var(--ink);
  font-weight: 600;
}

.login-form {
  width: 440px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-8);
}
.login-form-inner {
  width: 100%;
  max-width: 320px;
}
.login-form-inner h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: var(--s-1);
}
.login-sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: var(--s-8);
}
.login-hint {
  margin-top: var(--s-5);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 4px;
}
.login-hint code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--paper-2);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.login-hint .dim { color: var(--muted-2); }

/* ── Form Fields ─────────────────────────────────────────────── */
.field { margin-bottom: var(--s-4); }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: var(--s-2);
  letter-spacing: 0.01em;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  outline: none;
  font-family: inherit;
}
.field select { cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a7d6c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--paper);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  font-family: inherit;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }
.btn-outline { background: var(--paper); border-color: var(--line); color: var(--ink-2); }
.btn-outline:hover:not(:disabled) { background: var(--paper-2); border-color: var(--line-2); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #913530; }
.btn-block, .btn-full { width: 100%; padding: 10px 16px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { font-size: 16px; line-height: 1; font-weight: 400; }
.btn .spin {
  width: 12px; height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--t-fast);
}
.icon-btn:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }

/* ── App Layout ──────────────────────────────────────────────── */
.app {
  display: none;
  width: 100%; height: 100vh;
  background: var(--paper);
}
.app.show { display: flex; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: var(--s-5) var(--s-4);
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex; align-items: baseline;
  padding: 0 var(--s-2) var(--s-5);
  margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--line);
}

.nav {
  flex: 1;
  margin-top: var(--s-5);
  display: flex; flex-direction: column;
  gap: var(--s-5);
  overflow-y: auto;
}
.nav-section { display: flex; flex-direction: column; gap: 1px; }
.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 var(--s-3);
  margin-bottom: var(--s-2);
}
.nav-item {
  display: flex; align-items: center;
  gap: var(--s-3);
  padding: 7px var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-3);
  transition: all var(--t-fast);
  font-size: 13px;
  font-weight: 500;
  position: relative;
}
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -16px; top: 7px; bottom: 7px;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-icon {
  font-size: 14px;
  width: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: var(--accent); }
.nav-label { flex: 1; }
.nav-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-badge { color: var(--ink-2); }

.sidebar-user {
  margin-top: auto;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  display: flex; align-items: center;
  gap: var(--s-2);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--ink); }
.user-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Main ────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.topbar {
  padding: var(--s-5) var(--s-8);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--paper);
  flex-shrink: 0;
}
.topbar-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}
.topbar-sub { font-size: 13px; color: var(--muted); }

.inbox-status {
  display: flex; align-items: center;
  gap: var(--s-2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all var(--t-fast);
}
.inbox-status:hover { background: var(--paper-3); }
.inbox-status.connected { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.inbox-status.connected .inbox-dot { background: var(--success); }
.inbox-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.inbox-status.connected .inbox-dot { animation: pulse 2s ease infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.view-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-8);
  background: var(--paper);
}
.view-container::-webkit-scrollbar { width: 8px; height: 8px; }
.view-container::-webkit-scrollbar-track { background: transparent; }
.view-container::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.view-container::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-padded { padding: var(--s-5); }

/* ── Stats Grid ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-8);
}
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--t-fast);
}
.stat-card:hover { border-color: var(--line-2); }
.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: var(--s-2);
  font-weight: 500;
}
.stat-value {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: var(--s-2);
}
.stat-detail strong { color: var(--ink-2); font-weight: 600; }

/* ── Section ──────────────────────────────────────────────────── */
.section { margin-bottom: var(--s-8); }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-4);
}
.section-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.section-actions { display: flex; gap: var(--s-2); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; transition: background var(--t-fast); }
.table tr.clickable:hover { background: var(--paper-2); }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }

.cell-strong { color: var(--ink); font-weight: 500; }
.cell-muted { color: var(--muted); }
.cell-mono { font-family: var(--mono); font-size: 12px; }

/* ── Badge ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--paper-2);
  color: var(--ink-3);
  border: 1px solid var(--line);
}
.badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Empty State ────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: var(--s-12) var(--s-6);
  color: var(--muted);
}
.empty-icon {
  font-family: var(--serif);
  font-size: 56px;
  color: var(--line-2);
  margin-bottom: var(--s-4);
  line-height: 1;
}
.empty-title {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ink-2);
  font-weight: 500;
  margin-bottom: var(--s-2);
  letter-spacing: -0.01em;
}
.empty-text {
  color: var(--muted);
  font-size: 13px;
  max-width: 320px;
  margin: 0 auto var(--s-5);
  line-height: 1.5;
}

/* ── Skeletons ───────────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, var(--paper-2) 0%, var(--paper-3) 50%, var(--paper-2) 100%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Charts ──────────────────────────────────────────────────── */
.chart {
  display: flex; align-items: flex-end;
  gap: 3px;
  height: 80px;
}
.chart-bar {
  flex: 1;
  background: var(--accent-soft);
  border-radius: 2px 2px 0 0;
  transition: background var(--t-fast);
  position: relative;
  min-height: 2px;
}
.chart-bar:hover { background: var(--accent); }
.chart-bar.active { background: var(--accent); }
.chart-bar:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  margin-bottom: 4px;
  pointer-events: none;
}
.chart-labels {
  display: flex; justify-content: space-between;
  font-size: 10px;
  color: var(--muted-2);
  margin-top: var(--s-2);
}

/* ── Editor (kampanya) ──────────────────────────────────────── */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--s-5);
  height: 100%;
}
.editor-main {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.editor-toolbar {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  display: flex; gap: var(--s-2);
  flex-wrap: wrap;
}
.toolbar-btn {
  padding: 5px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-3);
  transition: all var(--t-fast);
  font-family: inherit;
}
.toolbar-btn:hover { background: var(--paper-2); }
.toolbar-btn.active { background: var(--paper-3); color: var(--ink); }
.toolbar-sep { width: 1px; background: var(--line); margin: 0 4px; }

.editor-iframe-wrap {
  flex: 1;
  overflow: hidden;
  background: white;
  position: relative;
}
.editor-area {
  width: 100%; height: 100%;
  border: none;
  background: white;
  padding: var(--s-6);
  font-family: -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
  color: var(--ink);
}
.editor-area:focus { outline: none; }
.editor-iframe { width: 100%; height: 100%; border: none; background: white; }

.editor-sidebar {
  display: flex; flex-direction: column;
  gap: var(--s-4);
  overflow-y: auto;
  padding: 2px;
}
.editor-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-4);
}
.editor-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: var(--s-3);
}

/* ── Checkbox / Toggle ────────────────────────────────────────── */
.check-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.check-item {
  display: flex; align-items: center;
  gap: var(--s-2);
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
  transition: background var(--t-fast);
}
.check-item:hover { background: var(--paper-2); }
.check-item input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}
.check-item-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Search / Filters ─────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.search-input {
  flex: 1; max-width: 320px;
  position: relative;
}
.search-input input {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 12px 8px 32px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--t-fast);
}
.search-input input:focus { border-color: var(--accent); }
.search-input::before {
  content: '⌕';
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}

/* ── Settings ───────────────────────────────────────────────── */
.settings-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  margin-bottom: var(--s-4);
}
.settings-card-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: var(--s-1);
  letter-spacing: -0.01em;
}
.settings-card-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--s-4);
  max-width: 480px;
  line-height: 1.5;
}

/* ── Code / Mono ─────────────────────────────────────────────── */
code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper-2);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

/* ── Responsive (compact) ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .login-screen { flex-direction: column; }
  .login-form { width: 100%; border-left: none; border-top: 1px solid var(--line); }
  .login-canvas { padding: var(--s-6); }
  .login-headline h1 { font-size: 36px; }
}

/* ── Utility ──────────────────────────────────────────────────── */
.spacer { flex: 1; }
.dim { color: var(--muted); }
.row { display: flex; align-items: center; gap: var(--s-2); }
.between { justify-content: space-between; }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-4 { margin-bottom: var(--s-4); }
.hidden { display: none !important; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--muted); }
.font-serif { font-family: var(--serif); }


/* ── Credit Meter ─────────────────────────────────────────────── */
.credit-meter {
  padding: 12px;
  background: var(--paper-3);
  border-radius: var(--r);
  margin-bottom: var(--s-3);
  border: 1px solid var(--line);
}
.credit-meter-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.credit-meter-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.credit-meter-value {
  font-family: var(--serif); font-size: 16px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.credit-meter-value.unlimited { color: var(--success); font-size: 13px; }
.credit-meter-value.low { color: var(--danger); }
.credit-meter-bar {
  height: 4px; background: var(--line); border-radius: 2px; overflow: hidden;
}
.credit-meter-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), #e8a87c);
  transition: width var(--t);
}
.credit-meter-fill.low { background: var(--danger); }
.credit-meter-used {
  font-size: 11px; color: var(--muted); margin-top: 6px;
}

/* ── Admin: credit badge in topbar ───────────────────────────── */
.topbar-credit {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── User role badge ─────────────────────────────────────────── */
.role-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.role-badge.admin { background: var(--accent-soft); color: var(--accent); }
.role-badge.user { background: var(--paper-3); color: var(--muted); }
