/* =============================================================================
   Θέσεις κατάταξης σε ΑΕΙ για απόφοιτους Επιπέδου 5 — public styles
   ============================================================================= */

:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1e293b;
  --ink-soft: #475569;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --primary: #0d6e9c;
  --primary-dark: #0a5578;
  --primary-soft: #e3f1f9;

  --accent: #f97316;
  --accent-soft: #ffedd5;

  --success: #16a34a;
  --success-soft: #dcfce7;

  --warn: #d97706;
  --warn-soft: #fef3c7;

  --danger: #dc2626;
  --danger-soft: #fee2e2;

  --header-bg: linear-gradient(135deg, #0d6e9c 0%, #0a4d72 100%);

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Top gov bar === */
.gov-bar {
  background: #ffffff; border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 12px; color: var(--muted);
}
.gov-bar-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 32px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.gov-bar .left  { display: flex; gap: 12px; align-items: center; }
.gov-bar .right { display: flex; gap: 4px;  align-items: center; }
.gov-bar .gov-emblem { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }
.gov-bar .gg-link {
  display: inline-flex; align-items: center; gap: 8px;
}
.gov-bar .gg-logo { height: 45px; width: auto; object-fit: contain; flex-shrink: 0; }

/* === Header === */
header.main {
  background: var(--header-bg); color: #fff;
  padding: 28px 0;
}
header.main .row {
  max-width: 1400px; margin: 0 auto; padding: 0 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
}
header.main .brand { display: flex; align-items: center; gap: 18px; }
header.main .logo-mark {
  width: 64px; height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}
header.main h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
header.main h1 .sub { display: block; font-size: 13px; font-weight: 400; opacity: 0.9; margin-top: 6px; max-width: 720px; }
header.main .meta { text-align: right; font-size: 12px; line-height: 1.7; opacity: 0.92; font-family: var(--mono); }
header.main .meta strong { color: #fff; font-weight: 600; }
header.main .meta .live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; padding: 4px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600; margin-top: 6px;
}
header.main .meta .live-pill::before { content: ""; width: 6px; height: 6px; background: #fff; border-radius: 50%; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* === Quick action bar === */
nav.actionbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 0; font-size: 13px;
}
nav.actionbar .actionbar-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 32px;
  display: flex; justify-content: flex-end; align-items: center; gap: 16px; flex-wrap: wrap;
}
nav.actionbar .quick { display: flex; gap: 8px; flex-wrap: wrap; }
nav.actionbar .quick a {
  padding: 6px 12px; border-radius: 6px; background: var(--primary-soft);
  color: var(--primary-dark); font-weight: 500; font-size: 12.5px;
  border: 1px solid transparent; transition: all 0.15s;
}
nav.actionbar .quick a:hover { background: var(--primary); color: #fff; text-decoration: none; }
nav.actionbar .quick a.admin { background: var(--ink); color: #fff; }
nav.actionbar .quick a.admin:hover { background: var(--accent); }

/* === Main container === */
main {
  max-width: 1400px; margin: 0 auto; padding: 24px 32px 40px;
  display: grid; grid-template-columns: 320px 1fr; gap: 24px;
}

/* === Sidebar / search form === */
aside.search-form {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 0; height: fit-content;
  position: sticky; top: 16px;
}
aside.search-form h2 {
  font-size: 14px; font-weight: 600; padding: 14px 18px;
  border-bottom: 1px solid var(--line); color: var(--ink);
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(to bottom, #f8fafc, #ffffff);
  border-radius: 10px 10px 0 0;
}
aside.search-form h2 .icon {
  width: 22px; height: 22px; background: var(--primary-soft); color: var(--primary);
  border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
aside.search-form .form-body { padding: 18px; }
aside .field { margin-bottom: 14px; }
aside .field label {
  display: block; font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
aside .field input, aside .field select {
  width: 100%; padding: 8px 10px; background: #fff; border: 1px solid var(--line-strong);
  border-radius: 6px; font-family: var(--sans); font-size: 13.5px; color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
aside .field input:focus, aside .field select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
aside .actions { display: flex; gap: 8px; margin-top: 16px; }
aside .btn-search {
  flex: 1; padding: 10px; background: var(--primary); color: #fff; border: none;
  border-radius: 6px; font-family: var(--sans); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
aside .btn-search:hover { background: var(--primary-dark); }
aside .btn-reset {
  padding: 10px 14px; background: #fff; color: var(--ink-soft); border: 1px solid var(--line-strong);
  border-radius: 6px; font-family: var(--sans); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
aside .btn-reset:hover { background: var(--line); }

aside .quick-stats {
  border-top: 1px solid var(--line); padding: 14px 18px;
  background: #fafbfc;
}
aside .quick-stats:last-child { border-radius: 0 0 10px 10px; }
aside .quick-stats .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12.5px; }
aside .quick-stats .row .k { color: var(--muted); }
aside .quick-stats .row .v { color: var(--ink); font-weight: 600; font-family: var(--mono); }

/* === Results section === */
section.results { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.results-header {
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(to bottom, #f8fafc, #ffffff);
}
.results-header h3 { font-size: 15px; font-weight: 700; color: var(--ink); }
.results-header h3 .count { color: var(--primary); font-family: var(--mono); margin-left: 6px; }
.results-header .controls { display: flex; gap: 16px; align-items: center; font-size: 12.5px; flex-wrap: wrap; }
.results-header .rows-per { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.results-header .rows-per a {
  padding: 3px 8px; border-radius: 4px; color: var(--ink-soft); font-weight: 500;
}
.results-header .rows-per a.active { background: var(--primary); color: #fff; }
.results-header .export { display: flex; gap: 6px; }
.results-header .export a {
  padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 6px;
  color: var(--ink-soft); font-weight: 500; background: #fff; font-size: 12px;
  transition: all 0.15s;
}
.results-header .export a:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }

/* === Table === */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
  text-align: left; padding: 10px 14px;
  background: #f1f5f9; color: var(--ink);
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 2px solid var(--line-strong); white-space: nowrap;
}
table.data thead th .sort { color: var(--muted); margin-left: 4px; font-size: 10px; }
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { background: var(--primary-soft); color: var(--primary); }
table.data tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover { background: #f8fafc; }
table.data tbody tr:last-child td { border-bottom: none; }

table.data tbody td.uni { font-weight: 600; color: var(--ink); }
table.data tbody td.uni .city { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 2px; font-family: var(--mono); }
table.data tbody td.dept { color: var(--ink-soft); font-size: 12.5px; }
table.data tbody td.spec .chip {
  display: inline-block; background: var(--primary-soft); color: var(--primary-dark);
  padding: 3px 9px; border-radius: 100px; font-size: 11.5px; font-weight: 500;
  border: 1px solid #bfdcec;
}
table.data tbody td.spec .chip.eek {
  background: var(--accent-soft); color: #b85a00; border-color: #fcd9b5;
}
table.data tbody td.spec .spec-law-tag {
  display: inline-block; margin-left: 6px; margin-top: 4px;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  background: #f1f5f9; padding: 1px 7px; border-radius: 4px;
  border: 1px solid var(--line); white-space: nowrap;
}
table.data tbody td.type-col {
  white-space: normal;  /* allow eek badge to break into 2 lines */
}
table.data tbody td.type-col .type-badge {
  display: inline-block; padding: 3px 9px;
  border-radius: 4px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap;  /* default: single line (e.g. ΣΑΕΚ) */
}
table.data tbody td.type-col .type-badge.saek {
  background: var(--primary-soft); color: var(--primary-dark);
  border: 1px solid #bfdcec;
}
table.data tbody td.type-col .type-badge.eek {
  background: var(--accent-soft); color: #b85a00;
  border: 1px solid #fcd9b5;
  letter-spacing: 0.04em;
  font-size: 10px; line-height: 1.25;
  padding: 4px 8px;
  text-align: center;
}
table.data tbody td.type-col .type-badge.eek > span {
  display: block; white-space: nowrap;  /* κάθε γραμμή block, δεν σπάει mid-word */
}
table.data tbody td.seats {
  text-align: center; font-weight: 700; color: var(--primary); font-size: 15px; font-family: var(--mono); white-space: nowrap;
}

/* Clickable percentage button */
.pct-link {
  display: inline-block; font: inherit; color: inherit;
  background: transparent; border: 1px dashed transparent;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
  transition: all 0.15s; line-height: 1;
}
.pct-link:hover {
  background: var(--primary-soft); color: var(--primary-dark);
  border-color: var(--primary); text-decoration: none;
}
.pct-link:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.pct-link::after {
  content: " ⓘ"; font-size: 11px; opacity: 0.5; margin-left: 2px;
  font-family: var(--sans); font-weight: 400;
}
.pct-link:hover::after { opacity: 1; }
table.data tbody td.src a {
  display: inline-block; padding: 4px 9px; background: #f1f5f9; color: var(--ink-soft);
  border-radius: 4px; font-size: 11px; font-family: var(--mono); font-weight: 500;
  border: 1px solid var(--line); transition: all 0.15s;
}
table.data tbody td.src a:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
table.data tbody td.src .plain {
  font-size: 11.5px; font-family: var(--mono); color: var(--ink-soft);
}

.no-results {
  padding: 48px 24px; text-align: center; color: var(--muted); font-size: 14px;
}
.no-results .big { font-size: 28px; margin-bottom: 8px; color: var(--ink-soft); }

/* === Pagination === */
.pagination {
  padding: 14px 20px; display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line); background: #fafbfc;
  font-size: 12.5px; flex-wrap: wrap; gap: 12px;
}
.pagination .info { color: var(--muted); }
.pagination .info strong { color: var(--ink); font-weight: 600; }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination .pages a, .pagination .pages span {
  padding: 6px 11px; border: 1px solid var(--line-strong); border-radius: 5px;
  color: var(--ink-soft); font-weight: 500; min-width: 32px; text-align: center;
  background: #fff;
}
.pagination .pages a:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .pages a.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .pages span.dots { border: none; background: transparent; }
.pagination .pages span.disabled { color: var(--line-strong); }

/* === Footer === */
footer {
  background: #1e293b; color: #94a3b8; padding: 16px 0; font-size: 12px;
}
footer .footer-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 32px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
footer a { color: #cbd5e1; }
footer a:hover { color: var(--accent); text-decoration: none; }

/* === Responsive === */
@media (max-width: 960px) {
  main { grid-template-columns: 1fr; padding: 16px; }
  aside.search-form { position: static; }
  header.main { padding: 20px 0; }
  header.main .row { padding: 0 16px; }
  nav.actionbar .actionbar-inner { padding: 0 16px; }
  .gov-bar-inner { padding: 0 16px; }
  footer .footer-inner { padding: 0 16px; }
  header.main .meta { text-align: left; }
}

@media (max-width: 640px) {
  .gov-bar { padding: 8px 16px; font-size: 11px; }
  header.main h1 { font-size: 18px; }
  header.main h1 .sub { font-size: 12px; }
  header.main .logo-mark { width: 48px; height: 48px; }

  /* Mobile: convert table to card layout */
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tbody tr {
    margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px;
    padding: 8px; background: #fff;
  }
  table.data tbody td { border-bottom: 1px dashed var(--line); padding: 8px 4px; }
  table.data tbody td:last-child { border-bottom: none; }
  table.data tbody td::before {
    content: attr(data-label);
    display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
    color: var(--muted); margin-bottom: 4px; letter-spacing: 0.05em;
  }
  table.data tbody td.seats { text-align: left; }
}

/* ============================================================================
   Modal: Λίστα ειδικοτήτων ανά placement
   ============================================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 9999;
  display: grid; place-items: center;
  padding: 24px;
  animation: fadeIn 0.15s ease-out;
}
.modal-backdrop[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-dialog {
  background: #fff;
  border-radius: 12px;
  width: 100%; max-width: 720px;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.2s ease-out;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, #f8fafc, #fff);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
}
.modal-header h3 {
  margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.3;
}
.modal-subtitle {
  margin-top: 6px; font-size: 12.5px; color: var(--muted);
}
.modal-subtitle strong { color: var(--primary); font-family: var(--mono); }
.modal-subtitle a { color: var(--primary); font-family: var(--mono); }

.modal-close {
  background: transparent; border: none; cursor: pointer;
  font-size: 18px; color: var(--muted);
  width: 32px; height: 32px; border-radius: 6px;
  display: grid; place-items: center;
  flex-shrink: 0; transition: background 0.15s;
}
.modal-close:hover { background: var(--line); color: var(--ink); }

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-loading {
  text-align: center; padding: 24px; color: var(--muted);
}

.spec-group-h {
  font-size: 13px; font-weight: 700;
  margin: 14px 0 8px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}
.spec-group-h:first-child { margin-top: 0; }
.spec-group-h .cnt { opacity: 0.7; font-weight: 500; font-size: 12px; margin-left: auto; }

.spec-group-h.saek {
  background: var(--primary-soft); color: var(--primary-dark);
  border: 1px solid #bfdcec;
}
.spec-group-h.eek {
  background: var(--accent-soft);  color: #b85a00;
  border: 1px solid #fcd9b5;
}

/* legacy: small inline badges (now unused in modal but kept για backwards compat) */
.badge-spec {
  display: inline-block; padding: 3px 9px;
  border-radius: 100px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.badge-spec.saek { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #bfdcec; }
.badge-spec.eek  { background: var(--accent-soft);  color: #b85a00;             border: 1px solid #fcd9b5; }

.spec-list {
  list-style: none; padding: 0; margin: 0 0 8px;
}
.spec-list li {
  padding: 7px 10px;
  font-size: 13px; color: var(--ink);
  border-bottom: 1px dashed var(--line);
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.spec-list li:hover { background: #fafbfc; }
.spec-list li:last-child { border-bottom: none; }
.spec-list .spec-name { flex: 1; line-height: 1.4; }
.spec-list .spec-law {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  background: #f1f5f9; padding: 2px 7px; border-radius: 4px;
  white-space: nowrap; flex-shrink: 0;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.modal-footer-info { font-size: 12px; color: var(--muted); }
.modal-footer-info strong { color: var(--ink); font-weight: 600; }
.btn-close-2 {
  padding: 8px 16px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-close-2:hover { background: var(--primary-dark); }

@media (max-width: 640px) {
  .modal-backdrop { padding: 0; }
  .modal-dialog { max-height: 100vh; border-radius: 0; max-width: none; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }
}

/* ============================================================================
   Modal toolbar (sort toggle)
   ============================================================================ */
.modal-toolbar {
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  display: flex; align-items: center; gap: 12px;
  font-size: 12.5px;
}
.modal-toolbar[hidden] { display: none; }
.modal-toolbar .toolbar-label {
  color: var(--muted); font-weight: 500;
}
.sort-toggle {
  display: inline-flex; background: #fff;
  border: 1px solid var(--line-strong); border-radius: 6px;
  overflow: hidden;
}
.sort-toggle .sort-btn {
  background: transparent; border: 0;
  padding: 6px 14px; font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; transition: all 0.15s;
}
.sort-toggle .sort-btn + .sort-btn {
  border-left: 1px solid var(--line);
}
.sort-toggle .sort-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.sort-toggle .sort-btn.active {
  background: var(--primary); color: #fff;
}
.sort-toggle .sort-btn.active:hover {
  background: var(--primary-dark);
}

/* === Sub-groups ανά νόμο μέσα στο ΣΑΕΚ section === */
.spec-law-group {
  margin: 10px 0 14px;
  padding-left: 8px;
  border-left: 3px solid var(--primary-soft);
}
.spec-law-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 4px; padding: 4px 8px;
  background: var(--primary-soft);
  border-radius: 4px;
}
.spec-law-header .spec-law-name {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: var(--primary-dark);
}
.spec-law-header .spec-law-cnt {
  font-size: 11px; color: var(--muted);
}
.spec-law-group .spec-list { margin-bottom: 0; }
.spec-law-group .spec-list li { padding-left: 10px; }

/* ============================================================================
   Sidebar: Σχετικά Έγγραφα
   ============================================================================ */
.sidebar-docs {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  background: #fafbfc;
  border-radius: 0 0 10px 10px;
}
.sidebar-docs .docs-title {
  font-size: 11.5px; font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.sidebar-docs .doc-link {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; margin: 4px -4px 0;
  border-radius: 6px;
  text-decoration: none; color: var(--ink);
  transition: background 0.15s;
  border: 1px solid transparent;
}
.sidebar-docs .doc-link:hover {
  background: var(--primary-soft);
  border-color: #bfdcec;
  text-decoration: none;
}
.sidebar-docs .doc-icon {
  font-size: 18px; flex-shrink: 0; line-height: 1.2;
}
.sidebar-docs .doc-text {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.sidebar-docs .doc-title {
  font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.3;
}
.sidebar-docs .doc-sub {
  font-size: 10.5px; color: var(--muted); font-family: var(--mono);
}

/* Όταν το .sidebar-docs είναι το τελευταίο στοιχείο, παίρνει το rounded bottom του card */

/* ============================================================================
   Στατιστικά panel (collapsible)
   ============================================================================ */
.stats-panel {
  max-width: 1400px; margin: 0 auto 0; padding: 0 32px;
}
.stats-toggle {
  width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 20px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font: inherit; color: var(--ink); transition: all 0.15s;
  margin-top: 16px;
}
.stats-toggle:hover {
  border-color: var(--primary); background: var(--primary-soft);
}
.stats-panel.open .stats-toggle {
  border-radius: 10px 10px 0 0;
  border-color: var(--primary);
  background: linear-gradient(to bottom, #f8fafc, #fff);
}
.stats-toggle-left {
  display: flex; align-items: center; gap: 12px;
}
.stats-toggle-icon { font-size: 18px; }
.stats-toggle-text { font-weight: 600; font-size: 14px; }
.stats-toggle-chevron {
  font-size: 11px; color: var(--muted); transition: transform 0.2s;
}
.stats-panel.open .stats-toggle-chevron { transform: rotate(180deg); color: var(--primary); }

.stats-body {
  background: var(--card); border: 1px solid var(--primary); border-top: 0;
  border-radius: 0 0 10px 10px; padding: 20px;
}
.stats-loading { text-align: center; padding: 20px; color: var(--muted); }

/* Summary tiles */
.stats-summary-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.stats-tile {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; text-align: center;
}
.stats-tile-value {
  font-size: 26px; font-weight: 700; color: var(--primary);
  font-family: var(--mono); line-height: 1;
}
.stats-tile-label {
  font-size: 11.5px; color: var(--muted); margin-top: 6px;
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
}

/* Charts grid 2x2 */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.stats-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 16px;
}
.stats-card h3 {
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.stats-chart-wrap {
  position: relative;
  /* height: set inline per-card */
}

@media (max-width: 960px) {
  .stats-panel { padding: 0 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-summary-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-summary-row { grid-template-columns: 1fr 1fr; }
  .stats-tile-value { font-size: 22px; }
}

/* ============================================================================
   Combobox (typeable + dropdown)
   ============================================================================ */
.combobox {
  position: relative;
}
.cb-input {
  width: 100%; padding: 8px 32px 8px 12px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  font: inherit; color: var(--ink); background: #fff;
  box-sizing: border-box;
}
.cb-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.cb-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); width: 20px; height: 20px;
  border-radius: 50%; font-size: 14px; line-height: 1;
  display: grid; place-items: center;
  transition: all 0.15s;
}
.cb-clear:hover { background: var(--line); color: var(--ink); }
.cb-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  margin: 4px 0 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 6px;
  max-height: 320px; overflow-y: auto;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}
.cb-option {
  padding: 7px 10px; cursor: pointer; border-radius: 4px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; line-height: 1.3;
}
.cb-option:hover, .cb-option.active {
  background: var(--primary-soft);
}
.cb-option.selected {
  background: var(--primary-soft); font-weight: 600;
}
.cb-empty {
  padding: 12px; color: var(--muted); text-align: center; font-style: italic;
  font-size: 12px;
}
.cb-tag {
  display: inline-block; flex-shrink: 0;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 3px;
  background: #f1f5f9; color: var(--ink-soft);
}
.cb-tag-saek { background: var(--primary-soft); color: var(--primary-dark); }
.cb-tag-eek  { background: var(--accent-soft); color: #b85a00; }

/* ============================================================================
   Modal explain banner
   ============================================================================ */
.modal-explain {
  margin: 0 0 12px; padding: 10px 14px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.5;
}
.modal-explain .info-icon {
  color: var(--primary); font-weight: 700; margin-right: 4px;
}
.modal-explain strong {
  color: var(--primary-dark); font-family: var(--mono); white-space: nowrap;
}
