/* =========================================================
   منصة تقديم طلبات تنصيب العداد الذكي — apply.ecp.com.iq
   الهوية نفسها المعتمدة في ecp.com.iq (أزرق وليموني الشعار)
   ========================================================= */
:root {
  --blue-900: #0d3f63; --blue-800: #114f7c; --blue-700: #15619a; --blue-600: #1a72b3; --blue-500: #2484c1;
  --blue-200: #bcd9ee; --blue-100: #e1eff9; --blue-50: #f1f7fc;
  --lime-700: #6f8619; --lime-600: #93ad2a; --lime-500: #b3ce49; --lime-100: #eff4d8;
  --ink: #0f2233; --ink-2: #27394b; --muted: #5a6b7c; --line: #dde5ec; --line-2: #eaf0f5;
  --bg: #f5f8fb; --card: #ffffff; --danger: #b42318; --danger-bg: #fef3f2; --warn: #b54708; --warn-bg: #fffaeb;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --r-md: 12px; --r-lg: 18px;
  --shadow: 0 1px 2px rgb(15 34 51 / 0.05), 0 10px 30px -18px rgb(15 34 51 / 0.25);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.7; color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
img, svg { display: block; max-width: 100%; }
a { color: var(--blue-700); }
h1, h2 { line-height: 1.35; margin: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: 100%; max-width: 760px; margin-inline: auto; padding-inline: 16px; }
.skip { position: absolute; inset-inline-start: 1rem; top: -3rem; background: var(--blue-800); color: #fff; padding: .5rem 1rem; border-radius: 8px; z-index: 10; }
.skip:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--lime-500); outline-offset: 2px; }

/* ---------- Header / footer ---------- */
.top { background: #fff; border-bottom: 1px solid var(--line); }
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.top__brand img { height: 46px; width: auto; }
.top__link { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .95rem; color: var(--blue-700); text-decoration: none; padding: .45rem .85rem; border: 1px solid var(--blue-200); border-radius: 999px; white-space: nowrap; }
.top__link svg { width: 18px; height: 18px; }
.top__link:hover { background: var(--blue-50); }
.main { flex: 1; padding-block: 1.75rem 3rem; }
.foot { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .875rem; }
.foot__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .35rem .6rem; padding-block: 1.1rem; text-align: center; }
.foot a { margin-inline-start: .5rem; font-weight: 600; }

/* ---------- Intro ---------- */
.intro { text-align: center; margin-bottom: 1.5rem; }
.intro h1 { font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.1rem); color: var(--blue-900); }
.intro p { margin: .6rem auto 0; max-width: 56ch; color: var(--muted); }
.intro--sm h1 { font-size: 1.6rem; }

/* ---------- Steps ---------- */
.steps { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); counter-reset: s; position: relative; }
.steps__item { display: flex; flex-direction: column; align-items: center; gap: .35rem; position: relative; font-size: .85rem; color: var(--muted); text-align: center; }
.steps__item + .steps__item::before { content: ""; position: absolute; top: 17px; inset-inline-end: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.steps__item--done + .steps__item::before, .steps__item--done + .steps__item--current::before { background: var(--blue-500); }
.steps__num { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #fff; border: 2px solid var(--line); color: var(--muted); }
.steps__num svg { width: 18px; height: 18px; stroke-width: 3; }
.steps__item--current { color: var(--blue-800); font-weight: 700; }
.steps__item--current .steps__num { border-color: var(--blue-600); color: var(--blue-700); box-shadow: 0 0 0 4px var(--blue-100); }
.steps__item--done .steps__num { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }

/* ---------- Card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: clamp(1.1rem, 3vw, 1.9rem); }
.card + .card, .card + .hint-card, .hint-card + .card { margin-top: 1rem; }
.card__title { font-size: 1.25rem; color: var(--blue-900); margin-bottom: 1.1rem; }
.back { display: inline-flex; align-items: center; gap: .25rem; font-size: .9rem; font-weight: 600; text-decoration: none; margin-bottom: .75rem; color: var(--blue-700); }
.back svg { width: 16px; height: 16px; }

/* ---------- Governorates ---------- */
.govs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 560px) { .govs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.gov { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 56px; padding: .7rem .95rem; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff; color: var(--ink); font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s, transform .15s var(--ease); }
.gov svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.gov:hover { border-color: var(--blue-500); background: var(--blue-50); transform: translateY(-1px); }
.gov:hover svg { color: var(--blue-600); }

.hint-card { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.1rem; border-radius: var(--r-lg); background: var(--blue-50); border: 1px dashed var(--blue-200); color: var(--ink-2); text-decoration: none; margin-top: 1rem; }
.hint-card svg { width: 26px; height: 26px; color: var(--blue-600); flex: none; }
.hint-card strong { color: var(--blue-800); }
.hint-card:hover { background: var(--blue-100); }

/* ---------- Form ---------- */
.form { display: grid; gap: 1.05rem; }
.field { display: grid; gap: .4rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; color: var(--ink-2); padding: 0; }
.field legend { margin-bottom: .4rem; }
.input { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: .75rem .9rem; min-height: 50px; transition: border-color .15s, box-shadow .15s; }
textarea.input { resize: vertical; min-height: 90px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a6b7c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .9rem center; padding-inline-end: .9rem; padding-inline-start: 2.4rem; }
select.input:disabled { background-color: var(--line-2); color: var(--muted); }
.input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 4px var(--blue-100); }
.input--ltr { direction: ltr; text-align: right; }
.input--ltr::placeholder { text-align: right; }
.help { margin: 0; font-size: .85rem; color: var(--muted); }
.err { margin: 0; font-size: .87rem; color: var(--danger); font-weight: 500; }
.field--error .input { border-color: var(--danger); }
.field--error .input:focus { box-shadow: 0 0 0 4px var(--danger-bg); }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 560px) { .types { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.types--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.type { position: relative; cursor: pointer; }
.type input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.type__box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 88px; padding: .7rem; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff; font-weight: 600; text-align: center; transition: border-color .15s, background .15s; }
.type__box svg { width: 28px; height: 28px; color: var(--blue-600); }
.type input:checked + .type__box { border-color: var(--blue-600); background: var(--blue-50); box-shadow: 0 0 0 3px var(--blue-100); color: var(--blue-900); }
.type input:focus-visible + .type__box { outline: 3px solid var(--lime-500); outline-offset: 2px; }
.field--error .type__box { border-color: #f1b5ae; }

.area-chip { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; padding: .65rem .85rem; border-radius: var(--r-md); background: var(--blue-50); border: 1px solid var(--blue-100); color: var(--blue-900); font-weight: 600; font-size: .95rem; margin-bottom: 1.1rem; }
.area-chip svg { width: 20px; height: 20px; color: var(--blue-600); flex: none; }
.area-chip i { font-style: normal; color: var(--muted); margin-inline: .15rem; }
.area-chip a { margin-inline-start: auto; font-size: .87rem; }

.alert { padding: .8rem 1rem; border-radius: var(--r-md); margin-bottom: 1rem; font-weight: 500; }
.alert--error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecdca; }
.alert--info { background: var(--warn-bg); color: var(--warn); border: 1px solid #fedf89; }
.alert a { font-weight: 700; color: inherit; }

[hidden] { display: none !important; }
.notice { display: grid; gap: .5rem; justify-items: start; padding: 1rem 1.1rem; border-radius: var(--r-md); background: var(--warn-bg); border: 1px solid #fedf89; color: var(--ink-2); }
.notice strong { color: var(--warn); font-size: 1.05rem; }
.notice p { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 700; min-height: 50px; padding: .7rem 1.4rem; border-radius: var(--r-md); border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .15s var(--ease); }
.btn--primary { background: var(--blue-600); color: #fff; }
.btn--primary:hover { background: var(--blue-700); }
.btn--primary:disabled { background: var(--blue-200); cursor: wait; }
.btn--ghost { background: #fff; color: var(--blue-700); border-color: var(--blue-200); }
.btn--ghost:hover { background: var(--blue-50); }
.btn--sm { min-height: 38px; padding: .35rem .9rem; font-size: .9rem; }
.btn--block { width: 100%; }
.fine { margin: -.2rem 0 0; font-size: .82rem; color: var(--muted); text-align: center; }

/* ---------- Result ---------- */
.result { text-align: center; }
.result__icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 1rem; }
.result__icon svg { width: 38px; height: 38px; stroke-width: 2.6; }
.result--ok .result__icon { background: var(--lime-100); color: var(--lime-700); box-shadow: 0 0 0 8px rgb(179 206 73 / .18); }
.result--wait .result__icon { background: var(--warn-bg); color: var(--warn); box-shadow: 0 0 0 8px rgb(181 71 8 / .08); }
.result h1 { font-size: 1.5rem; color: var(--blue-900); }
.result__text { margin: .6rem auto 1.3rem; max-width: 52ch; color: var(--ink-2); }
.ref { display: grid; justify-items: center; gap: .35rem; padding: 1.1rem; border-radius: var(--r-md); background: var(--bg); border: 1px dashed var(--blue-200); }
.ref__label { font-size: .85rem; color: var(--muted); }
.ref__num { font-size: 1.6rem; letter-spacing: .04em; color: var(--blue-800); font-variant-numeric: tabular-nums; }
.ref__hint { font-size: .82rem; color: var(--muted); }
.result__area { margin: 1rem 0 0; color: var(--muted); font-size: .92rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.3rem; }

/* ---------- Tracking ---------- */
.status { text-align: center; }
.status__ref { display: block; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin-bottom: .4rem; }
.status__title { font-size: 1.45rem; padding: .35rem 1rem; border-radius: 999px; display: inline-block; background: var(--blue-100); color: var(--blue-800); }
.status--installed .status__title { background: var(--lime-100); color: var(--lime-700); }
.status--awaiting_coverage .status__title, .status--visit_scheduled .status__title { background: var(--warn-bg); color: var(--warn); }
.status--rejected .status__title { background: var(--danger-bg); color: var(--danger); }
.status__text { margin: .9rem auto 0; max-width: 50ch; color: var(--ink-2); }
.status__visit { margin: .7rem 0 0; }
.status__meta { margin: 1.2rem 0 1rem; display: grid; gap: .5rem; text-align: start; background: var(--bg); border-radius: var(--r-md); padding: .9rem 1rem; }
.status__meta div { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.status__meta dt { color: var(--muted); }
.status__meta dd { margin: 0; font-weight: 600; }

@media (max-width: 480px) {
  .foot__sep { display: none; }
  .foot__inner { flex-direction: column; gap: .15rem; }
  .top__brand img { height: 38px; }
  .steps__label { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
