/* Customer portal: grouped lists like iOS Settings, Persian right to left, light and dark. */

:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --fill: rgba(118, 118, 128, 0.12);
  --label: #000000;
  --secondary: rgba(60, 60, 67, 0.62);
  --separator: rgba(60, 60, 67, 0.22);
  --tint: #007aff;
  --on-tint: #ffffff;
  --green: #248a3d;
  --orange: #c93400;
  --red: #d70015;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --fill: rgba(118, 118, 128, 0.24);
    --label: #ffffff;
    --secondary: rgba(235, 235, 245, 0.62);
    --separator: rgba(84, 84, 88, 0.6);
    --tint: #0a84ff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 6px; font-weight: 700; overflow-wrap: anywhere; }
h1.ltr { font-size: 22px; text-align: right; }
h2 { font-size: 20px; margin: 28px 4px 8px; font-weight: 600; }
p { margin: 0 0 12px; }

.lead { color: var(--secondary); margin: 0 0 24px; }
.loading { color: var(--secondary); text-align: center; margin-top: 40vh; }
.brand { color: var(--secondary); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; direction: ltr; text-align: right; margin: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* Top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 4px; }
.bar .title { font-weight: 600; }

/* Grouped list */
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.card + .note, .note { color: var(--secondary); font-size: 13px; margin: 8px 16px 0; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 11px 16px;
  position: relative;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; inset-inline-start: 16px; inset-inline-end: 0;
  border-top: 0.5px solid var(--separator);
}
.row .label { color: var(--secondary); font-size: 15px; min-width: 7.5em; }
.row .value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.row .hint .badge { margin-inline-end: 4px; }
.row.stacked { flex-direction: column; align-items: stretch; gap: 2px; }
.stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stack .label { min-width: 0; font-size: 13px; }
.stack .value.ltr { text-align: right; }
.row.stacked .label { min-width: 0; }
.row .hint { color: var(--secondary); font-size: 13px; }
.row.copyable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.row.copyable:active { background: var(--fill); }
.row.copied .label { color: var(--green); }

button.row {
  width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
button.row:active { background: var(--fill); }
.chevron { color: var(--secondary); font-size: 20px; }

/* Fields */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; color: var(--secondary); font-size: 13px; margin: 0 4px 6px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 0; border-radius: 10px; background: var(--card); color: var(--label);
  font: inherit; outline: none; appearance: none; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 2px var(--tint); }
input.ltr { text-align: left; }
input.code { letter-spacing: 0.4em; text-align: center; font-size: 26px; font-variant-numeric: tabular-nums; }
textarea { min-height: 90px; resize: vertical; }

/* Buttons */
.button {
  display: block; width: 100%; min-height: 50px; margin: 16px 0 0; padding: 0 16px;
  border: 0; border-radius: var(--radius); background: var(--tint); color: var(--on-tint);
  font-family: inherit; font-size: 17px; font-weight: 600; line-height: 50px; cursor: pointer; text-align: center;
}
.button[disabled] { opacity: 0.4; cursor: default; }
a.button { text-decoration: none; }
label.field small { font-size: 11px; }
.button.secondary { background: var(--fill); color: var(--tint); }
.link { border: 0; background: none; color: var(--tint); font: inherit; padding: 10px 4px; cursor: pointer; min-height: 44px; }
.link[disabled] { color: var(--secondary); cursor: default; }
.link.danger { color: var(--red); }
.actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

.error { color: var(--red); font-size: 15px; margin: 12px 4px 0; }
.success { color: var(--green); }

/* Badges */
.badge { font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--fill); color: var(--secondary); white-space: nowrap; }
.badge.green { color: var(--green); }
.badge.blue { color: var(--tint); }
.badge.orange { color: var(--orange); }
.badge.red { color: var(--red); }

/* Steps of the identity check */
.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--fill); }
.steps span.on { background: var(--tint); }

/* Password checklist, as on Apple's own form */
.checker { background: var(--card); border-radius: 10px; padding: 10px 14px; margin: -6px 0 14px; font-size: 15px; }
.checker .head { color: var(--secondary); font-size: 13px; margin-bottom: 4px; }
.checker .req { display: flex; align-items: center; gap: 8px; color: var(--secondary); }
.checker .req.met { color: var(--label); }
.checker .dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--separator); flex: none; }
.checker .req.met .dot { background: var(--green); border-color: var(--green); position: relative; }
.checker .req.met .dot::after { content: "✓"; position: absolute; inset: 0; color: #fff; font-size: 11px; font-weight: 700; line-height: 13px; text-align: center; }
.checker .verdict { font-size: 13px; margin-top: 6px; }
.checker .strength { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--secondary); font-size: 13px; }
.checker .bars { display: flex; gap: 3px; direction: ltr; }
.checker .bars i { width: 26px; height: 5px; border-radius: 3px; background: var(--fill); }

/* Colour dots */
.colours { display: flex; flex-wrap: wrap; gap: 4px; margin: -4px 0 14px; }
.colours button {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; background: none; padding: 0; cursor: pointer;
  display: grid; place-items: center;
}
.colours button i { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px var(--separator); }
.colours button[aria-pressed="true"] { border-color: var(--tint); }

/* Camera */
.camera { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 4; }
.camera video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.camera video.playback { transform: none; }
.camera .read {
  position: absolute; inset-inline: 12px; bottom: 12px; padding: 12px 14px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 20px; font-weight: 600; text-align: center;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.camera .count {
  position: absolute; top: 12px; inset-inline-start: 12px; min-width: 44px; padding: 4px 10px; border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 700; text-align: center;
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.92); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 15px;
  max-width: calc(100% - 32px);
}

@media (prefers-reduced-motion: no-preference) {
  .card, .button { transition: opacity 0.15s ease; }
}
