/* BabCard — owner pages (dashboard, forms, account).
   Arabic-first: layout uses logical properties (inline-start/end),
   so an English LTR version only needs <html dir="ltr">. */

:root {
  --green: #0B6E4F;
  --green-dark: #08543C;
  --green-tint: #E3F2EC;
  --green-soft: #EEF8F3;
  --green-line: #B9DCCB;
  --ink: #13201C;
  --ink-2: #33433E;
  --muted: #4B5A55;
  --line: #D5DDD9;
  --line-2: #E1E7E4;
  --border-strong: #7C8B86;
  --bg: #F7F9F8;
  --surface: #FFFFFF;
  --surface-2: #F3F6F5;
  --amber-bg: #FFF3D6;
  --amber-ink: #6B4700;
  --amber-line: #B26B00;
  --danger: #B42318;
  --danger-bg: #FDECEA;
  --info-bg: #E8EEF9;
  --info-ink: #1D3F8A;
  --focus: #1A56DB;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .9em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}
.skip-link {
  position: absolute; inset-inline-start: 8px; top: -100px; z-index: 10;
  padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 8px; color: #fff; }

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; padding: 8px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line-2);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  color: var(--ink); text-decoration: none; font-size: 1.125rem; font-weight: 700;
}
.brand svg { color: var(--green); }
.topbar-end { display: flex; align-items: center; gap: 8px; }
.lang-switch {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  border-radius: 999px; color: var(--ink); font-weight: 600; text-decoration: none;
}
.lang-switch:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.page { width: 100%; max-width: 560px; margin-inline: auto; padding: 20px 16px 32px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.site-footer { padding: 24px 16px 32px; text-align: center; color: var(--muted); font-size: .875rem; }
.site-footer p { margin: 0; }

/* Type */
h1 { margin: 0 0 8px; font-size: 1.5rem; line-height: 1.35; }
h2 { margin: 0 0 10px; font-size: 1.125rem; line-height: 1.4; }
.lead { margin: 0 0 20px; font-size: 1.0625rem; color: var(--ink-2); }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* Buttons: at least 48px tall for easy tapping */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn-outline { border: 2px solid var(--green); color: var(--green); font-weight: 700; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-block { width: 100%; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; }
.input {
  width: 100%; min-height: 52px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1rem;
}
textarea.input { min-height: 96px; line-height: 1.6; resize: vertical; }
.input[dir="ltr"] { text-align: left; }
.input[aria-invalid="true"] { border: 2px solid var(--danger); }
.hint { display: block; margin: 0; font-size: .875rem; color: var(--muted); }
.error-text { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: .875rem; font-weight: 600; color: var(--danger); }
.error-text svg { flex: none; margin-top: 3px; }
.password-wrap { display: flex; gap: 8px; }
.password-wrap .input { flex: 1; min-width: 0; }
.pw-toggle {
  flex: none; min-width: 72px; min-height: 52px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
}
.pw-toggle:hover { background: var(--surface-2); }
.check-row { display: flex; align-items: flex-start; gap: 12px; font-weight: 600; cursor: pointer; }
.check-row input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--danger); }
.text-link {
  display: inline-flex; align-self: center; align-items: center; min-height: 44px;
  padding: 0 8px; font-weight: 600;
}
.form-alt { margin: 16px 0 0; text-align: center; }
.form-alt a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.form-note { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0; color: var(--muted); font-size: .875rem; }
.form-note svg { flex: none; margin-top: 2px; }

/* Account */
.label-title { margin: 0; font-size: .875rem; font-weight: 600; color: var(--muted); }
.account-email { margin: 2px 0 0; font-size: 1.0625rem; font-weight: 700; overflow-wrap: anywhere; text-align: start; }
.danger-zone { border-color: #F1B9B3; }

/* Messages */
.alert { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.alert-success { background: var(--green-tint); color: var(--green-dark); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--amber-bg); color: var(--amber-ink); }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 999px; font-size: .75rem; font-weight: 700;
}

/* Setup check */
.checklist { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.check-state { flex: none; min-width: 52px; padding: 2px 6px; border-radius: 6px; font-size: .75rem; font-weight: 700; text-align: center; }
.check-body { display: flex; flex-direction: column; }
.check-pass .check-state { background: var(--green-tint); color: var(--green-dark); }
.check-warn .check-state { background: var(--amber-bg); color: var(--amber-ink); }
.check-fail .check-state { background: var(--danger-bg); color: var(--danger); }

/* Copy feedback (any element with data-copy) */
.when-copied { display: none; }
.is-copied .when-idle { display: none; }
.is-copied .when-copied { display: inline-flex; }
.when-idle, .when-copied { align-items: center; gap: 8px; }
.when-idle { display: inline-flex; }

/* Badges */
.badge-on { background: var(--green-tint); color: var(--green-dark); }
.badge-off { background: var(--surface); color: var(--muted); border: 1px solid var(--border-strong); }
.badge-warn { background: var(--amber-bg); color: var(--amber-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }

/* Dashboard tiles */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; min-height: 200px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.tile-main, .tile-add {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%;
  padding: 14px; border: 0; background: transparent; color: var(--ink);
  font: inherit; text-align: start; text-decoration: none; cursor: pointer;
}
.tile-main:hover, .tile-add:hover { background: var(--surface-2); color: var(--ink); }
.tile-idle { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; }
.tile-top { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-bottom: 6px; }
.tile-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 12px; background: var(--green-tint); color: var(--green);
}
.tile-name { font-size: 1.125rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.tile-opens { display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; color: var(--muted); }
.tile-cta { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 6px; font-size: .875rem; font-weight: 600; color: var(--green-dark); }
.tile-done { display: none; }
.tile-copy.is-copied { background: var(--green); color: #fff; }
.tile-copy.is-copied .tile-idle { display: none; }
.tile-copy.is-copied .tile-done {
  display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; text-align: center;
}
.tile-copy.is-copied .tile-cta { color: #fff; margin-top: 0; padding-top: 0; }
.tile-actions { display: flex; border-top: 1px solid var(--line-2); }
.tile-action {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px;
  border: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: .875rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.tile-action + .tile-action { border-inline-start: 1px solid var(--line-2); }
.tile-action:hover { background: var(--surface-2); color: var(--ink); }
.tile-action:first-child { color: var(--green-dark); }
.tile-action.is-copied { background: var(--green); color: #fff; }
.tile-off { background: var(--surface-2); }
.tile-off .tile-icon { background: var(--line-2); color: var(--muted); }
.tile-off .tile-cta { color: var(--muted); }
.tile-empty { border: 2px dashed var(--border-strong); }
.tile-add { align-items: center; justify-content: center; text-align: center; }
.tile-add .tile-icon { border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tile-add .tile-cta { margin-top: 4px; color: var(--green-dark); font-size: .9375rem; font-weight: 700; }
.links-today { margin: 16px 0; text-align: center; color: var(--muted); font-size: .875rem; }
.add-home-hint { display: flex; align-items: flex-start; gap: 10px; margin: 0; font-size: .875rem; color: var(--ink-2); }
.add-home-hint svg { flex: none; margin-top: 2px; color: var(--green); }

/* Edit place */
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin-bottom: 4px; color: var(--ink); font-weight: 600; text-decoration: none; }
[dir="ltr"] .icon-back { transform: scaleX(-1); }
.place-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.link-box {
  margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2);
  font-family: var(--mono); font-size: .875rem; text-align: left; overflow-wrap: anywhere;
}
.opens { display: flex; flex-direction: column; gap: 2px; }
.opens-main { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.opens-last { font-weight: 400; color: var(--muted); }
.opens .hint { margin: 0; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.row-wrap .btn { flex: 1 1 140px; }
.btn-outline.is-copied { background: var(--green); color: #fff; }
.btn-lg { min-height: 56px; font-size: 1.0625rem; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px;
  padding: 0 4px; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.switch { display: inline-flex; align-items: center; width: 52px; height: 30px; padding: 3px; border-radius: 999px; background: var(--surface); border: 2px solid var(--border-strong); }
.switch-knob { width: 20px; height: 20px; border-radius: 999px; background: var(--border-strong); }
.switch-row[aria-checked="true"] .switch { justify-content: flex-end; background: var(--green); border-color: var(--green); }
.switch-row[aria-checked="true"] .switch-knob { background: #fff; }
.more { border-top: 1px solid var(--line-2); padding-top: 4px; }
.more summary {
  display: flex; align-items: center; gap: 8px; min-height: 48px; cursor: pointer;
  font-weight: 600; color: var(--ink-2); list-style: none;
}
.more summary::-webkit-details-marker { display: none; }
.more[open] summary { margin-bottom: 8px; }
.more-danger { margin-top: 24px; padding: 4px 16px 16px; border: 1px solid #F1B9B3; border-radius: var(--radius); background: var(--surface); }
.more-danger summary { color: var(--danger); }
.note-box { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: .875rem; line-height: 1.6; }
.note-warning { background: var(--amber-bg); color: var(--amber-ink); }
.field label { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.input-code { font-family: var(--mono); font-size: 1.375rem; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; }
.input.is-changed { border: 2px solid var(--amber-line); }
.input-muted { background: var(--bg); }
.counter { text-align: end; }
.confirm-panel {
  display: flex; flex-direction: column; gap: 12px; padding: 20px 16px;
  border: 2px solid var(--amber-line); border-radius: var(--radius); background: var(--surface);
}
.confirm-panel h2 { margin: 0; font-size: 1.25rem; }
.confirm-panel p { margin: 0; }
.confirm-icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-ink); }

/* Photo field */
.photo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-thumb { width: 112px; height: 84px; object-fit: cover; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.input-file {
  width: 100%; min-height: 52px; padding: 8px; border: 1px dashed var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: .9375rem;
}
.input-file::file-selector-button {
  min-height: 40px; margin-inline-end: 10px; padding: 0 14px; border: 2px solid var(--green); border-radius: 10px;
  background: var(--surface); color: var(--green); font: inherit; font-weight: 700; cursor: pointer;
}
.input-file[aria-invalid="true"] { border: 2px solid var(--danger); }
.check-row-quiet { font-weight: 600; color: var(--danger); }
.check-row-quiet input { accent-color: var(--danger); }

@media (min-width: 480px) {
  .actions { flex-direction: row; }
  .actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Maintenance warning bar (admin only, while maintenance is on) ---------- */
.maint-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 16px;
  padding: 10px 16px; background: #FFF3D6; color: #6B4700; border-bottom: 2px solid #B26B00;
  font-size: .9375rem; font-weight: 600; line-height: 1.5; text-align: center; }
.maint-bar a { color: #6B4700; font-weight: 700; text-decoration: underline; min-height: 32px; display: inline-flex; align-items: center; }
.maint-bar a:hover { color: #13201C; }
