/* serveris.augis.dev — iOS standalone išdėstymas pagal IOS-PWA-ISDESTYMAS.md §4 */
:root {
  --bg: #f2f4f8; --card: #ffffff; --card2: #eef1f6; --text: #111827; --muted: #6b7280; --line: #e2e6ee;
  --accent: #2563eb; --ok: #16a34a; --warn: #d97706; --crit: #dc2626; --info: #0891b2;
  --nav: #ffffffee; --shadow: 0 1px 3px rgba(0,0,0,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420; --card: #171d2b; --card2: #1f2637; --text: #e5e9f0; --muted: #8b93a5; --line: #27304a;
    --accent: #60a5fa; --ok: #34d399; --warn: #fbbf24; --crit: #f87171; --info: #22d3ee;
    --nav: #0f1420ee; --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  min-height: calc(100lvh + 1px);            /* +1px: kitaip iOS atiduoda 873 iš 932 */
  overscroll-behavior-y: none;
  background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* Rėmas sraute, 100lvh, flex stulpelis: antraštė · turinys · navigacija */
.ramas { height: 100lvh; display: flex; flex-direction: column; }
.antraste {
  flex-shrink: 0; padding: env(safe-area-inset-top) 16px 8px;
  min-height: calc(3rem + env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.antraste-eil { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.antraste-pav { font-size: 20px; font-weight: 700; }
.antraste-sub { font-size: 12px; color: var(--muted); }
.turinys { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px 12px 24px; }
.navigacija {
  flex-shrink: 0; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--nav); border-top: 1px solid var(--line); backdrop-filter: blur(12px);
}
.nav-btn {
  flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; position: relative;
}
.nav-btn .ico { font-size: 20px; line-height: 1; }
.nav-btn.aktyvus { color: var(--accent); }
.nav-btn .badge { position: absolute; top: 0; right: calc(50% - 22px); }

/* Kortelės */
.card { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.card h2 .link { text-transform: none; letter-spacing: 0; font-weight: 500; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.tap { cursor: pointer; }
.row .l { min-width: 0; flex: 1; }
.row .r { text-align: right; flex-shrink: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.link { color: var(--accent); background: none; border: 0; font: inherit; padding: 0; cursor: pointer; }

/* Būsenos taškai ir žymės */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot.online, .dot.ok { background: var(--ok); } .dot.down, .dot.crit { background: var(--crit); }
.dot.dalinai, .dot.warn { background: var(--warn); } .dot.static { background: var(--info); }
.badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 9px; font-size: 11px; font-weight: 700; text-align: center; color: #fff; background: var(--muted); }
.badge.crit { background: var(--crit); } .badge.warn { background: var(--warn); color: #1a1200; } .badge.info { background: var(--info); color: #001a1f; } .badge.ok { background: var(--ok); color: #00200f; }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-crit { color: var(--crit); } .c-info { color: var(--info); }

/* Sveikatos plytelės */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } .turinys { max-width: 900px; margin: 0 auto; width: 100%; } }
.tile { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.tile svg { position: absolute; right: 0; bottom: 0; width: 55%; height: 40%; opacity: .5; }
.tile.warn { box-shadow: inset 0 0 0 1.5px var(--warn); } .tile.crit { box-shadow: inset 0 0 0 1.5px var(--crit); }

/* Juostos (dydžiai, diskas) */
.bar { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; margin: 6px 0 2px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar > i.warn { background: var(--warn); } .bar > i.crit { background: var(--crit); }
.bars .row { flex-direction: column; align-items: stretch; gap: 2px; }
.bars .row .hd { display: flex; justify-content: space-between; font-size: 13px; }

/* Mygtukai ir formos */
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 600; background: var(--card2); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: var(--crit); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; }
.btn-icon { border: 0; background: var(--card2); color: var(--text); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.btn-icon.sukasi { animation: sukasi 1s linear infinite; }
@keyframes sukasi { to { transform: rotate(360deg); } }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; cursor: pointer; flex-shrink: 0; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch:checked { background: var(--ok); } .switch:checked::after { left: 21px; }
input[type=number], input[type=text], textarea { font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card2); color: var(--text); width: 100%; }
input[type=number] { width: 90px; text-align: right; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Problemos */
.prob { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.prob:last-child { border-bottom: 0; }
.prob .lv { width: 4px; align-self: stretch; border-radius: 2px; background: var(--muted); flex-shrink: 0; }
.prob .lv.crit { background: var(--crit); } .prob .lv.warn { background: var(--warn); } .prob .lv.info { background: var(--info); }
.prob .b { flex: 1; min-width: 0; }
.prob .b .t { font-weight: 600; } .prob .b .d { font-size: 12px; color: var(--muted); word-break: break-word; }
.prob .b .src { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.prob.ign { opacity: .55; }

/* Įvykiai / logai */
.ev { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ev:last-child { border-bottom: 0; }
.ev .ts { color: var(--muted); flex-shrink: 0; font-variant-numeric: tabular-nums; font-size: 12px; width: 78px; }
.ev .src { color: var(--accent); flex-shrink: 0; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.log { margin: 0; padding: 10px; background: #0b0f17; color: #cfd6e4; border-radius: 10px; font-size: 11px; line-height: 1.45; overflow-x: auto; white-space: pre; max-height: 60vh; }
pre.log .e { color: #f87171; }

/* Sheet (modalinis) — portale į body, virš navigacijos, prie apačios, su vidine slinktimi */
.virs-ramo { position: fixed; inset: 0; z-index: 50; }
.sheet-fonas { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; background: var(--bg); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: kyla .2s ease-out; }
@keyframes kyla { from { transform: translateY(40px); opacity: 0; } }
.sheet-rankena { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 4px; flex-shrink: 0; }
.sheet-turinys { overflow-y: auto; overscroll-behavior: contain; padding: 8px 14px calc(16px + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 6px 0 10px; font-size: 20px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 13px; padding: 4px 0; }
.kv .k { color: var(--muted); } .kv .v { word-break: break-all; }
@media (min-width: 640px) { .sheet { left: 50%; right: auto; width: 640px; transform: translateX(-50%); border-radius: 18px; bottom: 5%; max-height: 85%; } }

/* Prisijungimas */
#login { align-items: center; justify-content: center; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
.login-box { width: 100%; max-width: 320px; text-align: center; }
.login-logo { font-size: 44px; }
.login-box h1 { margin: 4px 0 0; font-size: 26px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 22px 0; height: 14px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--muted); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.pin-pad button { height: 64px; border-radius: 50%; border: 0; background: var(--card); color: var(--text); font-size: 26px; font-weight: 500; box-shadow: var(--shadow); cursor: pointer; }
.pin-pad button:active { background: var(--card2); }
.pin-pad button.gh { background: transparent; box-shadow: none; font-size: 15px; color: var(--muted); }
.btn-faceid { width: 100%; background: var(--card); color: var(--text); padding: 14px; border: 0; border-radius: 12px; font: inherit; font-weight: 600; font-size: 16px; box-shadow: var(--shadow); cursor: pointer; }
.err { color: var(--crit); min-height: 20px; font-size: 13px; margin: 10px 0 0; }

.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #111827ee; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60; max-width: 90%; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 4px 8px; }
.sec-head h2 { margin: 0; font-size: 17px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 12px; background: var(--card2); color: var(--muted); }
.chip.on { background: var(--accent); color: #fff; }
