/* KilnWatch — χρώματα πηλού & φλόγας, φωτεινό/σκούρο θέμα, πρώτα για κινητό */
:root {
  --bg: #f5efe6; --surface: #fffcf7; --surface2: #f1e9dd; --ink: #2b2420; --muted: #7b6f64; --line: #e4d9ca;
  --accent: #c2502a; --accent-d: #a8421f; --accent-ink: #fff;
  --ok: #3d7a4f; --warn: #b87500; --urgent: #c0392b; --info: #2f6a9e;
  --ok-bg: #e6f2ea; --warn-bg: #fbf0d9; --urgent-bg: #fbe4e0; --info-bg: #e3eef8;
  --c-top: #d1495b; --c-mid: #2e86ab; --c-bot: #5a9a3b; --c-avg: #2b2420; --c-prog: #8a5fc4; --c-box: #9a8a78;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .06);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f; --surface: #211c17; --surface2: #2b241e; --ink: #f1e9de; --muted: #a39688; --line: #3a3128;
    --accent: #e0693f; --accent-d: #f0825a; --accent-ink: #1a110b;
    --ok: #6cc08a; --warn: #e0a83a; --urgent: #ff7a6b; --info: #6fb0e8;
    --ok-bg: #1d2e24; --warn-bg: #33291a; --urgent-bg: #3a201d; --info-bg: #1b2a38;
    --c-top: #ff6b81; --c-mid: #4cc3ec; --c-bot: #7bc455; --c-avg: #f1e9de; --c-prog: #b794f4; --c-box: #b3a38f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.4rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; color: var(--muted); }
p { margin: .4rem 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .err { color: var(--urgent); }
.hidden { display: none; } .spacer { flex: 1; }
.hint { color: var(--muted); font-size: .88rem; margin: .4rem 0; }
.center-msg { padding: 3rem 1rem; text-align: center; color: var(--muted); }

/* ---- κέλυφος ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem;
  padding-top: calc(.6rem + env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-weight: 700; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: .8rem; }
.logo.big { width: 54px; height: 54px; font-size: 1.5rem; border-radius: 16px; }
.crumb { color: var(--muted); padding-left: .75rem; border-left: 1px solid var(--line); max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct { display: flex; align-items: center; gap: .5rem; color: var(--ink); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); display: grid; place-items: center; font-weight: 700; border: 1px solid var(--line); }
.view { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.page-head { margin-bottom: .5rem; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0 .45rem; color: var(--muted); font-size: .72rem; }
.tab:hover { text-decoration: none; }
.tab-ic { font-size: 1.15rem; line-height: 1; }
.tab.on { color: var(--accent); font-weight: 600; }
@media (min-width: 820px) {
  .tabs { position: sticky; top: 53px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); justify-content: center; gap: 1rem; padding: 0; }
  .tab { flex: 0 0 auto; flex-direction: row; gap: .5rem; padding: .7rem 1.1rem; font-size: .95rem; border-bottom: 2px solid transparent; }
  .tab.on { border-bottom-color: var(--accent); }
  .view { padding-bottom: 3rem; }
}

/* ---- κάρτες & διάταξη ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); display: block; color: var(--ink); }
a.card:hover { text-decoration: none; border-color: var(--accent); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.card-head h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.grid2.tight { gap: 1rem; }
@media (min-width: 820px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.stack { display: flex; flex-direction: column; gap: .6rem; }
.stack:empty { display: none; }
.row { display: flex; align-items: center; gap: .5rem; } .row.gap { gap: .6rem; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.list { display: flex; flex-direction: column; gap: .5rem; }
details > summary { cursor: pointer; font-weight: 600; padding: .3rem 0; }
.danger-zone { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }

/* ---- κουμπιά & φόρμες ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .5rem 1rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { background: var(--urgent); border-color: var(--urgent); color: #fff; }
.btn.danger-o { color: var(--urgent); border-color: color-mix(in srgb, var(--urgent) 40%, var(--line)); }
.btn.small { min-height: 34px; padding: .25rem .7rem; font-size: .88rem; }
.btn.icon { min-height: 36px; min-width: 36px; padding: .2rem .5rem; font-size: .9rem; }
.btn.wide { width: 100%; }
.btn.locked { opacity: .7; }
.inp, .sel, textarea.inp {
  width: 100%; min-height: 42px; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit;
}
.inp:focus, .sel:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.inp.num { width: 6.2rem; text-align: right; flex: none; }
.title-inp { font-size: 1.3rem; font-weight: 700; border-color: transparent; background: transparent; padding-left: 0; }
.title-inp:not(:disabled):hover, .title-inp:focus { border-color: var(--line); background: var(--bg); padding-left: .7rem; }
.lbl { display: block; font-size: .85rem; font-weight: 600; margin: .7rem 0 .25rem; }
.check { display: flex; align-items: center; gap: .5rem; cursor: pointer; } .check input { width: 18px; height: 18px; accent-color: var(--accent); }
.checks { display: flex; gap: 1rem; flex-wrap: wrap; margin: .6rem 0; align-items: center; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .2rem 1rem; }
.field .inp { max-width: 9rem; }
.sticky-actions { position: sticky; bottom: 70px; background: color-mix(in srgb, var(--bg) 92%, transparent); padding: .6rem 0; backdrop-filter: blur(6px); z-index: 5; }
@media (min-width: 820px) { .sticky-actions { bottom: 0; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink); padding: .4rem .9rem; font: inherit; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .6rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; }
.chip.on { color: var(--ink); border-color: var(--ink); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 2px solid transparent; flex: none; }
.sw.dashed { border-style: dashed; }
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .55rem; border-radius: 99px; background: var(--surface2); font-size: .8rem; color: var(--muted); }
.badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.live { background: var(--urgent-bg); color: var(--urgent); }
.chip-state { padding: .15rem .7rem; border-radius: 99px; font-size: .8rem; font-weight: 700; background: var(--surface2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chip-state.on { background: var(--accent); color: var(--accent-ink); }
.chip-state.cool { background: var(--info-bg); color: var(--info); }

/* ---- ζωντανά ---- */
.bigtemp { display: flex; align-items: baseline; gap: .15rem; margin: .2rem 0 .6rem; flex-wrap: wrap; }
.bigtemp-v { font-size: 3.6rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.bigtemp-u { font-size: 1.6rem; color: var(--muted); }
.bigtemp-l { margin-left: .6rem; color: var(--muted); font-size: .85rem; }
.bigtemp.small .bigtemp-v { font-size: 2.4rem; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .7rem; }
.tile { position: relative; background: var(--surface2); border-radius: 10px; padding: .55rem .7rem; }
.tile .sw { position: absolute; top: .6rem; right: .6rem; }
.tile-l { font-size: .78rem; color: var(--muted); }
.tile-v { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile.fault { background: var(--urgent-bg); } .tile.fault .tile-v { color: var(--urgent); font-size: .95rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: .6rem 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; text-align: right; }
.kv.wide { grid-template-columns: repeat(2, auto 1fr); } @media (max-width: 600px) { .kv.wide { grid-template-columns: auto 1fr; } }
.banner { padding: .65rem .9rem; border-radius: 10px; margin: .5rem 0; background: var(--info-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }
.banner.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.banner.offline { background: var(--surface2); border-color: var(--line); }
.alert { display: flex; gap: .8rem; align-items: center; padding: .8rem 1rem; border-radius: 12px; margin-bottom: .6rem; border: 1px solid; }
.alert.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.alert.warning { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.alert.urgent { background: var(--urgent-bg); border-color: var(--urgent); animation: pulse 1.4s ease-in-out infinite; }
.alert.acked { opacity: .65; animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--urgent) 30%, transparent); } }
.alert-ic { font-size: 1.6rem; } .alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 700; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.alert-sev { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.alert-meta { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
@media (max-width: 560px) { .alert { flex-wrap: wrap; } .alert .btn { width: 100%; } }

/* ---- γράφημα ---- */
.chart { position: relative; width: 100%; user-select: none; -webkit-user-select: none; }
.chart-svg { display: block; width: 100%; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .grid-v { stroke-dasharray: 2 4; opacity: .7; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .ax-text { fill: var(--muted); font-size: 11px; font-family: inherit; } .chart .ax-r { fill: var(--c-box); }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .sel { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: var(--accent); }
.chart-tip { position: absolute; z-index: 3; min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: .45rem .6rem; font-size: .82rem; pointer-events: none; }
.tip-time { color: var(--muted); margin-bottom: .2rem; }
.tip-row { display: flex; align-items: center; gap: .4rem; } .tip-row b { margin-left: auto; padding-left: .8rem; font-variant-numeric: tabular-nums; } .tip-l { color: var(--muted); }
.tip-ev { font-weight: 600; margin-bottom: .2rem; max-width: 260px; } .tip-ev.urgent { color: var(--urgent); } .tip-ev.warning { color: var(--warn); } .tip-ev.info { color: var(--info); }
.chart-reset { position: absolute; top: 4px; right: 4px; z-index: 4; font: inherit; font-size: .8rem; padding: .2rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chartcard { padding-bottom: .6rem; }

/* ---- οθόνη OLED ---- */
.oled-wrap { background: #05080c; border: 6px solid #2a2f36; border-radius: 10px; padding: 0; display: inline-block; max-width: 100%; box-shadow: inset 0 0 14px #000; }
canvas.oled { display: block; width: 384px; max-width: 100%; height: auto; aspect-ratio: 2 / 1; image-rendering: pixelated; }
.tg-list { display: flex; flex-direction: column; gap: .5rem; max-height: 320px; overflow: auto; }
.tg-msg { background: var(--surface2); border-left: 4px solid var(--info); border-radius: 8px; padding: .45rem .7rem; font-size: .9rem; }
.tg-msg.warning { border-color: var(--warn); } .tg-msg.urgent { border-color: var(--urgent); }
.tg-time { font-size: .72rem; color: var(--muted); }
.demo { border-style: dashed; border-color: var(--accent); }
.demo-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .5rem 0; }
.demo-row > b { min-width: 6.5rem; }
.demo-row .sel { width: auto; min-width: 11rem; min-height: 34px; padding: .2rem .5rem; }

/* ---- ιστορικό & προγράμματα ---- */
.filters { display: grid; grid-template-columns: 1fr; gap: .5rem; margin-bottom: .8rem; }
@media (min-width: 700px) { .filters { grid-template-columns: 2fr 1.4fr auto; align-items: center; } }
.month { margin: 1rem 0 .4rem; text-transform: capitalize; }
.fire-card { display: grid; grid-template-columns: 5.6rem 1fr auto; grid-template-areas: "d m x" "d b b"; gap: .2rem .8rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); align-items: center; }
.fire-card:hover { border-color: var(--accent); text-decoration: none; }
.fc-date { grid-area: d; display: flex; flex-direction: column; } .fc-main { grid-area: m; min-width: 0; } .fc-max { grid-area: x; text-align: right; display: flex; flex-direction: column; }
.fc-max b { font-size: 1.15rem; } .fc-badges { grid-area: b; display: flex; gap: .4rem; flex-wrap: wrap; }
.fc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-card { display: grid; grid-template-columns: 1fr auto; gap: .4rem .8rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); align-items: center; }
.prog-card.active { border-color: var(--ok); background: color-mix(in srgb, var(--ok-bg) 50%, var(--surface)); }
.pc-main { color: var(--ink); } .pc-main:hover { text-decoration: none; } .pc-title { font-weight: 700; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.pc-actions { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
.spark { display: block; background: var(--surface2); border-radius: 8px; }
.title-row { margin-bottom: .1rem; }

/* ---- επεξεργαστής ---- */
.steps { display: flex; flex-direction: column; gap: .8rem; margin-bottom: .8rem; }
.step { border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); padding: .6rem .8rem .8rem; }
.step-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .2rem; }
.step-body { display: grid; grid-template-columns: 1fr; gap: .2rem 1.2rem; } @media (min-width: 900px) { .step-body { grid-template-columns: repeat(3, 1fr); } }
.ctl-row { display: flex; align-items: center; gap: .3rem; }
.ctl-row .btn.icon { min-width: 34px; padding: .1rem .35rem; font-size: .8rem; }
.slider { flex: 1; min-width: 80px; accent-color: var(--accent); height: 32px; }
.prog-summary { display: flex; gap: 1.2rem; flex-wrap: wrap; color: var(--muted); margin-top: .4rem; }
.prog-summary b { color: var(--ink); }

/* ---- χρονολόγιο, σημειώσεις, φωτογραφίες ---- */
.timeline { display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 4.2rem 1.6rem 1fr; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.ev:last-child { border: 0; } .ev-t { display: flex; flex-direction: column; } .ev.urgent .ev-x { color: var(--urgent); font-weight: 600; } .ev.warning .ev-x { color: var(--warn); }
.note { background: var(--surface2); border-radius: 10px; padding: .5rem .7rem; margin-bottom: .5rem; }
.note-h { display: flex; gap: .6rem; align-items: baseline; } .note-h .x { margin-left: auto; } .note-t { white-space: pre-wrap; }
.x { border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 .3rem; } .x:hover { color: var(--urgent); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; margin-bottom: .6rem; }
.photos figure { margin: 0; } .photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; } .photos figcaption { font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; }
.member { display: flex; align-items: center; gap: .6rem; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.member .sel { width: auto; }
.paircode { font: 700 2rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; padding: .6rem 1rem; background: var(--surface2); border-radius: 10px; display: inline-block; margin: .6rem 0; user-select: all; }
.tcnames { display: grid; gap: .5rem; } .tcname { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; }

/* ---- σύνδεση ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.6rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1rem; }
.auth-card form { display: flex; flex-direction: column; gap: .7rem; }
.auth-logo { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .3rem; } .auth-logo h1 { margin: .4rem 0 0; }
.auth .seg { align-self: center; }

/* ---- toasts ---- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 100; display: flex; flex-direction: column; gap: .4rem; align-items: center; max-width: 92vw; }
.toast { background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; box-shadow: var(--shadow); transition: opacity .4s; }
.toast.err { background: var(--urgent); color: #fff; } .toast.out { opacity: 0; }

/* ---- πίνακες / εκτύπωση ---- */
.tbl { border-collapse: collapse; width: 100%; font-size: .9rem; margin-bottom: 1rem; } .tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: .35rem .5rem; text-align: left; }
.print-page { max-width: 820px; margin: 0 auto; padding: 1rem; background: var(--surface); }
@media print {
  @page { size: A4; margin: 12mm; }
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #555; --line: #ccc; --c-avg: #000; --c-prog: #6b3fa0; }
  body { background: #fff; color: #000; }
  .no-print, .topbar, .tabs, #toasts { display: none !important; }
  .print-page { padding: 0; max-width: none; } .photos.print-photos { grid-template-columns: repeat(3, 1fr); }
  h3, .tbl { break-after: avoid; } .tbl tr, figure { break-inside: avoid; }
}
