/* CoreTech installer, phase 7 (canvas board "Installer"): a dark step rail on the start
 * side and the step in a full-height main area. Loaded after installer.css; the installer
 * runs before the build exists and under a strict CSP, so this file is plain CSS with the
 * kit's colour values. The step forms keep their 1.0.9 classes and logic. */
:root {
  --accent: #e11d2e;
  --accent2: #ff4d5e;
  --bg: #f4f6f9;
  --surface: #fff;
  --surface2: #fff;
  --subtle: #eef1f5;
  --text: #11141a;
  --muted: #5b6372;
  --faint: #8a93a3;
  --line: #e2e6ec;
  --line2: #d3d9e1;
  --shadow: 0 1px 2px rgba(17, 20, 26, .04), 0 8px 24px -12px rgba(17, 20, 26, .12);
  --ok: #14804a;
  --warn: #b45309;
  --danger: #c8102e;
  font-family: "Inter Variable", Inter, "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html[data-theme=dark] {
  --bg: #0e1116;
  --surface: #161b22;
  --surface2: #161b22;
  --subtle: #1c222b;
  --text: #e6ebf1;
  --muted: #9aa5b3;
  --faint: #7a8595;
  --line: #262d38;
  --line2: #323a47;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #ff6b78;
}

html[lang=ar] { font-family: "IBM Plex Sans Arabic", Inter, system-ui, sans-serif; }

.installer-body { background: var(--bg); }

/* Frame: the rail is 400px and fills the window height; the main area scrolls on its own. */
.installer-grid { display: grid; grid-template-columns: 400px minmax(0, 1fr); height: 100vh; min-height: 0; overflow: hidden; }

.installer-brand {
  position: relative; top: auto; height: 100vh; padding: 12px; overflow: visible;
  background: none; color: #f2f5f9; isolation: auto;
}
.installer-brand::before, .installer-brand:before { display: none; }

.installer-rail {
  position: relative; display: flex; flex-direction: column; gap: 18px; height: 100%;
  padding: 26px 24px 22px; overflow: hidden; border-radius: 28px;
  background: linear-gradient(135deg, #0b0e15, #120e1a); isolation: isolate;
}
.installer-rail::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(420px 300px at 90% 10%, rgba(225, 29, 46, .3), transparent 70%),
    radial-gradient(360px 260px at 0% 100%, rgba(42, 134, 209, .22), transparent 70%);
}
.installer-rail::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); mask-image: linear-gradient(180deg, #000, transparent 85%);
}

.installer-logo { display: flex; align-items: center; gap: 10px; }
.installer-logo img { width: auto; height: 26px; filter: none; object-fit: contain; }
.installer-badge { padding: 2px 6px; border: 1px solid rgba(255, 107, 120, .35); border-radius: 6px; color: #ff6b78; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; }
.installer-version { margin-inline-start: auto; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: #a9b3c1; font-size: 11.5px; }

.brand-copy { display: flex; flex-direction: column; gap: 10px; margin: 0; max-width: none; }
.installer-pill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; height: 32px; padding: 0 12px 0 4px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; background: rgba(255, 255, 255, .06); font-size: 12.5px; font-weight: 600; }
html[dir=rtl] .installer-pill { padding: 0 4px 0 12px; }
.installer-pill i { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 999px; background: linear-gradient(135deg, #ff4d5e, #e11d2e); color: #fff; font-style: normal; font-size: 12px; }
.brand-copy h1 { margin: 0; max-width: none; color: #f2f5f9; font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
html[lang=ar] .brand-copy h1 { letter-spacing: 0; line-height: 1.35; }
.brand-copy h1 span { display: block; background: linear-gradient(90deg, #ff5a68, #ff8a5b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-copy p { margin: 0; max-width: none; color: #a9b3c1; font-size: 13.5px; line-height: 1.6; }

.installer-steps { display: flex; flex: 1; flex-direction: column; min-height: 0; margin: 0 -6px; padding: 0 6px; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .12) transparent; }
.installer-step { position: relative; display: flex; flex: none; align-items: center; gap: 12px; padding: 7px 8px; border: 1px solid transparent; border-radius: 13px; color: #7f8a99; font-size: 13.5px; font-weight: 550; text-decoration: none; }
.installer-step::after { content: ""; position: absolute; inset-inline-start: 22px; top: 38px; width: 2px; height: 12px; border-radius: 2px; background: rgba(255, 255, 255, .08); }
.installer-step:last-child::after { display: none; }
.installer-step > span { flex: 1; }
.installer-step small { color: #6f7a8a; font-size: 11px; }
.installer-step i { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 9px; color: #a9b3c1; font-size: 12px; font-style: normal; font-weight: 700; }
.installer-step.done { color: #c9d1db; }
.installer-step.done:hover { background: rgba(255, 255, 255, .05); }
.installer-step.done i { border-color: rgba(52, 211, 153, .3); background: rgba(52, 211, 153, .14); color: #34d399; }
.installer-step.done::after { background: rgba(52, 211, 153, .35); }
.installer-step.on { border-color: rgba(255, 77, 94, .35); background: linear-gradient(135deg, rgba(255, 77, 94, .22), rgba(225, 29, 46, .12)); color: #fff; }
.installer-step.on i { border-color: transparent; background: linear-gradient(135deg, #ff4d5e, #e11d2e); box-shadow: 0 8px 18px -8px rgba(225, 29, 46, .8); color: #fff; }
.installer-step.on small { color: #ffb3ba; }

.brand-facts { gap: 6px; margin: 0; }
.brand-facts span { padding: 4px 10px; border-color: rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06); color: #a9b3c1; font-size: 12px; }
.installer-orbit { display: none; }

/* Main area: header, progress track, status snapshots, then the step. */
.installer-main { display: flex; flex-direction: column; gap: 16px; height: 100vh; max-width: none; margin: 0; padding: 22px 32px 28px 20px; overflow: auto; }
html[dir=rtl] .installer-main { padding: 22px 20px 28px 32px; }
.installer-top { min-height: 0; }
.step-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.step-kicker::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent2); }
html[lang=ar] .step-kicker { letter-spacing: 0; }
.installer-top h2 { margin: 2px 0 0; font-size: 26px; font-weight: 790; letter-spacing: -.025em; }
.installer-tools { gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--subtle); }
.icon-tool { width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12.5px; }
.icon-tool:hover { transform: none; background: var(--surface); color: var(--text); }

.progress-track { height: 6px; margin: 0; border-radius: 6px; background: var(--line); }
.progress-track span { border-radius: 6px; background: linear-gradient(90deg, #ff4d5e, #e11d2e); }

.installer-statusbar { gap: 10px; margin: 0; }
.status-snapshot { gap: 10px; padding: 8px 14px 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.status-snapshot b { font-size: 12.5px; }
.status-snapshot small { color: var(--muted); font-size: 11.5px; }

.installer-panel { flex: 1 0 auto; max-width: none; margin: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.installer-footer { max-width: none; margin: 0; }

/* The step itself: kit sizes for headings, fields, buttons and rows. */
.installer-statusbar { padding: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none; }
.installer-panel { padding: 20px 22px; }
.installer-panel .eyebrow { margin-bottom: 4px; color: var(--accent); font-size: 11.5px; letter-spacing: .08em; }
html[lang=ar] .installer-panel .eyebrow { letter-spacing: 0; }
.section-heading { gap: 16px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.section-heading h3 { margin: 0 0 4px; font-size: 22px; font-weight: 780; letter-spacing: -.02em; }
html[lang=ar] .section-heading h3 { letter-spacing: 0; }
.section-heading p { font-size: 13.5px; line-height: 1.55; }
.form-stack { gap: 16px; }
.field-grid { align-items: start; gap: 14px 16px; }
.field-grid label, .form-stack > label { align-content: start; gap: 7px; }
.field-grid label > span, .form-stack > label > span { color: var(--text); font-size: 13px; font-weight: 600; }
.field-grid input, .field-grid select, .form-stack input, .form-stack select { min-height: 46px; border-radius: 12px; font-size: 14px; }
.field-grid input:focus, .field-grid select:focus, .form-stack input:focus, .form-stack select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(225, 29, 46, .12); }
.field-grid small, .form-stack small { font-size: 12px; }
.button { min-height: 42px; padding: 0 16px; border-radius: 12px; font-size: 13.5px; font-weight: 650; }
.button.primary, html[data-theme=dark] .button.primary { border-color: transparent; background: linear-gradient(135deg, #ff4d5e, #e11d2e); box-shadow: 0 10px 24px -10px rgba(225, 29, 46, .7); color: #fff; }
.button.secondary { background: var(--surface); }
.requirements-list { gap: 8px; }
.requirement-row { padding: 10px 14px; border-radius: 14px; }
.requirement-row:hover { transform: none; background: var(--subtle); }

/* Tablets: a narrower rail. Phones: the rail stacks above the step. */
@media (max-width: 1100px) {
  .installer-grid { grid-template-columns: 320px minmax(0, 1fr); }
  .installer-main { padding-inline: 16px 20px; }
}

@media (max-width: 760px) {
  .installer-grid { grid-template-columns: minmax(0, 1fr); height: auto; overflow: visible; }
  .installer-brand, .installer-main { height: auto; }
  .installer-brand { padding: 10px 10px 0; }
  .installer-rail { padding: 22px 18px; border-radius: 24px; }
  .installer-steps { flex: none; flex-direction: row; gap: 6px; margin: 0; padding-bottom: 4px; overflow-x: auto; }
  .installer-step { padding: 6px 10px 6px 6px; }
  .installer-step::after, .installer-step small { display: none; }
  .installer-step:not(.on) > span { display: none; }
  .installer-main, html[dir=rtl] .installer-main { padding: 16px 10px 24px; }
  .installer-statusbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .status-refresh { grid-column: span 2; justify-content: center; }
}

/* Fields line up in a row: each takes three rows (label, box, foot) shared with its
   neighbours, so hints and error lines never push the box beside them. */
.field-grid > label:not(.full) { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 7px; }
.field-grid > label > .field-foot { grid-row: 3; }
.field-grid > label.full { display: grid; gap: 7px; }
.field-foot { display: grid; gap: 4px; min-width: 0; }
.field-foot:not(:has(> :not([hidden]))) { display: none; }
.field-foot small { margin: 0; color: var(--muted); line-height: 1.5; }
.is-invalid > .field-foot small { display: none; }
.field-error { display: flex; align-items: flex-start; gap: 6px; color: var(--danger); font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.field-error[hidden] { display: none; }
.field-error b { display: grid; flex: none; place-items: center; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: var(--danger); color: var(--surface); font-size: 11px; line-height: 1; }
@media (prefers-reduced-motion: no-preference) { .field-error.is-new { animation: installer-shake .36s cubic-bezier(.36,.07,.19,.97); } }
@keyframes installer-shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }
.is-invalid input, .is-invalid .dd-trigger, .is-invalid .password-field input { border-color: var(--danger); }
.choice-card.is-invalid, .approval-card.is-invalid { border-color: var(--danger); }
@media (max-width: 640px) { .field-grid > label:not(.full) { grid-row: auto; grid-template-rows: none; } }

/* Password rules: four-part meter with its level, then the rules (required ones tagged). */
.pass-rules { --tone: var(--line2); grid-column: 1 / -1; display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--subtle); }
.pass-rules[data-level="1"] { --tone: var(--danger); }
.pass-rules[data-level="2"] { --tone: var(--warn); }
.pass-rules[data-level="3"] { --tone: #2563eb; }
.pass-rules[data-level="4"] { --tone: var(--ok); }
.pass-head { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12.5px; font-weight: 650; }
.pass-head b { color: var(--tone); }
.pass-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pass-meter i { height: 5px; border-radius: 99px; background: var(--line); transition: background-color .25s; }
.pass-rules[data-level="1"] .pass-meter i:nth-child(-n+1), .pass-rules[data-level="2"] .pass-meter i:nth-child(-n+2), .pass-rules[data-level="3"] .pass-meter i:nth-child(-n+3), .pass-rules[data-level="4"] .pass-meter i { background: var(--tone); }
.pass-rules ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px 16px; margin: 0; padding: 0; list-style: none; }
.pass-rules li { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; }
.pass-rules li > i { position: relative; flex: none; width: 18px; height: 18px; border: 1.5px solid var(--line2); border-radius: 50%; transition: background-color .2s, border-color .2s, transform .3s cubic-bezier(.34,1.56,.64,1); }
.pass-rules li > i::after { content: ""; position: absolute; inset: 3px 5px 5px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .2s; }
.pass-rules li.is-met > i { border-color: var(--ok); background: var(--ok); transform: scale(1.08); }
.pass-rules li.is-met > i::after { transform: rotate(45deg) scale(1); }
.pass-rules li > span { flex: 1; min-width: 0; }
.pass-rules li.is-met > span { color: var(--text); }
.pass-rules em { flex: none; padding: 1px 7px; border-radius: 99px; background: var(--surface); font-size: 11px; font-style: normal; font-weight: 650; }
.pass-rules em.req { background: rgba(225, 29, 46, .1); color: var(--danger); }
.pass-rules li.is-met em.req { background: rgba(20, 128, 74, .12); color: var(--ok); }

/* Dropdown (the native select stays in the form, hidden). */
.dd { position: relative; display: block; min-width: 0; }
.dd > select { position: absolute; inset-block-end: 0; inset-inline-start: 0; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.dd-trigger { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; text-align: start; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.dd-trigger:hover { border-color: var(--line2); }
.dd-trigger:focus-visible, .dd.is-open .dd-trigger { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(225, 29, 46, .12); }
.dd-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-trigger svg, .dd-panel svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dd-trigger svg { color: var(--muted); transition: transform .2s; }
.dd.is-open .dd-trigger svg { transform: rotate(180deg); }
.dd-panel { position: fixed; inset-block: var(--dd-y, auto) var(--dd-b, auto); inset-inline-start: var(--dd-x, 0); z-index: 100; display: flex; flex-direction: column; width: var(--dd-w, 240px); max-height: var(--dd-max, 320px); padding: 5px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow), 0 24px 60px -24px rgba(17, 20, 26, .3); opacity: 0; transform-origin: top center; }
.dd-panel[data-side=top] { transform-origin: bottom center; }
.dd-panel.is-open { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .dd-panel.is-open { animation: dd-in .17s cubic-bezier(.22,1,.36,1) both; }
  .dd-panel[data-side=top].is-open { animation-name: dd-in-up; }
  .dd-panel:not(.is-open) { transition: opacity .12s; }
  .dd-panel li[aria-selected=true] > svg { animation: dd-tick .28s cubic-bezier(.34,1.56,.64,1); }
}
@keyframes dd-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes dd-in-up { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes dd-tick { from { opacity: 0; transform: scale(.4); } }
.dd-search { display: flex; flex: none; align-items: center; gap: 8px; margin-bottom: 4px; padding: 0 10px; border-radius: 10px; background: var(--subtle); color: var(--muted); }
.dd-search input { flex: 1; min-width: 0; height: 36px; min-height: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; box-shadow: none; }
.dd-search input:focus { border: 0; box-shadow: none; }
.dd-search:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
.dd-panel ul { flex: 1; min-height: 0; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; outline: 0; list-style: none; }
.dd-panel li { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 10px; border-radius: 9px; color: var(--text); font-size: 13.5px; font-weight: 550; cursor: pointer; }
.dd-panel li[hidden] { display: none; }
@media (pointer: coarse) { .dd-panel li { min-height: 44px; } }
.dd-panel li > i { flex: none; width: 8px; height: 8px; border: 1.5px solid var(--line2); border-radius: 50%; transition: background-color .15s, border-color .15s, transform .25s; }
.dd-panel li > span { flex: 1; min-width: 0; }
.dd-panel li > svg { opacity: 0; }
.dd-panel li.is-active { background: var(--subtle); }
.dd-panel li.is-active > i, .dd-panel li[aria-selected=true] > i { border-color: var(--accent); background: var(--accent); transform: scale(1.15); }
.dd-panel li[aria-selected=true] { background: rgba(225, 29, 46, .08); color: var(--accent); font-weight: 650; }
.dd-panel li[aria-selected=true] > svg { opacity: 1; }
.dd-empty { margin: 0; padding: 14px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.dd-empty[hidden] { display: none; }
