/* Botak — shared UI. Clean Arabic RTL, no emojis, SVG icons only. */
:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f4;
  --card: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}
.topbar .logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; }
.topbar .logo svg { width: 26px; height: 26px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; opacity: .92; }
.topbar .icon-btn { background: rgba(255,255,255,.14); color: #fff; border: none; border-radius: 10px; padding: 7px; display: inline-flex; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.25); }
.topbar .icon-btn svg { width: 19px; height: 19px; }

/* ---------- Layout ---------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 16px 14px 96px; }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h1.page-title { font-size: 20px; margin: 4px 0 14px; }
h2.section-title { font-size: 16px; margin: 20px 0 10px; color: var(--brand-dark); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .row.spread { justify-content: space-between; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 10px; text-align: center; }
.stat .num { font-size: 26px; font-weight: 700; color: var(--brand-dark); }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat svg { width: 22px; height: 22px; color: var(--brand); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge svg { width: 12px; height: 12px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: #f1f5f9; color: var(--muted); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 11px;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  background: var(--brand); color: #fff;
  transition: background .15s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: #fff; color: var(--brand-dark); border-color: var(--line); }
.btn.ghost:hover { background: #f8fafc; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Forms ---------- */
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 12px 0 5px; }
input[type="text"], input[type="password"], input[type="number"], input[type="tel"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.radio-row { display: flex; gap: 14px; margin: 6px 0; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; margin: 0; }
.help { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.7; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; padding: 9px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; box-shadow: 0 -2px 12px rgba(15,23,42,.06);
}
.bottomnav button {
  flex: 1; background: none; border: none; padding: 8px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.bottomnav button svg { width: 21px; height: 21px; }
.bottomnav button.on { color: var(--brand-dark); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, var(--brand-dark), var(--brand) 55%, #14b8a6); }
.login-card { background: #fff; border-radius: 20px; box-shadow: 0 18px 50px rgba(0,0,0,.25); width: 100%; max-width: 400px; padding: 30px 26px; }
.login-card .mark { width: 62px; height: 62px; margin: 0 auto 10px; background: var(--brand-soft); border-radius: 18px; display: flex; align-items: center; justify-content: center; color: var(--brand-dark); }
.login-card .mark svg { width: 34px; height: 34px; }
.login-card h1 { text-align: center; font-size: 22px; margin: 0 0 4px; }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 8px; }

/* ---------- Pairing code / QR ---------- */
.pair-code {
  direction: ltr; text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 4px;
  background: var(--brand-soft); color: var(--brand-dark); border-radius: 12px; padding: 14px; margin: 10px 0;
  font-family: "Courier New", monospace;
}
.qr-box { text-align: center; margin: 10px 0; }
.qr-box img { width: 240px; height: 240px; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 8px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 84px; right: 50%; transform: translateX(50%) translateY(16px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 50; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(50%) translateY(0); }
#toast.err { background: var(--danger); }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 14px; }
.empty svg { width: 38px; height: 38px; opacity: .45; display: block; margin: 0 auto 8px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; }
.back-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
details.adv { margin-top: 6px; }
details.adv summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--brand-dark); padding: 8px 0; }
.actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 560px) { .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; } .stat .num { font-size: 21px; } }
