/* =====================================================================
   ConTTure – design system
   Világos / sötét téma CSS-változókkal (html[data-theme])
   ===================================================================== */

:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #f4f5fb;
  --bg-elev: #ffffff;
  --bg-soft: #eef0f8;
  --bg-hover: #e7eaf5;
  --border: #e2e5f0;
  --border-strong: #cfd4e6;
  --text: #11142a;
  --text-soft: #3b4160;
  --muted: #6a7192;

  --accent: #00b4c6;
  --accent-2: #7b61ff;
  --accent-3: #ff4fa3;
  --accent-text: #5b42f3;
  --grad: linear-gradient(135deg, #00c2d4 0%, #7b61ff 55%, #ff4fa3 100%);
  --grad-soft: linear-gradient(135deg, rgba(0,194,212,.12), rgba(123,97,255,.12) 55%, rgba(255,79,163,.12));
  --ring: 0 0 0 3px rgba(123, 97, 255, .28);

  --high: #16a34a;
  --high-bg: rgba(22, 163, 74, .12);
  --low: #e11d48;
  --low-bg: rgba(225, 29, 72, .1);
  --warn: #d97706;

  --shadow-sm: 0 1px 2px rgba(17, 20, 42, .06), 0 1px 1px rgba(17, 20, 42, .04);
  --shadow-md: 0 10px 30px -12px rgba(17, 20, 42, .18), 0 2px 6px rgba(17, 20, 42, .05);
  --shadow-lg: 0 24px 60px -20px rgba(17, 20, 42, .35);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --topbar-h: 64px;
  --sidebar-w: 340px;

  --chart-text: #3b4160;
  --chart-grid: rgba(17, 20, 42, .07);
  --chart-label-bg: rgba(255, 255, 255, .85);

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0a0c16;
  --bg-elev: #131628;
  --bg-soft: #1a1e35;
  --bg-hover: #222746;
  --border: #252a48;
  --border-strong: #353b62;
  --text: #eef0ff;
  --text-soft: #c9cdea;
  --muted: #9097bd;
  --accent-text: #a897ff;
  --grad-soft: linear-gradient(135deg, rgba(0,194,212,.16), rgba(123,97,255,.18) 55%, rgba(255,79,163,.14));
  --high: #34d399;
  --high-bg: rgba(52, 211, 153, .14);
  --low: #fb7185;
  --low-bg: rgba(251, 113, 133, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
  --chart-text: #c9cdea;
  --chart-grid: rgba(255, 255, 255, .07);
  --chart-label-bg: rgba(19, 22, 40, .85);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { height: 100%; }
body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  /* finom színes „aura” a háttérben */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(0, 194, 212, .13), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(123, 97, 255, .12), transparent 60%),
    radial-gradient(700px 500px at 60% 110%, rgba(255, 79, 163, .08), transparent 60%);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- ikonok ---------- */
.i { width: 18px; height: 18px; flex: none; display: inline-block; }
.i svg { width: 100%; height: 100%; display: block; stroke: currentColor; fill: none;
         stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }

/* ---------- gombok ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: 12px; border: 1px solid transparent;
  font-weight: 650; font-size: 13.5px; white-space: nowrap;
  background: transparent; color: var(--text-soft);
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s, color .15s;
}
.btn:hover { background: var(--bg-hover); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.btn-primary {
  color: #fff;
  background: var(--grad);
  background-size: 140% 140%;
  box-shadow: 0 8px 22px -10px rgba(123, 97, 255, .8);
}
.btn-primary:hover { color: #fff; background: var(--grad); background-position: 100% 0; box-shadow: 0 10px 26px -10px rgba(123, 97, 255, .95); }

.btn-outline { border-color: var(--border); background: var(--bg-elev); }
.btn-outline:hover { border-color: var(--border-strong); }

.btn-icon { width: 38px; padding: 0; }
.btn-sm { height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12.5px; }
.btn-sm.btn-icon { width: 30px; padding: 0; }
.btn-block { width: 100%; }
.btn-danger:hover { color: var(--low); background: var(--low-bg); }
.modal .btn-danger { color: #fff; background: var(--low); border-color: var(--low); }
.modal .btn-danger:hover { color: #fff; background: var(--low); filter: brightness(1.08); }

.btn-dashed {
  width: 100%; height: 46px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--muted); background: transparent; font-weight: 700;
}
.btn-dashed:hover { color: var(--accent-text); border-color: var(--accent-2); background: var(--grad-soft); }

/* ---------- űrlapelemek ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.label {
  font-size: 11.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.label .hint { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--muted); opacity: .85; }

.input, .select {
  width: 100%; height: 40px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.select {
  appearance: none; padding-right: 34px;
  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='%236a7192' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus { outline: none; border-color: var(--accent-2); box-shadow: var(--ring); }

/* kapcsoló */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; color: var(--text-soft); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong);
  position: relative; transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s;
}
.switch input:checked + .track { background: var(--accent-2); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* szegmentált választó (chipek) */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.chip-opt {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 54px; padding: 8px 6px; text-align: center;
  border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev);
  font-size: 12px; font-weight: 650; color: var(--text-soft);
  transition: border-color .15s, background .15s, color .15s, transform .08s;
}
.chip-opt:hover { border-color: var(--border-strong); color: var(--text); }
.chip-opt.is-on {
  color: var(--accent-text); border-color: transparent;
  background: linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box, var(--grad) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 6px 18px -10px rgba(123, 97, 255, .7);
}
.chip-opt .i { width: 20px; height: 20px; }
.chips.compact .chip-opt { min-height: 46px; }

/* ---------- változóválasztó (kereshető) ---------- */
.picker { position: relative; }
.picker-btn {
  width: 100%; min-height: 40px; padding: 7px 34px 7px 12px; text-align: left;
  border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  position: relative;
}
.picker-btn::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  background: 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='%236a7192' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat center;
}
.picker-btn:hover { border-color: var(--border-strong); }
.picker.is-open .picker-btn { border-color: var(--accent-2); box-shadow: var(--ring); }
.picker.is-disabled .picker-btn { opacity: .55; pointer-events: none; }

/* téma ikon: világosban hold, sötétben nap */
html[data-theme="dark"] .show-light, html[data-theme="light"] .show-dark { display: none; }
.picker-placeholder { color: var(--muted); }
.picker-value { display: flex; flex-direction: column; min-width: 0; }
.picker-value .nm { font-weight: 700; font-size: 13px; }
.picker-value .lb { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 3px 4px 3px 9px; border-radius: 8px;
  background: var(--grad-soft); color: var(--accent-text);
  font-size: 12px; font-weight: 700;
}
.tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag button {
  border: 0; background: transparent; color: inherit; width: 18px; height: 18px; border-radius: 6px;
  display: grid; place-items: center; padding: 0; opacity: .75;
}
.tag button:hover { opacity: 1; background: rgba(123, 97, 255, .15); }

.picker-pop {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px; display: none;
  animation: pop .14s ease-out;
}
.picker.is-open .picker-pop { display: block; }
.picker-search { position: relative; margin-bottom: 6px; }
.picker-search .i { position: absolute; left: 10px; top: 11px; color: var(--muted); width: 16px; height: 16px; }
.picker-search input { padding-left: 34px; height: 38px; }
.picker-list { max-height: 300px; overflow: auto; overscroll-behavior: contain; }
.picker-opt {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 7px 8px; border-radius: 9px; border: 0; background: transparent; text-align: left;
}
.picker-opt:hover, .picker-opt.is-hl { background: var(--bg-hover); }
.picker-opt.is-sel { background: var(--grad-soft); }
.picker-opt .nm { font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.picker-opt .lb { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.picker-opt .txt { display: flex; flex-direction: column; min-width: 0; }
.picker-opt .cb {
  flex: none; width: 17px; height: 17px; margin-top: 1px; border-radius: 5px; border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; color: #fff;
}
.picker-opt.is-sel .cb { background: var(--accent-2); border-color: var(--accent-2); }
.picker-opt .cb svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 3.2; fill: none; opacity: 0; }
.picker-opt.is-sel .cb svg { opacity: 1; }
.picker-opt .badge-scale {
  margin-left: auto; flex: none; font-size: 10.5px; font-weight: 750; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; align-self: center;
}
.picker-empty, .picker-more { padding: 10px; color: var(--muted); font-size: 12.5px; text-align: center; }
.picker-foot { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--border); }

@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* =====================================================================
   App-váz
   ===================================================================== */

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg-elev) 78%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; flex: none; }
.brand img { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; box-shadow: 0 0 0 1px var(--border), 0 6px 18px -6px rgba(0, 194, 212, .6); }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.brand-name b {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 3px; }

.dash-title {
  flex: 1; min-width: 120px; max-width: 460px; margin-left: 10px;
  display: flex; align-items: center; gap: 8px;
}
.dash-title input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 11px; background: transparent;
  font-weight: 750; font-size: 15px; letter-spacing: -.01em;
}
.dash-title input:hover { background: var(--bg-soft); }
.dash-title input:focus { outline: none; background: var(--bg-elev); border-color: var(--accent-2); box-shadow: var(--ring); }
.dirty-dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-3);
  box-shadow: 0 0 0 4px rgba(255, 79, 163, .18); opacity: 0; transition: opacity .2s;
}
.dirty-dot.is-on { opacity: 1; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-sep { width: 1px; height: 26px; background: var(--border); margin: 0 6px; }

.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 70;
  min-width: 260px; max-width: 340px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; display: none;
  animation: pop .14s ease-out;
}
.dropdown.is-open .menu { display: block; }
.menu-title { padding: 8px 10px 6px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 10px; border: 0; background: transparent; text-align: left;
  font-weight: 600; color: var(--text-soft); text-decoration: none;
}
.menu-item:hover { background: var(--bg-hover); color: var(--text); }
.menu-item.is-current { background: var(--grad-soft); color: var(--accent-text); }
.menu-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .sub { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.menu-list { max-height: 320px; overflow: auto; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.menu-row { display: flex; align-items: center; gap: 2px; border-radius: 10px; }
.menu-row:hover { background: var(--bg-hover); }
.menu-row .menu-item:hover { background: transparent; }
.menu-row .del { opacity: 0; }
.menu-row:hover .del { opacity: 1; }

.avatar {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
  background: var(--grad);
}
.user-btn { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 8px 0 4px; border-radius: 13px; border: 0; background: transparent; }
.user-btn:hover { background: var(--bg-hover); }
.user-btn .nm { font-weight: 700; font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}
body.sidebar-collapsed .layout { grid-template-columns: 0 minmax(0, 1fr); }
body.sidebar-collapsed .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }

/* ---------- oldalsáv ---------- */
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overflow-x: hidden;
  padding: 18px 16px 28px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elev) 55%, transparent);
  transition: transform .25s, opacity .2s;
  scrollbar-width: thin;
}
.panel {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px; margin-bottom: 14px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.panel-title { margin: 0; font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.panel-title .num {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800; color: #fff; background: var(--grad);
}
.active-pill {
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11.5px; font-weight: 750; padding: 4px 9px; border-radius: 99px;
  background: var(--grad-soft); color: var(--accent-text);
}
.ds-meta { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-height: 18px; }
.ds-meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--high); box-shadow: 0 0 0 3px var(--high-bg); }
.ds-meta.is-loading .dot { background: var(--warn); animation: pulse 1s infinite; }

details.adv { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
details.adv summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  font-weight: 750; font-size: 13px; color: var(--text-soft); padding: 2px 0;
}
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary .i { transition: transform .2s; color: var(--muted); }
details.adv[open] summary .i { transform: rotate(180deg); }
details.adv .adv-body { padding-top: 12px; }
.adv-badge { font-size: 11px; font-weight: 750; color: var(--accent-text); background: var(--grad-soft); border-radius: 99px; padding: 2px 8px; margin-left: 6px; }

.inline-note {
  margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; font-weight: 600;
  background: var(--bg-soft); color: var(--text-soft); display: none;
}
.inline-note.is-warn { display: block; background: rgba(217, 119, 6, .12); color: var(--warn); }
.status-line { margin-top: 12px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; min-height: 18px; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong);
  border-top-color: var(--accent-2); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }

.sidebar-foot { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 18px; line-height: 1.6; }
.kbd { font-size: 11px; font-weight: 700; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 0 5px; background: var(--bg-elev); }

/* ---------- vászon ---------- */
.canvas { padding: 22px 24px 60px; min-width: 0; }

.canvas-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.canvas-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.canvas-head h1 .wave { display: inline-block; }
.canvas-head p { margin: 4px 0 0; color: var(--muted); font-weight: 500; }
.canvas-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  padding: 8px 12px; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted); font-weight: 600; box-shadow: var(--shadow-sm);
}
.stat b { color: var(--text); font-size: 15px; font-weight: 800; margin-right: 4px; }

#chartsContainer { --grid-cols: 12; --gap: 18px; position: relative; width: 100%; min-height: 120px; }

/* ---------- diagramkártya ---------- */
.chart-card {
  position: absolute;
  display: flex; flex-direction: column;
  min-height: 220px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s, left .25s ease, top .25s ease, width .25s ease;
}
.chart-card.no-anim { transition: none; }
.chart-card:hover { border-color: var(--border-strong); }
.chart-card.is-active {
  border-color: transparent;
  background: linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box, var(--grad) border-box;
  border: 1.5px solid transparent;
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(123, 97, 255, .12);
}
.chart-card.is-dragging { opacity: .45; }
.chart-card.is-drop-target { box-shadow: var(--shadow-md), 0 0 0 3px var(--accent-2); }

.card-head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 4px 10px; }
.drag-handle {
  flex: none; width: 22px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  color: var(--muted); cursor: grab; opacity: .55; border: 0; background: transparent; padding: 0;
}
.drag-handle:hover { opacity: 1; background: var(--bg-hover); }
.drag-handle:active { cursor: grabbing; }
.card-titles { flex: 1; min-width: 0; padding-top: 3px; }
.card-title {
  font-weight: 800; font-size: 15px; letter-spacing: -.01em; line-height: 1.3;
  cursor: text; border-radius: 7px; padding: 1px 4px; margin-left: -4px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card-title:hover { background: var(--bg-soft); }
.card-title-input {
  width: 100%; font-weight: 800; font-size: 15px; padding: 2px 6px; margin-left: -6px;
  border-radius: 8px; border: 1px solid var(--accent-2); box-shadow: var(--ring); background: var(--bg-elev);
}
.card-sub { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px;
  background: var(--bg-soft); color: var(--text-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill.accent { background: var(--grad-soft); color: var(--accent-text); }
.pill .i { width: 12px; height: 12px; }

.card-actions { display: flex; align-items: center; gap: 2px; flex: none; opacity: .65; transition: opacity .15s; }
.chart-card:hover .card-actions, .chart-card.is-active .card-actions { opacity: 1; }
.card-actions .btn { color: var(--muted); }
.card-actions .btn:hover { color: var(--text); }
.card-actions .btn.is-on { color: var(--accent-text); background: var(--grad-soft); }
.size-select {
  height: 30px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-elev);
  font-size: 12px; font-weight: 700; padding: 0 22px 0 8px; color: var(--text-soft);
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236a7192' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center;
}

.card-body { position: relative; flex: 1 1 auto; min-height: 0; padding: 4px 14px 6px; }
.card-body canvas { display: block; }
.chart-holder { position: absolute; inset: 4px 14px 6px; }
.chart-card.is-table .chart-holder { display: none; }
.table-wrap { position: absolute; inset: 4px 14px 6px; overflow: auto; display: none; }
.chart-card.is-table .table-wrap { display: block; }

.card-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 18px; color: var(--muted);
}
.card-empty .art {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: var(--grad-soft); color: var(--accent-text);
}
.card-empty .art .i { width: 30px; height: 30px; }
.card-empty b { color: var(--text); font-size: 14px; }
.card-empty p { margin: 0; max-width: 280px; font-size: 12.5px; }
.card-loading { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg-elev) 60%, transparent); backdrop-filter: blur(2px); }
.card-loading .spinner { width: 26px; height: 26px; border-width: 3px; }
.card-error { color: var(--low); }
.card-error .art { background: var(--low-bg); color: var(--low); }

.card-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 6px 16px 12px; font-size: 11.5px; color: var(--muted); font-weight: 600;
}
.card-foot:empty { display: none; }
.legend-box { display: inline-flex; align-items: center; gap: 5px; }
.legend-box i { width: 12px; height: 12px; border-radius: 4px; border: 2px solid; display: inline-block; }
.legend-box i.h { border-color: var(--high); background: var(--high-bg); }
.legend-box i.l { border-color: var(--low); background: var(--low-bg); }

/* ---------- táblázat nézet ---------- */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--bg-elev);
  font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.data-table td.num, .data-table th.num { text-align: right; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { min-width: 150px; max-width: 280px; }
.data-table thead th:first-child { text-transform: none; letter-spacing: 0; }
.data-table .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.data-table tbody tr:hover td { background: var(--bg-soft); }
.data-table tfoot td { font-weight: 800; border-bottom: 0; border-top: 1.5px solid var(--border-strong); }
.data-table .letter {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 6px;
  border-radius: 6px; background: var(--bg-soft); color: var(--muted); font-size: 10.5px; font-weight: 800;
}
.data-table .n { color: var(--muted); font-weight: 600; }
.sig { display: inline-block; padding: 1px 6px; border-radius: 7px; border: 2px solid transparent; font-weight: 800; }
.sig.h { border-color: var(--high); background: var(--high-bg); color: var(--high); }
.sig.l { border-color: var(--low); background: var(--low-bg); color: var(--low); }
.sup { font-size: 10px; font-weight: 800; color: var(--accent-text); margin-left: 3px; vertical-align: super; letter-spacing: .03em; }

/* ---------- üres állapot (nincs diagram) ---------- */
.empty-hero {
  display: none; text-align: center; padding: 70px 20px; border-radius: var(--radius-lg);
  border: 1.5px dashed var(--border-strong); background: var(--grad-soft);
}
.empty-hero.is-on { display: block; }
.empty-hero h2 { margin: 12px 0 6px; font-size: 22px; letter-spacing: -.02em; }
.empty-hero p { margin: 0 auto 18px; max-width: 420px; color: var(--muted); }

/* ---------- toast + modal ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 380px;
  padding: 11px 14px; border-radius: 14px;
  background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); font-weight: 650; font-size: 13px;
  animation: toast-in .25s cubic-bezier(.2, .9, .3, 1.2);
}
.toast .ic { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .14); }
.toast.ok .ic { background: var(--high); color: #fff; }
.toast.err .ic { background: var(--low); color: #fff; }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

.modal-back {
  position: fixed; inset: 0; z-index: 150; display: none; place-items: center; padding: 20px;
  background: rgba(10, 12, 22, .45); backdrop-filter: blur(4px);
}
.modal-back.is-on { display: grid; }
.modal {
  width: 100%; max-width: 420px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 22px;
  animation: pop .16s ease-out;
}
.modal h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.02em; }
.modal p { margin: 0 0 16px; color: var(--muted); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- reszponzív ---------- */
@media (max-width: 1100px) {
  .dash-title { max-width: 280px; }
  .hide-md { display: none !important; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 300px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 40; width: min(92vw, 360px);
    background: var(--bg); box-shadow: var(--shadow-lg);
  }
  body:not(.sidebar-open) .sidebar { transform: translateX(-105%); }
  body.sidebar-collapsed .layout { grid-template-columns: minmax(0, 1fr); }
  .brand-text, .hide-sm { display: none !important; }
  .canvas { padding: 16px; }
}

/* =====================================================================
   Belépés
   ===================================================================== */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; position: relative; z-index: 1;
}
.auth-art {
  position: relative; overflow: hidden; color: #fff;
  background: #0a0c16;
  display: flex; flex-direction: column; justify-content: space-between; padding: 44px;
}
.auth-art .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .85; }
.auth-art .b1 { width: 460px; height: 460px; background: #00c2d4; top: -120px; left: -80px; animation: float 14s ease-in-out infinite; }
.auth-art .b2 { width: 420px; height: 420px; background: #7b61ff; bottom: -140px; right: -60px; animation: float 17s ease-in-out infinite reverse; }
.auth-art .b3 { width: 280px; height: 280px; background: #ff4fa3; top: 45%; left: 40%; opacity: .55; animation: float 12s ease-in-out infinite; }
@keyframes float { 50% { transform: translate(40px, 30px) scale(1.08); } }
.auth-art > * { position: relative; }
.auth-art .brand-name { font-size: 22px; }
.auth-art .brand-name b { background: none; color: #fff; }
.auth-art .brand-sub { color: rgba(255, 255, 255, .7); }
.auth-claim { max-width: 460px; }
.auth-claim h1 { font-size: 46px; line-height: 1.05; letter-spacing: -.04em; margin: 0 0 16px; font-weight: 800; }
.auth-claim p { font-size: 16px; color: rgba(255, 255, 255, .78); margin: 0; }
.auth-bars { display: flex; align-items: flex-end; gap: 10px; height: 120px; margin-bottom: 28px; }
.auth-bars span {
  flex: 1; border-radius: 10px 10px 4px 4px; background: rgba(255, 255, 255, .22);
  backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .25);
  animation: grow 1.2s cubic-bezier(.2, .9, .3, 1) both;
}
.auth-bars span:nth-child(2) { animation-delay: .1s; }
.auth-bars span:nth-child(3) { animation-delay: .2s; background: rgba(255, 255, 255, .5); }
.auth-bars span:nth-child(4) { animation-delay: .3s; }
.auth-bars span:nth-child(5) { animation-delay: .4s; }
@keyframes grow { from { transform: scaleY(0); transform-origin: bottom; } }
.auth-foot { font-size: 12.5px; color: rgba(255, 255, 255, .6); }

.auth-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 28px; letter-spacing: -.03em; margin: 0 0 6px; }
.auth-card .lead { color: var(--muted); margin: 0 0 26px; }
.auth-card .field + .field { margin-top: 16px; }
.auth-card .input { height: 46px; border-radius: 13px; }
.auth-card .btn-primary { height: 48px; margin-top: 24px; font-size: 15px; border-radius: 13px; }
.auth-error {
  display: flex; gap: 10px; align-items: center; padding: 11px 13px; border-radius: 12px; margin-bottom: 18px;
  background: var(--low-bg); color: var(--low); font-weight: 650; font-size: 13px;
}
.auth-tools { position: absolute; top: 18px; right: 18px; z-index: 5; display: flex; align-items: center; gap: 8px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 220px; padding: 28px; }
  .auth-claim h1 { font-size: 32px; }
  .auth-bars { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Exportált (önálló) HTML nézegető
   ===================================================================== */
.viewer-grid { position: relative; z-index: 1; width: 100%; min-height: 120px; }
.viewer-grid .chart-card { resize: none; }
.viewer-title { font-weight: 800; font-size: 15px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-foot { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: 12px; margin: 30px 0 0; }

/* ---------- szignifikancia: nyíl stílus + stílusváltó ---------- */
.sig-a { font-weight: 800; white-space: nowrap; }
.sig-a i { font-style: normal; font-size: .82em; margin-left: 4px; }
.sig-a.h { color: var(--high); }
.sig-a.l { color: var(--low); }
.legend-arrow { font-weight: 750; }
.legend-arrow.h { color: var(--high); }
.legend-arrow.l { color: var(--low); }

.seg-wrap { display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 12px;
  background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-sm); font-size: 12px; color: var(--muted); font-weight: 650; }
.seg { display: inline-flex; background: var(--bg-soft); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-soft); font-weight: 700; font-size: 12px;
  height: 28px; padding: 0 10px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--bg-elev); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.seg .arr-h { color: var(--high); } .seg .arr-l { color: var(--low); }
.seg .frm { width: 12px; height: 12px; border-radius: 4px; border: 2px solid var(--high); display: inline-block; }

/* ---------- csoportonkénti kis körök (kör/gyűrű + bontás) ---------- */
.pie-grid { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; }
.pie-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; font-weight: 600; color: var(--text-soft); }
.pie-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pie-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pie-cells { flex: 1; min-height: 0; display: grid; gap: 8px 12px; grid-auto-rows: minmax(0, 1fr); }
.pie-cell { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pie-title { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--text); min-width: 0; }
.pie-title .pt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-title .letter { flex: none; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 6px; background: var(--bg-soft); color: var(--muted); font-size: 10.5px; font-weight: 800; }
.pie-sub { font-size: 10.5px; color: var(--muted); font-weight: 600; min-height: 14px; text-align: center; }
.pie-canvas { position: relative; flex: 1; min-height: 0; }

/* ---------- kártya átméretezése (jobb szél, alsó szél, sarok) ---------- */
.rz { position: absolute; z-index: 6; touch-action: none; }
.rz-e { top: 14px; bottom: 14px; right: 0; width: 8px; cursor: ew-resize; }
.rz-s { left: 14px; right: 14px; bottom: 0; height: 8px; cursor: ns-resize; }
.rz-se { right: 0; bottom: 0; width: 20px; height: 20px; cursor: nwse-resize; }
.rz-se::after {
  content: ""; position: absolute; right: 5px; bottom: 5px; width: 9px; height: 9px; opacity: .35;
  background: linear-gradient(135deg, transparent 0 45%, var(--muted) 45% 55%, transparent 55% 70%, var(--muted) 70% 80%, transparent 80%);
  transition: opacity .15s;
}
.chart-card:hover .rz-se::after, .chart-card.is-resizing .rz-se::after { opacity: .9; }
.rz-e:hover, .rz-s:hover { background: linear-gradient(var(--accent-2), var(--accent-2)) center / 2px 40% no-repeat; opacity: .5; }
.rz-s:hover { background-size: 40% 2px; }
.chart-card.is-resizing { transition: box-shadow .2s, left .2s ease, top .2s ease; box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-2); }
body.is-resizing-e, body.is-resizing-e * { cursor: ew-resize !important; user-select: none; }
body.is-resizing-s, body.is-resizing-s * { cursor: ns-resize !important; user-select: none; }
body.is-resizing-se, body.is-resizing-se * { cursor: nwse-resize !important; user-select: none; }

/* ---------- nyelvválasztó (zászlók) ---------- */
.lang-switch { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 2px; gap: 2px; }
.lang-switch button {
  border: 0; background: transparent; color: var(--text-soft); font: inherit; font-weight: 750; font-size: 11.5px; letter-spacing: .02em;
  height: 30px; padding: 0 8px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  opacity: .62; transition: opacity .15s, background .15s, color .15s;
}
.lang-switch button:hover { opacity: 1; color: var(--text); }
.lang-switch button.is-on { opacity: 1; background: var(--bg-elev); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.lang-switch .flag { width: 20px; height: 14px; border-radius: 3px; overflow: hidden; display: inline-flex;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); flex: none; }
.lang-switch .flag svg { width: 100%; height: 100%; display: block; }
@media (max-width: 640px) {
  .lang-switch .code { display: none; }
  .lang-switch button { padding: 0 6px; }
}

/* ---------- rendezés gomb ---------- */
.sort-btn.is-on { color: var(--accent-text); background: var(--accent-soft, var(--bg-soft)); }
.sort-mark { color: var(--accent-text); font-weight: 800; min-width: 12px; text-align: right; }
