/* Colours from the Android app (res/values/colors.xml) */
:root {
  --primary: #176B5B; --primary-dark: #003F36; --accent: #D99A2B; --bg: #F5F7F6; --card: #FFFFFF;
  --text: #14201D; --muted: #3F4B47; --soft: #E4F4EF; --border: #E1E7E4; --danger: #C94B4B;
  --success: #2D8A64; --warning: #BE7814;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: -apple-system, "SF Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif; font-size: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

header#top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) 14px 8px; background: var(--card); border-bottom: 1px solid var(--border); }
.toplogo { width: 54px; height: 36px; object-fit: contain; }
.toptxt { flex: 1; min-width: 0; }
.bname { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin-top: 2px; }
.pill.ok { background: var(--soft); color: var(--success); }
.pill.bad { background: #FBEAEA; color: var(--danger); }
.pill.wait { background: #FFF4E0; color: var(--warning); }
.iconbtn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--soft);
  color: var(--primary); font-size: 22px; font-weight: 700; }
.iconbtn.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }

.ptr { text-align: center; font-size: 13px; color: var(--muted); height: 0; overflow: hidden; transition: height .15s; }
.ptr.show { height: 34px; padding-top: 8px; }

main { padding: 12px 12px calc(92px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
h2 { font-size: 20px; margin: 6px 4px 10px; }
h3 { font-size: 17px; margin: 0 0 6px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card.alarm { border-color: var(--danger); background: #FFF6F6; }
.card.warn { border-color: var(--accent); background: #FFFBF2; }
.card.pending { border: 2px solid var(--warning); }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.muted { color: var(--muted); font-size: 13.5px; }
.small { font-size: 12.5px; }
.big { font-size: 30px; font-weight: 800; }
.ok { color: var(--success); } .bad { color: var(--danger); } .warnc { color: var(--warning); }
.state { font-weight: 700; font-size: 14px; white-space: nowrap; }

.btn { display: block; width: 100%; min-height: 46px; border-radius: 14px; border: 1px solid var(--border); background: var(--card);
  color: var(--primary); font-weight: 700; padding: 8px 10px; margin-top: 8px; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.on { background: var(--soft); border-color: var(--primary); }
.btn.danger { color: var(--danger); border-color: #F0CFCF; }
.btn:disabled { opacity: .5; }
.btn:active { transform: scale(.98); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cell { background: var(--bg); border-radius: 14px; padding: 8px 6px; text-align: center; }
.cell b { display: block; font-size: 18px; }
.cell span { font-size: 12px; color: var(--muted); }
.cell.off { opacity: .45; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; direction: ltr; text-align: right; }

nav#tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 10; display: flex; overflow-x: auto; gap: 2px;
  background: var(--card); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + var(--safe-b)); scrollbar-width: none; }
nav#tabs::-webkit-scrollbar { display: none; }
nav#tabs button { flex: 1 0 auto; min-width: 64px; border: 0; background: none; border-radius: 12px; padding: 6px 8px;
  color: var(--muted); font-size: 12px; font-weight: 700; }
nav#tabs button i { display: block; font-style: normal; font-size: 20px; }
nav#tabs button.sel { background: var(--soft); color: var(--primary); }

label.f { display: block; font-size: 13.5px; color: var(--muted); margin: 10px 2px 4px; }
input.in, select.in { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px;
  background: #fff; font-size: 17px; color: var(--text); }
input.ltr { direction: ltr; text-align: left; letter-spacing: 1px; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b)); }
.sheet h3 { font-size: 19px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet .actions .btn { margin-top: 0; }
.choice { display: block; width: 100%; text-align: right; border: 1px solid var(--border); background: #fff; border-radius: 14px;
  padding: 10px 14px; margin-top: 8px; font-weight: 700; color: var(--text); }
.choice small { display: block; font-weight: 400; color: var(--muted); }
.choice.sel { border-color: var(--primary); background: var(--soft); }

.toast { position: fixed; z-index: 60; inset-inline: 16px; bottom: calc(88px + var(--safe-b)); background: #14201DEE; color: #fff;
  padding: 12px 16px; border-radius: 14px; text-align: center; font-weight: 600; }

.login { max-width: 460px; margin: 0 auto; padding-top: calc(16px + var(--safe-t)); }
.login .logo { display: block; width: 220px; margin: 8px auto 4px; }
.install ol { padding-inline-start: 22px; margin: 6px 0; }
.install li { margin: 4px 0; }
.share { display: inline-block; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; background: #fff; }

.tank { display: flex; gap: 14px; align-items: stretch; }
.tank svg { width: 120px; height: 220px; flex: none; }
.ladder { flex: 1; display: flex; flex-direction: column-reverse; justify-content: space-between; font-size: 13px; }
.ladder div { padding: 2px 8px; border-radius: 8px; }
.ladder .cur { background: var(--soft); color: var(--primary); font-weight: 800; }
.phone { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.phone:last-child { border-bottom: 0; }
.phone .btn { width: auto; margin: 0; min-height: 38px; padding: 4px 12px; }
label.chk { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 6px; border-bottom: 1px solid var(--border); font-weight: 600; }
label.chk input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.tgt { font-size: 24px; color: var(--primary); }
.devgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dev { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 96px; padding: 8px 4px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--card); color: var(--text); text-align: center; }
.dev.on { background: var(--soft); border-color: var(--primary); }
.dev i { font-style: normal; font-size: 22px; }
.dev b { font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev span { font-size: 12px; font-weight: 700; } .dev small { font-size: 11px; color: var(--muted); }
.tank.home svg { width: 104px; height: 190px; }
.lvl { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; text-align: center; }
.lvltxt { font-size: 20px; font-weight: 800; } .blue { color: #1E88E5; }
