:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #15202b;
  --muted: #5b6673;
  --line: #d9dee5;
  --brand: #0f3d5e;
  --brand-ink: #ffffff;
  --accent: #1aa38a;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --ok: #0f7b4f;
  --ok-bg: #e6f4ee;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
html[dir="rtl"] body { font-size: 17px; }
a { color: var(--brand); }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }

.hero {
  background: linear-gradient(160deg, #0f3d5e 0%, #16567f 60%, #1aa38a 140%);
  color: var(--brand-ink);
  padding: 20px 0 32px;
}
.hero .wrap { padding-bottom: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.brand { font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; font-size: 15px; }
.brand span { opacity: 0.75; font-weight: 500; letter-spacing: 0.02em; text-transform: none; font-size: 13px; display: block; }
.lang a {
  color: var(--brand-ink); text-decoration: none; border: 1px solid rgba(255,255,255,0.5);
  padding: 6px 12px; border-radius: 999px; font-size: 14px; white-space: nowrap;
}
.lang a:hover { background: rgba(255,255,255,0.12); }
.hero h1 { font-size: 26px; line-height: 1.25; margin: 0 0 10px; font-weight: 800; }
.hero .subtitle { margin: 0 0 14px; font-weight: 600; opacity: 0.95; }
.hero .lead { margin: 0; opacity: 0.92; max-width: 60ch; }
@media (min-width: 600px) { .hero h1 { font-size: 32px; } }

.details {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: -18px 0 20px; padding: 0;
}
.details > div {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.details dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 2px; }
html[dir="rtl"] .details dt { letter-spacing: 0; font-size: 13px; }
.details dd { margin: 0; font-weight: 600; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
@media (min-width: 600px) { .card { padding: 28px; } }
.card h2 { margin: 0 0 16px; font-size: 22px; }

form label, form fieldset { display: block; margin: 0 0 14px; }
form fieldset { border: 0; padding: 0; min-width: 0; }
form legend, form label > .lbl { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; padding: 0; }
form .opt { color: var(--muted); font-weight: 400; }
input[type="text"], input[type="tel"], input[type="email"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  min-height: 46px;
}
html[dir="rtl"] input[dir="ltr"] { text-align: left; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.invalid input, .invalid select { border-color: var(--danger); }
small.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.err { display: block; color: var(--danger); font-size: 13px; margin-top: 4px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.modes { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 520px) { .modes { grid-template-columns: 1fr 1fr; } }
.mode {
  display: flex; gap: 12px; align-items: flex-start; margin: 0 !important;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; background: #fff;
}
.mode input { margin: 4px 0 0; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--brand); }
.mode .ttl { font-weight: 700; display: block; }
.mode .sub { color: var(--muted); font-size: 14px; display: block; }
.mode:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(15,61,94,0.15); }
.mode.disabled { opacity: 0.55; cursor: not-allowed; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--danger-bg); color: var(--danger); margin-inline-start: 6px; vertical-align: middle; }

.alert { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; font-weight: 600; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }

button, .btn {
  display: inline-block; width: 100%; font: inherit; font-weight: 700; font-size: 17px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px;
  padding: 14px 20px; cursor: pointer; text-align: center; text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(0.95); }
button[disabled] { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn.secondary { background: var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.privacy { color: var(--muted); font-size: 13px; margin: 12px 0 0; text-align: center; }
/* Visually hidden without an off-screen offset: a negative `left` becomes scrollable overflow in RTL. */
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

.success { text-align: center; padding: 32px 16px; }
.success .check {
  width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--ok);
  display: inline-flex; align-items: center; justify-content: center; font-size: 34px; margin-bottom: 12px;
}
.success h2 { margin: 0 0 10px; }
.success p { margin: 0 0 10px; max-width: 48ch; margin-inline: auto; }
.success .btn { width: auto; margin-top: 16px; }

footer { color: var(--muted); font-size: 13px; text-align: center; margin-top: 28px; }

/* Admin */
.admin .wrap { max-width: 1240px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 26px; }
.stat b small { font-size: 14px; font-weight: 500; }
.stat span { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.toolbar form { margin: 0; }
.toolbar .btn, .toolbar button { width: auto; font-size: 15px; padding: 10px 14px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; white-space: nowrap; }
td.wrap-text { white-space: normal; max-width: 260px; }
th { background: #f7f9fb; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.onsite { background: #e8f0f7; color: var(--brand); }
.pill.online { background: var(--ok-bg); color: var(--ok); }
.muted { color: var(--muted); }
.row-actions form { display: inline; }
.row-actions button { width: auto; font-size: 13px; padding: 4px 8px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.row-actions button.danger { color: var(--danger); }
.zoombox { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 12px 0; }
.zoombox code { background: #f3f5f8; padding: 2px 6px; border-radius: 4px; }
