/* Kolipak Palettenzähler — v4
   Industrial, flat, one light theme. Barlow / Barlow Condensed. */

:root {
  --bg: #EDEFF2;
  --surface: #FFFFFF;
  --ink: #182129;
  --muted: #5D6B77;
  --line: #D5DBE1;
  --line-soft: #E6EAEE;
  --accent: #E8630A;
  --accent-dark: #C4520A;
  --ok: #1E8E5A;
  --off: #8A97A3;
  --bad: #C8362B;
  --warn: #D99A00;
  --bar: #1B2530;
  --bar-ink: #E8EDF2;
  --bar-muted: #8C9AA8;
  --r: 3px;
  --font: "Barlow", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --tab-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--font); font-variant-numeric: tabular-nums;
  min-height: 100vh;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--cond); font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 30px; line-height: 1.1; text-transform: uppercase; }
p { margin: 0 0 12px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.num, td.num, th.num { text-align: right; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }

/* ---- top bar ------------------------------------------------------- */
.topbar { background: var(--bar); color: var(--bar-ink); border-bottom: 3px solid var(--accent); }
.topbar-in { display: flex; align-items: center; height: 56px; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff;
  font-family: var(--cond); font-weight: 700; font-size: 22px; letter-spacing: .06em; }
.brand-mark { width: 16px; height: 16px; border-top: 5px solid var(--accent); border-bottom: 5px solid var(--accent); }
.brand-sub { color: var(--bar-muted); font-weight: 500; font-size: 15px; letter-spacing: .02em; text-transform: uppercase; margin-left: 2px; }
.nav-desktop { display: flex; gap: 2px; margin-left: auto; height: 100%; }
.nav-desktop a { display: flex; align-items: center; padding: 0 14px; text-decoration: none; color: var(--bar-muted);
  font-family: var(--cond); font-weight: 600; font-size: 17px; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 3px solid transparent; margin-bottom: -3px; }
.nav-desktop a:hover { color: #fff; }
.nav-desktop a.on { color: #fff; border-bottom-color: #fff; }
.nav-out { color: var(--bar-muted); font-size: 13px; text-decoration: none; }
.nav-out:hover { color: #fff; }

/* ---- content ------------------------------------------------------- */
.content { padding: 26px 20px 60px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.flash { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r); margin-bottom: 18px;
  border-left: 4px solid var(--accent); transition: opacity .4s; }
.flash.gone { opacity: 0; }

.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.section-head .meta { color: var(--muted); font-size: 13px; }
.section-head a.meta { text-decoration: none; }
.section-head a.meta:hover { color: var(--accent-dark); text-decoration: underline; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; gap: 0; } }

.empty { color: var(--muted); padding: 10px 0; }
.empty a { color: var(--accent-dark); }

/* ---- stat strip ---------------------------------------------------- */
.stats { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 28px; }
.stat { padding: 16px 20px 14px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { display: block; font-family: var(--cond); font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  font-size: 13px; color: var(--muted); }
.stat-value { display: block; font-family: var(--cond); font-weight: 700; font-size: 56px; line-height: 1; margin-top: 6px; }
.stat-hero .stat-value { font-size: 84px; color: var(--accent); }
.stat-hero .stat-value::after { content: " Paletten"; font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: .02em; }
.stat-foot { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat-hero { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .stat-value { font-size: 36px; }
  .stat-hero .stat-value { font-size: 64px; }
  .stat-hero .stat-value::after { font-size: 16px; }
  .stat { padding: 12px 14px 10px; }
}

/* ---- station cards (live) ------------------------------------------ */
.stations-live { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.st { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  border-top: 4px solid var(--off); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.st.online { border-top-color: var(--ok); }
.st.offline { border-top-color: var(--bad); }
.st.inaktiv { opacity: .55; }
.st-name { grid-column: 1; font-family: var(--cond); font-weight: 700; font-size: 22px; line-height: 1.1; text-transform: uppercase; }
.st-today { grid-column: 2; grid-row: 1 / span 3; align-self: start; text-align: right; font-family: var(--cond); font-weight: 700; font-size: 44px; line-height: 1; }
.st-today small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.st-who { font-size: 15px; font-weight: 500; min-height: 22px; }
.st-who .free { color: var(--muted); font-weight: 400; }
.st-foot { grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: 12.5px; color: var(--muted); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--off); vertical-align: -1px; margin-right: 6px; }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(30,142,90,.18); }
.dot.offline { background: var(--bad); }
.status { font-weight: 600; white-space: nowrap; }
.status.online { color: var(--ok); }
.status.offline { color: var(--bad); }
.status.nie, .status.inaktiv { color: var(--off); }

.chip { display: inline-block; font-family: var(--cond); font-weight: 600; font-size: 12.5px; letter-spacing: .06em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 2px; background: var(--line-soft); color: var(--ink); white-space: nowrap; }
.chip.accent { background: var(--accent); color: #fff; }
.chip.bad { background: var(--bad); color: #fff; }
.chip.off { background: transparent; border: 1px solid var(--line); color: var(--muted); }

.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-right: 5px; vertical-align: -1px; }
.sig i { width: 3px; background: var(--line); display: block; }
.sig i:nth-child(1) { height: 5px; } .sig i:nth-child(2) { height: 8px; } .sig i:nth-child(3) { height: 12px; }
.sig.b1 i:nth-child(-n+1), .sig.b2 i:nth-child(-n+2), .sig.b3 i:nth-child(-n+3) { background: var(--ink); }
.sig.b1 i:nth-child(1) { background: var(--bad); }

/* ---- bar chart ----------------------------------------------------- */
.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 170px; align-items: end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 8px; }
.col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; }
.col .v { font-family: var(--cond); font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.col .bar { width: 100%; background: #B9C3CC; min-height: 2px; border-radius: 2px 2px 0 0; }
.col.today .bar { background: var(--accent); }
.col.today .v { color: var(--accent-dark); }
.col .d { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.col .d b { display: block; font-weight: 600; color: var(--ink); }
@media (max-width: 720px) {
  .chart { height: 140px; gap: 3px; padding: 10px 8px 6px; }
  .col .d { font-size: 9.5px; }
  .col .d span { display: none; }
  .col:nth-child(-n+7) { display: none; }
  .chart { grid-template-columns: repeat(7, 1fr); }
}

/* ---- tables -------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
.tbl th { font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  background: #F6F7F9; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.big { font-family: var(--cond); font-weight: 700; font-size: 22px; }
.tbl tr.dim td { color: var(--muted); }
.tbl td.act { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 600; background: #F6F7F9; border-top: 2px solid var(--ink); }
.tbl .sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll .tbl { min-width: 560px; }
code.tok { font: 12.5px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #F1F3F5; border: 1px solid var(--line); padding: 3px 6px; border-radius: 2px; }

/* stacked rows on phones */
@media (max-width: 640px) {
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; }
  .tbl.stack thead { display: none; }
  .tbl.stack tr { border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .tbl.stack tr:last-child { border-bottom: 0; }
  .tbl.stack td { padding: 3px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.stack td::before { content: attr(data-label); color: var(--muted); font-family: var(--cond); font-weight: 600;
    letter-spacing: .08em; text-transform: uppercase; font-size: 12.5px; text-align: left; }
  .tbl.stack td.title { display: block; text-align: left; font-family: var(--cond); font-weight: 700; font-size: 19px; padding-bottom: 4px; }
  .tbl.stack td.title::before { content: none; }
  .tbl.stack td.act { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
  .tbl.stack td.act::before { content: none; }
  .tbl.stack td.big { font-size: 19px; }
  .tbl.stack td:empty { display: none; }
  .tbl.stack td .v { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 8px; }
  .tbl.stack td .v .sub { display: inline; }
  code.tok { font-size: 11.5px; word-break: break-all; text-align: left; }
  .stat-label { font-size: 12px; }
}

/* ---- buttons + forms ----------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid var(--ink); background: var(--ink); color: #fff; text-decoration: none;
  font: 600 14px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #2B3844; }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: var(--bad); border-color: var(--line); background: transparent; }
.btn.danger:hover { border-color: var(--bad); }
.section-head.danger { border-bottom-color: var(--bad); }
.section-head.danger h2 { color: var(--bad); }
.panel.danger { border-color: var(--bad); }
.panel.danger p { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.panel.danger p a { color: var(--accent-dark); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #A82C22; border-color: #A82C22; }
.btn[disabled] { opacity: .45; cursor: default; }
form.inline { display: inline; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password] {
  font: 15px var(--font); height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; color: var(--ink); width: 100%; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { margin-bottom: 0; flex: 1 1 180px; }
.form-row .btn { height: 40px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.panel.narrow { max-width: 480px; }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .rates { grid-template-columns: 1fr; } }

/* segmented toggle */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.seg a { padding: 6px 14px; text-decoration: none; font: 600 14px var(--font); color: var(--muted); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--ink); color: #fff; }

/* ---- login --------------------------------------------------------- */
.login-body { background: var(--bar); display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { width: 100%; max-width: 360px; background: #fff; border-radius: var(--r); border-top: 5px solid var(--accent); padding: 28px; }
.login-box .brand { color: var(--ink); margin-bottom: 22px; }
.login-box .brand-sub { color: var(--muted); }
.login-err { background: #FBE9E7; color: var(--bad); border-left: 3px solid var(--bad); padding: 8px 10px; margin-bottom: 14px; font-size: 14px; }

/* ---- bottom tab bar (phones) --------------------------------------- */
.tabbar { display: none; }
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .content { padding: 18px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
  h1 { font-size: 26px; }
  .topbar-in { height: 50px; }
  .nav-desktop { display: none; }
  .nav-out { margin-left: auto; }
  .brand-sub { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--bar); border-top: 1px solid #2E3B48; z-index: 20; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; color: var(--bar-muted); font-family: var(--cond); font-weight: 600; font-size: 10.5px;
    letter-spacing: .02em; text-transform: uppercase; }
  .tabbar a.on { color: #fff; }
  .tabbar a.on .ico { background: var(--accent); }
  .section { margin-bottom: 22px; }
  .stations-live { grid-template-columns: 1fr; }
}
.ico { width: 20px; height: 20px; background: var(--bar-muted); display: block;
  -webkit-mask: var(--m) no-repeat center / contain; mask: var(--m) no-repeat center / contain; }
.ico-home    { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 11h8V3H3zm10 10h8v-8h-8zM3 21h8v-6H3zm10-10h8V3h-8z'/%3E%3C/svg%3E"); }
.ico-station { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='5'/%3E%3Cpath d='M4 14h16v3H4zm2 4h12v3H6z'/%3E%3C/svg%3E"); }
.ico-people  { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Ccircle cx='17' cy='9' r='3'/%3E%3Cpath d='M1 20c0-4 3-7 8-7s8 3 8 7zm16-6c3 0 6 2 6 5v1h-5v-1c0-2-1-4-3-5z'/%3E%3C/svg%3E"); }
.ico-chart   { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12h4v9H3zm7-8h4v17h-4zm7 5h4v12h-4z'/%3E%3C/svg%3E"); }
.ico-euro    { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 18.5A6.5 6.5 0 0 1 8.7 14H14v-2H8.3a6.5 6.5 0 0 1 0-1H14V9H8.7A6.5 6.5 0 0 1 15 4.5c1.6 0 3 .6 4.2 1.5L21 4.2A9.5 9.5 0 0 0 15 2 9.5 9.5 0 0 0 5.6 9H3v2h2.2a9.5 9.5 0 0 0 0 1H3v2h2.6A9.5 9.5 0 0 0 15 21c2.3 0 4.4-.8 6-2.2l-1.8-1.8A6.5 6.5 0 0 1 15 18.5z'/%3E%3C/svg%3E"); }

/* live-refresh indicator */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
