:root {
  --bg: #0b1220;
  --bg2: #111a2e;
  --card: #152238;
  --card2: #1a2a44;
  --line: #2a3d5c;
  --text: #e8eef8;
  --muted: #9aa8c0;
  --gold: #d4a84b;
  --gold2: #f0c56d;
  --navy: #1e3a5f;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --danger: #e85d5d;
  --info: #5b9fd4;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0,0,0,.35);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2f55 0%, transparent 55%),
              radial-gradient(900px 500px at 100% 0%, #2a2210 0%, transparent 40%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}
a { color: var(--gold2); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 14px 14px 90px; }
header.app-head {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), #8a6418);
  display: grid; place-items: center; font-weight: 800; color: #1a1205;
  box-shadow: 0 0 0 3px rgba(212,168,75,.25);
}
.brand h1 { margin: 0; font-size: 1.15rem; letter-spacing: .02em; }
.brand p { margin: 0; color: var(--muted); font-size: .82rem; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(212,168,75,.12); color: var(--gold2);
  border: 1px solid rgba(212,168,75,.35);
  padding: 6px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.nav-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
  position: sticky; top: 0; z-index: 20;
  background: rgba(11,18,32,.85); backdrop-filter: blur(10px);
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.nav-tabs button {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; font-size: .85rem; cursor: pointer;
}
.nav-tabs button.active {
  background: linear-gradient(135deg, #2a4068, #1e3050);
  border-color: var(--gold); color: var(--gold2);
}
.kpi-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px;
}
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.55rem; font-weight: 700; margin-top: 2px; }
.kpi.gold .value { color: var(--gold2); }
.kpi.warn .value { color: var(--warn); }
.kpi.ok .value { color: var(--ok); }
.kpi.danger .value { color: var(--danger); }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 10px; font-size: 1rem; display: flex; align-items: center; gap: 8px;
}
.panel h2 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.charts {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; margin-bottom: 14px;
}
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }
.chart-box { min-height: 260px; position: relative; }
.chart-box canvas { max-height: 240px; }
.advisor {
  background: linear-gradient(135deg, rgba(212,168,75,.12), rgba(30,58,95,.35));
  border: 1px solid rgba(212,168,75,.35);
}
.advisor ul { margin: 0; padding-left: 18px; }
.advisor li { margin: 8px 0; color: var(--text); font-size: .92rem; }
.advisor li strong { color: var(--gold2); }
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center;
}
.filters select, .filters input, .search {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; font-size: .9rem; min-width: 0;
}
.filters select { flex: 1 1 140px; }
.filters .search { flex: 2 1 180px; }
.mail-list { display: flex; flex-direction: column; gap: 8px; }
.mail-card {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; cursor: pointer; transition: border-color .15s, transform .15s;
}
.mail-card:hover, .mail-card.active { border-color: var(--gold); transform: translateY(-1px); }
.mail-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mail-site { font-size: .72rem; color: var(--gold2); font-weight: 600; }
.mail-date { font-size: .72rem; color: var(--muted); }
.mail-subject { font-weight: 650; margin: 4px 0; font-size: .95rem; }
.mail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  font-size: .7rem; padding: 3px 8px; border-radius: 999px;
  background: rgba(91,159,212,.15); color: #9cc8eb; border: 1px solid rgba(91,159,212,.3);
}
.chip.intent-produkcio { background: rgba(212,168,75,.15); color: var(--gold2); border-color: rgba(212,168,75,.35); }
.chip.intent-helyszin { background: rgba(62,207,142,.12); color: #7be0b0; border-color: rgba(62,207,142,.3); }
.chip.intent-sponzor { background: rgba(240,180,41,.12); color: #f5c85a; border-color: rgba(240,180,41,.3); }
.chip.intent-spam_gyanu, .chip.funnel-spam { background: rgba(232,93,93,.15); color: #f09999; border-color: rgba(232,93,93,.35); }
.chip.funnel-uj { background: rgba(91,159,212,.15); color: #9cc8eb; }
.chip.funnel-adat_kell { background: rgba(240,180,41,.15); color: #f5c85a; }
.chip.funnel-piszkozat { background: rgba(160,140,255,.15); color: #c5b8ff; }
.chip.funnel-kuldheto { background: rgba(62,207,142,.15); color: #7be0b0; }
.chip.missing { background: rgba(232,93,93,.1); color: #f0a0a0; border-color: rgba(232,93,93,.25); }
.mail-excerpt { color: var(--muted); font-size: .82rem; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

/* Drawer */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; width: min(520px, 100%); height: 100%;
  background: var(--bg2); border-left: 1px solid var(--line); z-index: 50;
  transform: translateX(105%); transition: transform .25s ease; overflow-y: auto;
  padding: 16px 16px 100px; box-shadow: -12px 0 40px rgba(0,0,0,.4);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.drawer-head h3 { margin: 0; font-size: 1.05rem; }
.close-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem;
}
.field { margin: 12px 0; }
.field label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.field .val { font-size: .92rem; word-break: break-word; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: flex; align-items: center; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid var(--line); font-size: .9rem;
}
.checklist .ok { color: var(--ok); }
.checklist .bad { color: var(--danger); }
textarea.draft {
  width: 100%; min-height: 160px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-family: inherit;
  font-size: .9rem; resize: vertical;
}
.actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px;
  position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg2) 20%);
  padding-top: 12px;
}
.actions button {
  border: none; border-radius: 11px; padding: 11px 10px; font-weight: 650;
  font-size: .85rem; cursor: pointer; color: #0d1524;
}
.btn-send { background: linear-gradient(135deg, #3ecf8e, #2aaf74); }
.btn-ask { background: linear-gradient(135deg, #f0b429, #d4921a); }
.btn-db { background: linear-gradient(135deg, #5b9fd4, #3a7fb8); color: #fff; }
.btn-spam { background: linear-gradient(135deg, #e85d5d, #c43d3d); color: #fff; }
.btn-wait { background: linear-gradient(135deg, #8a7cc8, #6a5cac); color: #fff; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--card); border: 1px solid var(--gold); color: var(--text);
  padding: 10px 16px; border-radius: 12px; z-index: 60; font-size: .88rem;
  transition: transform .25s; max-width: 90vw; text-align: center;
  box-shadow: var(--shadow);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ORI panel */
.ori-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
@media (max-width: 800px) { .ori-grid { grid-template-columns: 1fr; } }
.ori-form label { display: block; font-size: .8rem; color: var(--muted); margin: 8px 0 4px; }
.ori-form input, .ori-form textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px; font-size: .9rem; font-family: inherit;
}
.ori-form textarea { min-height: 90px; }
.meter-wrap { margin-top: 8px; }
.meter {
  height: 12px; background: var(--bg); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line);
}
.meter > span {
  display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--ok));
  width: 0%; transition: width .3s;
}
.ori-status {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-weight: 650; font-size: .9rem;
}
.ori-status.incomplete { background: rgba(240,180,41,.12); color: var(--warn); border: 1px solid rgba(240,180,41,.35); }
.ori-status.ready { background: rgba(62,207,142,.12); color: var(--ok); border: 1px solid rgba(62,207,142,.35); }
.req-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: .88rem; }
.req-list li { margin: 6px 0; }
.req-list .done { color: var(--ok); }
.section-hidden { display: none !important; }
.foot-note { color: var(--muted); font-size: .78rem; text-align: center; margin-top: 20px; }
.funnel-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: .75rem; color: var(--muted); }
.funnel-legend span::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px;
}
