/* ═══════════════════════════════════════════════════════════
   Позтрек — Main Stylesheet
   Font: Inter (text) + JetBrains Mono (numbers/data)
   Theme: Light default, Dark via [data-theme="dark"]
═══════════════════════════════════════════════════════════ */

/* ── Google Fonts ────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables: Light ────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-page:      #f5f4f1;
  --bg-surface:   #ffffff;
  --bg-surface2:  #f9f8f6;
  --bg-sidebar:   #16162a;
  --bg-sidebar2:  #1e1e38;
  --bg-input:     #ffffff;
  --bg-hover:     #f0eeea;
  --bg-active:    rgba(99,91,255,.08);

  /* Text */
  --tx-primary:   #1a1a2e;
  --tx-secondary: #5a5a7a;
  --tx-muted:     #9898b0;
  --tx-inverse:   #ffffff;
  --tx-sidebar:   rgba(255,255,255,.72);
  --tx-sidebar-muted: rgba(255,255,255,.38);

  /* Brand / accent */
  --accent:       #635bff;
  --accent-hover: #4f46e5;
  --accent-light: #ededff;

  /* Semantic */
  --green:        #0d9e6e;
  --green-light:  #d1fae5;
  --red:          #e53e3e;
  --red-light:    #fee2e2;
  --amber:        #d97706;
  --amber-light:  #fef3c7;
  --blue:         #2563eb;
  --blue-light:   #dbeafe;

  /* Campaign colours */
  --ark-bg:       #e8f5e9; --ark-tx:    #1b5e20; --ark-border: #a5d6a7;
  --manual-bg:    #fff8e1; --manual-tx: #6d4c00; --manual-border: #ffe082;
  --clicks-bg:    #ede7f6; --clicks-tx: #311b92; --clicks-border: #b39ddb;

  /* Status */
  --active-bg:    #e8f5e9; --active-tx:   #1b5e20;
  --seasonal-bg:  #e3f2fd; --seasonal-tx: #0d47a1;
  --archived-bg:  #f3f3f3; --archived-tx: #616161;

  /* Borders */
  --border:       #e8e6e0;
  --border-focus: #635bff;

  /* Shadows */
  --shadow-sm:    0 1px 2px rgba(0,0,0,.06);
  --shadow:       0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg:    0 4px 24px rgba(0,0,0,.10);

  /* Radius */
  --r-sm:  6px;
  --r:     10px;
  --r-lg:  14px;
  --r-xl:  20px;

  /* Sidebar */
  --sidebar-w:    256px;
  --topbar-h:     58px;

  /* Transitions */
  --ease: .18s cubic-bezier(.4,0,.2,1);
}

/* ── Variables: Dark ─────────────────────────────────────── */
[data-theme="dark"] {
  --bg-page:      #0e0e1a;
  --bg-surface:   #17172b;
  --bg-surface2:  #1e1e35;
  --bg-sidebar:   #0b0b17;
  --bg-sidebar2:  #13132a;
  --bg-input:     #1e1e35;
  --bg-hover:     #1e1e35;
  --bg-active:    rgba(99,91,255,.18);

  --tx-primary:   #e8e8f5;
  --tx-secondary: #9898c0;
  --tx-muted:     #55557a;

  --accent-light: #2a2860;
  --green-light:  #064e3b;
  --red-light:    #7f1d1d;
  --amber-light:  #451a03;
  --blue-light:   #1e3a5f;

  --ark-bg:       #1a2e1a; --ark-tx:    #86efac; --ark-border: #166534;
  --manual-bg:    #2e2000; --manual-tx: #fcd34d; --manual-border: #92400e;
  --clicks-bg:    #1e1440; --clicks-tx: #c4b5fd; --clicks-border: #4c1d95;

  --active-bg:    #1a2e1a; --active-tx:   #86efac;
  --seasonal-bg:  #1e3a5f; --seasonal-tx: #93c5fd;
  --archived-bg:  #2a2a2a; --archived-tx: #9ca3af;

  --border:       #2a2a45;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.3);
  --shadow:       0 1px 4px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.2);
  --shadow-lg:    0 4px 24px rgba(0,0,0,.4);
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--tx-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  transition: background var(--ease), color var(--ease);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Monospace for all data/numbers */
.mono, .num-cell, td.num, .pos-val, .bid-val, .stat-val {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

/* ── Layout ──────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left var(--ease);
}

.app-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1440px;
  width: 100%;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow: hidden;
  transition: transform var(--ease), width var(--ease);
}

.sidebar__brand {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  gap: 8px;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  letter-spacing: -.3px;
  min-width: 0;
  flex: 1;
}

.sidebar__logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.sidebar__close {
  background: none; border: none;
  color: var(--tx-sidebar-muted);
  cursor: pointer; font-size: 18px;
  padding: 2px; line-height: 1;
  display: none;
}

/* Search */
.sidebar__search {
  padding: 12px 12px 8px;
  flex-shrink: 0;
  position: relative;
}

.sidebar__search-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-sm);
  padding: 0 10px;
  gap: 6px;
  transition: border-color var(--ease);
}
.sidebar__search-wrap:focus-within {
  border-color: var(--accent);
  background: rgba(99,91,255,.12);
}
.sidebar__search-wrap i { color: var(--tx-sidebar-muted); font-size: 13px; flex-shrink: 0; }
.sidebar__search-input {
  background: transparent;
  border: none; outline: none;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  padding: 7px 0;
  width: 100%;
}
.sidebar__search-input::placeholder { color: rgba(255,255,255,.3); }

.search-dropdown {
  position: absolute;
  left: 12px; right: 12px;
  top: calc(100% - 4px);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 340px;
  overflow-y: auto;
  display: none;
}
.search-dropdown.open { display: block; }
.search-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-hover); }
.search-item__art { font-weight: 600; font-size: 13px; font-family: 'JetBrains Mono', monospace; }
.search-item__sub { font-size: 12px; color: var(--tx-secondary); margin-top: 1px; }
.search-empty { padding: 16px; text-align: center; color: var(--tx-muted); font-size: 13px; }

/* Nav */
.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 8px; }
.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-group { margin-bottom: 4px; }
.nav-group__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--tx-sidebar-muted);
  padding: 10px 10px 4px;
}

.nav-item { list-style: none; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  color: var(--tx-sidebar);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
  text-decoration: none;
}
.nav-link i { font-size: 16px; flex-shrink: 0; opacity: .8; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active {
  background: rgba(99,91,255,.22);
  color: #a5a0ff;
  font-weight: 500;
}
.nav-link.active i { opacity: 1; }

/* Sidebar footer / user */
.sidebar__footer {
  padding: 10px 10px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-radius: var(--r-sm);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
.user-name  { color: #fff; font-size: 13px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { color: var(--tx-sidebar-muted); font-size: 11px; text-transform: capitalize; }
.user-logout {
  flex-shrink: 0;
  color: var(--tx-sidebar-muted);
  font-size: 16px;
  text-decoration: none;
  transition: color var(--ease);
  padding: 2px;
  line-height: 1;
}
.user-logout:hover { color: #fc8181; }
.sidebar__theme {
  display: flex; justify-content: flex-end;
  padding: 4px 8px 0;
}
.theme-btn {
  background: none; border: none;
  color: var(--tx-sidebar-muted);
  cursor: pointer; font-size: 15px;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  transition: background var(--ease), color var(--ease);
}
.theme-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  flex-shrink: 0;
}
.topbar__burger {
  background: none; border: none;
  font-size: 22px; color: var(--tx-secondary);
  cursor: pointer; padding: 4px; line-height: 1;
  display: none;
}
.topbar__breadcrumb { flex: 1; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.breadcrumb a { color: var(--tx-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb__sep { color: var(--tx-muted); }
.breadcrumb__current { color: var(--tx-primary); font-weight: 500; }
.topbar__actions { display: flex; gap: 8px; align-items: center; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1039;
  display: none;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body  { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease), border-color var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow); border-color: var(--accent); }
.stat-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--tx-muted);
  margin-bottom: 6px;
}
.stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px; font-weight: 500;
  line-height: 1.1;
  color: var(--tx-primary);
}
.stat-trend {
  margin-top: 5px;
  font-size: 12px;
  display: flex; align-items: center; gap: 4px;
}
.stat-prev { color: var(--tx-muted); }

/* ── Trend ───────────────────────────────────────────────── */
.trend-up   { color: var(--green); }
.trend-down { color: var(--red); }
.trend-eq   { color: var(--tx-muted); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-ark     { background: var(--ark-bg);      color: var(--ark-tx);      border-color: var(--ark-border); }
.badge-manual  { background: var(--manual-bg);   color: var(--manual-tx);   border-color: var(--manual-border); }
.badge-clicks  { background: var(--clicks-bg);   color: var(--clicks-tx);   border-color: var(--clicks-border); }
.badge-active  { background: var(--active-bg);   color: var(--active-tx); }
.badge-seasonal{ background: var(--seasonal-bg); color: var(--seasonal-tx); }
.badge-archived{ background: var(--archived-bg); color: var(--archived-tx); }
.badge-danger  { background: var(--red-light);   color: var(--red); }
.badge-changed { background: var(--amber-light); color: var(--amber); font-size: 10px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn i { font-size: 15px; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-sm i { font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; }

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

.btn-secondary {
  background: var(--bg-surface);
  color: var(--tx-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }

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

.btn-danger {
  background: var(--red-light);
  color: var(--red);
  border-color: transparent;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-success {
  background: var(--green-light);
  color: var(--green);
  border-color: transparent;
}
.btn-success:hover { background: var(--green); color: #fff; }

.btn-icon {
  padding: 7px;
  background: transparent;
  border-color: var(--border);
  color: var(--tx-secondary);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--tx-secondary);
  margin-bottom: 5px;
}
.form-label .req { color: var(--red); margin-left: 2px; }

.form-control, .form-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--tx-primary);
  font-family: inherit;
  transition: border-color var(--ease), box-shadow var(--ease);
  outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,91,255,.12);
}
.form-control.mono, input.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.form-control-sm { padding: 5px 9px; font-size: 13px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--tx-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }
.form-control.is-invalid { border-color: var(--red); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  color: var(--tx-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-surface2);
  text-align: left;
}
.table th.num, .table td.num {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover td { background: var(--bg-hover); }
.table tbody tr.row-striped:nth-child(even) td { background: var(--bg-surface2); }

/* ── Position display ────────────────────────────────────── */
.pos-cell { display: flex; gap: 10px; align-items: center; }
.pos-org  { font-family: 'JetBrains Mono', monospace; color: var(--blue); }
.pos-adv  { font-family: 'JetBrains Mono', monospace; color: var(--tx-primary); font-weight: 500; }
.pos-adv.danger { color: var(--red); font-weight: 600; }
.pos-none { color: var(--tx-muted); }

/* ── Day compare view ────────────────────────────────────── */
.day-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.day-col {
  padding: 0;
}
.day-col + .day-col {
  border-left: 1px solid var(--border);
}
.day-col--today { background: rgba(99,91,255,.02); }
.day-col__header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface2);
  display: flex; align-items: center; justify-content: space-between;
}
.day-col__label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  color: var(--tx-muted);
}
.day-col--today .day-col__label { color: var(--accent); }
.day-summary {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.day-stat {
  background: var(--bg-surface);
  padding: 10px 12px;
  text-align: center;
}
.day-stat__label { font-size: 10px; color: var(--tx-muted); text-transform: uppercase; letter-spacing: .3px; }
.day-stat__val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; font-weight: 500;
  margin-top: 2px;
}
.day-stat__trend { font-size: 11px; margin-top: 1px; }

/* ── Keyword table ───────────────────────────────────────── */
.kw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kw-table th {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  color: var(--tx-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface2);
  white-space: nowrap;
}
.kw-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.kw-table tbody tr:last-child td { border-bottom: none; }
.kw-table tbody tr:hover td { background: var(--bg-hover); }
.kw-name { font-size: 13px; color: var(--tx-primary); word-break: break-word; }
.kw-org-val  { font-family: 'JetBrains Mono', monospace; color: var(--blue); font-size: 13px; }
.kw-adv-val  { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500; }
.kw-adv-val.adv-danger { color: var(--red); }
.kw-bid-input {
  width: 70px; padding: 3px 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  color: var(--tx-primary);
  text-align: right;
}
.kw-bid-input:focus { border-color: var(--border-focus); outline: none; box-shadow: 0 0 0 2px rgba(99,91,255,.1); }
.kw-bid-input.changed { border-color: var(--amber); background: var(--amber-light); }

/* ── Paste area (Evirma) ─────────────────────────────────── */
.paste-area {
  background: var(--bg-surface2);
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  transition: border-color var(--ease), background var(--ease);
}
.paste-area:focus-within {
  border-color: var(--accent);
  background: rgba(99,91,255,.02);
}
.paste-area textarea {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  resize: vertical;
  color: var(--tx-primary);
  width: 100%;
  outline: none;
  padding: 0;
}
.paste-area textarea::placeholder { color: var(--tx-muted); }

/* Preview after parse */
.parse-preview {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-top: 12px;
}
.parse-preview__header {
  background: var(--bg-surface2);
  padding: 8px 14px;
  font-size: 12px; font-weight: 500;
  color: var(--tx-secondary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
}
.parse-row {
  display: grid; grid-template-columns: 1fr 120px 60px 60px;
  gap: 8px; align-items: center;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.parse-row:last-child { border-bottom: none; }
.parse-row:hover { background: var(--bg-hover); }
.parse-row__key { color: var(--tx-secondary); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parse-row__raw { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--tx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parse-row__org { font-family: 'JetBrains Mono', monospace; color: var(--blue); font-size: 13px; text-align: right; }
.parse-row__adv { font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: 13px; text-align: right; }
.parse-row--mismatch { background: var(--amber-light); }

/* ── Article list cards ──────────────────────────────────── */
.article-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--ease), border-color var(--ease), transform var(--ease);
  cursor: pointer;
}
.article-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
  transform: translateY(-1px);
  color: inherit;
}
.article-card__wb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px; font-weight: 500;
}
.article-card__subject { font-size: 12.5px; color: var(--tx-secondary); margin-top: 2px; }
.article-card__meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.article-card__stats { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--tx-muted); }
.article-card__stat-val { font-family: 'JetBrains Mono', monospace; color: var(--tx-primary); font-weight: 500; }

/* ── Charts ──────────────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-wrap canvas { max-width: 100%; }

/* ── Lock button ─────────────────────────────────────────── */
.lock-btn { font-size: 12px; }
.lock-btn.locked { color: var(--amber); }
.lock-btn.unlocked { color: var(--green); }

/* ── Tabs ────────────────────────────────────────────────── */
.tab-list {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.tab-btn {
  padding: 10px 18px;
  background: none; border: none;
  font-size: 13.5px; font-weight: 500;
  color: var(--tx-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--ease), border-color var(--ease);
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Flash messages ──────────────────────────────────────── */
.flash-msg {
  padding: 12px 16px;
  border-radius: var(--r);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  animation: slideDown .25s ease;
}
.flash-success { background: var(--green-light); color: var(--green); border: 1px solid var(--green); }
.flash-danger  { background: var(--red-light);   color: var(--red);   border: 1px solid var(--red); }
.flash-warning { background: var(--amber-light);  color: var(--amber); border: 1px solid var(--amber); }
.flash-info    { background: var(--blue-light);   color: var(--blue);  border: 1px solid var(--blue); }
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; opacity: .6; font-size: 16px; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 600; line-height: 1.2; }
.page-subtitle { font-size: 13px; color: var(--tx-secondary); margin-top: 3px; }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-sidebar);
  padding: 24px;
  box-sizing: border-box;
}
.login-box {
  width: 100%; max-width: 400px;
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.login-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 28px;
}
.login-logo-icon {
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.login-logo-text { font-size: 20px; font-weight: 700; color: var(--tx-primary); }
.login-title { font-size: 18px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--tx-secondary); text-align: center; margin-bottom: 24px; }

/* ── Export (public) page ────────────────────────────────── */
.export-page { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.export-header { text-align: center; margin-bottom: 32px; }
.export-article {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: 24px;
  overflow: hidden;
}
.export-article__head {
  padding: 14px 20px;
  background: var(--bg-surface2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.export-article__wb { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 15px; }

/* ── Utilities ───────────────────────────────────────────── */
.text-muted   { color: var(--tx-muted) !important; }
.text-secondary { color: var(--tx-secondary) !important; }
.text-success { color: var(--green) !important; }
.text-danger  { color: var(--red) !important; }
.text-accent  { color: var(--accent) !important; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.ms-auto { margin-left: auto; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.w-100 { width: 100%; }
.hidden { display: none; }

/* ── Grid helpers ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }

/* ── Divider ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Skeleton loading ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface2) 25%, var(--bg-hover) 50%, var(--bg-surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--tx-muted); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .app-content { padding: 20px 24px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-256px); width: 256px; }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar__burger { display: block; }
  .sidebar__close { display: block; }
  .app-content { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .day-compare { grid-template-columns: 1fr; }
  .day-col + .day-col { border-left: none; border-top: 1px solid var(--border); }
  .page-header { flex-direction: column; }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .login-box { padding: 28px 20px; }
  .topbar { padding: 0 12px; }
  .app-content { padding: 12px; }
}
