/* GluX dashboard — mobil-első. A színek a docs/glux-design-system.md tokenjei. */
:root {
  --navy: #16255c;
  --green: #006400;
  --teal: #00838f;
  --surface: #ecf2fe;
  --lines: #b8c3e9;
  --bg: #f5f7fc;
  --card: #ffffff;
  --text: #16255c;
  --muted: #5a6690;
  --ok: #0a7d32;
  --ok-bg: #e3f5e8;
  --warn: #9a6200;
  --warn-bg: #fff3cd;
  --err: #c62828;
  --err-bg: #fdecea;
  --unk: #5a6690;
  --unk-bg: #eef0f6;
  --in: #0a7d32;
  --out: #c62828;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 37, 92, .06), 0 4px 16px rgba(22, 37, 92, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1330;
    --card: #151d42;
    --surface: #1c2654;
    --lines: #2c3870;
    --text: #e8ecfb;
    --muted: #9aa5cf;
    --ok: #5fd38a;
    --ok-bg: #133a26;
    --warn: #f3c25b;
    --warn-bg: #3d3112;
    --err: #ff8a80;
    --err-bg: #3f1a1d;
    --unk: #9aa5cf;
    --unk-bg: #1f2850;
    --in: #5fd38a;
    --out: #ff8a80;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ---------- fejléc */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--navy); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
.top h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.top h1 span { opacity: .65; font-weight: 500; }
.top .spacer { flex: 1; }
.top .stamp { font-size: 12px; opacity: .75; white-space: nowrap; }
.iconbtn {
  border: 0; background: rgba(255,255,255,.12); color: #fff;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  display: inline-grid; place-items: center; font-size: 18px;
}
.iconbtn:active { transform: scale(.96); }
.iconbtn.spin span { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

html, body { overflow-x: hidden; }
main { max-width: 1280px; margin: 0 auto; padding: 14px 16px 24px; }

/* ---------- összkép sáv */
.pulse {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px;
}
.pulse .p {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px; text-align: center; border: 1px solid transparent;
}
.pulse .p b { display: block; font-size: 24px; line-height: 1.1; }
.pulse .p small { color: var(--muted); font-size: 12px; }
.pulse .ok b { color: var(--ok); }
.pulse .warn b { color: var(--warn); }
.pulse .err b { color: var(--err); }

/* ---------- szekciók */
section.view { display: none; }
section.view.on { display: block; }
h2.sec {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin: 22px 2px 8px; font-weight: 700;
}
h2.sec:first-child { margin-top: 4px; }

.grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- rendszerkártya */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  border-left: 4px solid var(--unk);
}
.card.ok { border-left-color: var(--ok); }
.card.warn { border-left-color: var(--warn); }
.card.error { border-left-color: var(--err); }
.card .head { display: flex; align-items: flex-start; gap: 10px; }
.card .emoji { font-size: 22px; line-height: 1; margin-top: 1px; }
.card .title { flex: 1; min-width: 0; }
.card .title h3 { margin: 0; font-size: 16px; }
.card .title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.badge {
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; white-space: nowrap;
  background: var(--unk-bg); color: var(--unk);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.error { background: var(--err-bg); color: var(--err); }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.metric { background: var(--surface); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.metric b { display: block; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.metric small { color: var(--muted); font-size: 12px; display: block; }
.note { font-size: 13px; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.note.err { color: var(--err); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links a {
  text-decoration: none; font-size: 13px; font-weight: 600; border-radius: 9px; padding: 8px 11px;
  border: 1px solid var(--lines); min-height: 36px; display: inline-flex; align-items: center;
}
.links a.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.links a:active { transform: scale(.97); }

/* ---------- cashflow */
.cf-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.seg { display: inline-flex; background: var(--card); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.seg button {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted); min-height: 34px;
}
.seg button.on { background: var(--navy); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; min-width: 0; }
.kpi small { color: var(--muted); font-size: 12px; display: block; }
.kpi b { font-size: 17px; display: block; overflow-wrap: anywhere; }
.kpi.in b { color: var(--in); }
.kpi.out b { color: var(--out); }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; }
.bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; height: 100%; position: relative; }
.bars .col i { display: block; border-radius: 3px 3px 0 0; min-height: 0; }
.bars .col i.in { background: var(--in); }
.bars .col i.out { background: var(--out); opacity: .8; border-radius: 0 0 3px 3px; }
.bars .col:hover { outline: 1px dashed var(--lines); outline-offset: 1px; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--surface); align-items: baseline; }
.rows li:first-child { border-top: 0; }
.rows .l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .l small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .r { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rows .r.in { color: var(--in); }
.rows .r.out { color: var(--out); }
.tip { font-size: 12px; color: var(--muted); margin: 6px 0 0; min-height: 1.3em; }

/* ---------- fejlesztések */
.dev-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.dev-filter::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--lines); background: var(--card); border-radius: 999px; padding: 6px 12px;
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; min-height: 34px;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.dev { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.dev h3 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dev h3 em { font-style: normal; font-weight: 600; font-size: 12px; color: var(--muted); }
.dev p { margin: 6px 0 0; font-size: 14px; }
.dev ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.dev ul li { margin: 2px 0; }
.dev .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.dev .meta span { font-size: 11px; font-weight: 700; background: var(--surface); border-radius: 6px; padding: 3px 7px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }

/* ---------- alsó navigáció (telefon) / oldalsó (gép) */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card); border-top: 1px solid var(--lines);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  border: 0; background: transparent; padding: 8px 4px 9px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600; color: var(--muted); min-height: 56px;
}
nav.tabs button span { font-size: 20px; line-height: 1; }
nav.tabs button.on { color: var(--teal); }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  nav.tabs {
    position: sticky; top: 58px; bottom: auto; left: auto; right: auto;
    max-width: 1280px; margin: 0 auto; border: 0; background: transparent;
    display: flex; gap: 6px; padding: 12px 16px 0;
  }
  nav.tabs button {
    flex-direction: row; gap: 7px; font-size: 14px; min-height: 40px; padding: 8px 14px;
    border-radius: 10px; background: var(--card); box-shadow: var(--shadow);
  }
  nav.tabs button span { font-size: 16px; }
  nav.tabs button.on { background: var(--navy); color: #fff; }
}

/* ---------- belépés */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; text-align: center; }
.login h2 { margin: 0 0 6px; }
.login p { color: var(--muted); margin: 0 0 16px; }
.login input {
  width: 100%; font: inherit; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--lines);
  background: var(--card); color: var(--text); margin-bottom: 10px; font-size: 16px;
}
.login button {
  width: 100%; border: 0; border-radius: 10px; padding: 12px; background: var(--teal); color: #fff;
  font-weight: 700; cursor: pointer; font-size: 16px;
}
.login .err { color: var(--err); font-size: 14px; min-height: 1.4em; }
.skeleton { background: linear-gradient(90deg, var(--surface), var(--card), var(--surface)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); height: 150px; }
@keyframes sk { to { background-position: -200% 0; } }
.hidden { display: none !important; }
