/* 4SO GeoDNS enterprise product UX layer.
 * Phase 10: true RTL/LTR shell, human-first operational language and reusable
 * product components. Technical identifiers remain isolated and LTR.
 */
:root {
  --sidebar: 286px;
  --font-fa: "Vazirmatn", "Noto Sans Arabic", "Noto Sans Arabic UI", Tahoma, Arial, sans-serif;
  --font-en: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  --font-code: "DejaVu Sans Mono", Consolas, "Liberation Mono", monospace;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #162033;
  --ink-soft: #526176;
  --line: #dfe6ef;
  --primary: #155eef;
  --primary-strong: #0f45bd;
  --primary-soft: #edf4ff;
  --success: #087a55;
  --success-soft: #e5f7ef;
  --warning: #9a5b08;
  --warning-soft: #fff4df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --nav: #0d1a2b;
  --nav-soft: #16283f;
  --shadow-sm: 0 4px 18px rgba(18, 38, 63, .055);
  --shadow-md: 0 16px 48px rgba(18, 38, 63, .11);
}

html[lang="fa"] body,
html[lang="fa"] button,
html[lang="fa"] input,
html[lang="fa"] select,
html[lang="fa"] textarea { font-family: var(--font-fa); }
html[lang="en"] body,
html[lang="en"] button,
html[lang="en"] input,
html[lang="en"] select,
html[lang="en"] textarea { font-family: var(--font-en); }

body { background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
code, pre, .technical, .technical-input, .technical-ltr, [data-technical] {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  text-align: left !important;
  font-family: var(--font-code) !important;
  letter-spacing: 0;
}

/* Physical shell: FA sidebar is on the right, EN sidebar is on the left. */
#shell {
  display: grid !important;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-areas: "sidebar workspace";
  direction: ltr;
  min-height: 100vh;
  height: 100vh;
}
html[dir="rtl"] #shell {
  grid-template-columns: minmax(0, 1fr) var(--sidebar);
  grid-template-areas: "workspace sidebar";
}
aside { grid-area: sidebar; direction: ltr; }
main { grid-area: workspace; direction: ltr; }
html[dir="rtl"] aside, html[dir="rtl"] main { direction: rtl; }
html[dir="ltr"] aside, html[dir="ltr"] main { direction: ltr; }

aside {
  width: auto;
  height: 100vh;
  background: linear-gradient(180deg, #0c1727 0%, #10223a 100%);
  border-inline-end: 1px solid rgba(255,255,255,.06);
  box-shadow: none;
  padding: 18px 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 7px 10px 12px;
  font-size: 19px;
  color: #fff;
}
.brand::before {
  content: attr(data-brand-mark);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #3f8cff, #155eef);
  box-shadow: 0 8px 22px rgba(21,94,239,.34);
  font-size: 11px;
  font-weight: 900;
}
.route-mark.has-custom-logo { padding: 0; overflow: hidden; }
.route-mark.has-custom-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.branding-settings { margin-bottom: 18px; }
.branding-form { display: grid; grid-template-columns: minmax(12rem,1fr) minmax(8rem,.45fr) minmax(18rem,1.3fr) auto; gap: 12px; align-items: end; }
.branding-form label { display: grid; gap: 6px; font-weight: 700; color: var(--ink-soft); }
.branding-preview { min-height: 40px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.branding-preview .route-mark { width: 32px; height: 32px; font-size: 10px; }
.branding-preview b { color: var(--ink); }
.branding-form .form-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
@media(max-width:900px){.branding-form{grid-template-columns:1fr 1fr}.branding-logo-url,.branding-preview{grid-column:1 / -1}}
@media(max-width:560px){.branding-form{grid-template-columns:1fr}}
.operator-guide { display: grid; gap: 16px; max-width: 880px; }
.operator-guide section { border-top: 1px solid var(--line); padding-top: 14px; }
.operator-guide section:first-of-type { border-top: 0; padding-top: 0; }
.operator-guide h3 { margin: 0 0 8px; font-size: 15px; }
.operator-guide p, .operator-guide li { color: var(--ink-soft); line-height: 1.85; }
.operator-guide ol { margin: 8px 0; padding-inline-start: 24px; }
.guide-intro { margin: 0; color: var(--ink) !important; font-weight: 650; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Product surface — intentional operator density, not a card-gallery.  The
 * palette is tokenized so the chosen theme changes semantics, not markup. */
html[data-theme="dark"] {
  --canvas: #0b1119; --surface: #111b27; --surface-soft: #152231; --ink: #edf3fa;
  --ink-soft: #a5b4c7; --line: #27384b; --primary: #5aa9ff; --primary-strong: #338bed;
  --primary-soft: #142d48; --success: #63d3a2; --success-soft: #103528;
  --warning: #f0ba63; --warning-soft: #382b17; --danger: #f4877e; --danger-soft: #3d2022;
}
html[data-theme="light"] {
  --canvas: #f4f6f8; --surface: #ffffff; --surface-soft: #f8fafc; --ink: #172334;
  --ink-soft: #5c6b7e; --line: #d7e0ea; --primary: #1769c2; --primary-strong: #0f569f;
  --primary-soft: #e8f2ff; --success: #147a53; --success-soft: #e7f7ee;
  --warning: #8d5b12; --warning-soft: #fff4df; --danger: #b5403a; --danger-soft: #fff0ef;
}
html[data-theme] body, html[data-theme] main { background: var(--canvas); color: var(--ink); }
html[data-theme] header { background: var(--surface); border-bottom-color: var(--line); box-shadow: none; }
html[data-theme] aside { background: #0e1927; border-inline-end-color: #24364b; box-shadow: none; }
html[data-theme="light"] aside { background: #132236; border-inline-end-color: #263a53; }
html[data-theme] .product-page-guide, html[data-theme] .panel, html[data-theme] .card, html[data-theme] .table-wrap, html[data-theme] .resource-card, html[data-theme] .monitor-status-card { background: var(--surface); border-color: var(--line); box-shadow: none; border-radius: 8px; }
html[data-theme] .product-page-guide, html[data-theme] .card, html[data-theme] .panel { padding: 16px; }
html[data-theme] .table-wrap { border-radius: 8px; }
html[data-theme] th { background: var(--surface-soft); color: var(--ink-soft); border-bottom-color: var(--line); }
html[data-theme] th, html[data-theme] td { padding: 10px 12px; border-bottom-color: var(--line); }
html[data-theme] tbody tr:hover { background: var(--surface-soft); }
html[data-theme] input, html[data-theme] select, html[data-theme] textarea { background: var(--surface); color: var(--ink); border-color: var(--line); border-radius: 6px; min-height: 38px; }
html[data-theme] input:focus, html[data-theme] select:focus, html[data-theme] textarea:focus { outline: 2px solid color-mix(in srgb,var(--primary) 28%,transparent); border-color: var(--primary); }
html[data-theme] button { border-radius: 6px; box-shadow: none; min-height: 36px; }
html[data-theme] button:hover { box-shadow: none; transform: none; }
html[data-theme] button.secondary, html[data-theme] .secondary, html[data-theme] button.ghost { background: var(--surface-soft); color: var(--ink); border: 1px solid var(--line); }
html[data-theme] button.secondary:hover, html[data-theme] button.ghost:hover { background: var(--primary-soft); border-color: color-mix(in srgb,var(--primary) 40%,var(--line)); }
html[data-theme] .operator-status-strip { background: var(--surface); border: 1px solid var(--line); box-shadow: none; border-radius: 8px; }
html[data-theme] .operator-status-strip>div + div { border-inline-start-color: var(--line); }
html[data-theme] .operator-workbench>.workbench-commands { background: var(--surface-soft); border-color: var(--line); box-shadow: none; border-radius: 8px; }
html[data-theme] .route-mark, html[data-theme] .brand::before { box-shadow: none; background: var(--primary); }
html[data-theme="light"] body:has(#login:not(.hidden)) { background: #eef2f6; }
html[data-theme="light"] .center-card { background: var(--surface); border-color: var(--line); box-shadow: 0 14px 40px rgba(21,35,52,.10); }
html[data-theme="dark"] .center-card { background: var(--surface); border-color: var(--line); box-shadow: 0 18px 48px rgba(0,0,0,.30); }
@media(prefers-reduced-motion:reduce){html[data-theme] *,html[data-theme] *::before,html[data-theme] *::after{transition:none!important;animation:none!important}}
.brand { font-size: 0; }
.brand b { display: block; color: #fff; font-size: 15px; letter-spacing: 0; }
.brand b::after { content: " Control Plane"; color: #82a3cb; font-size: 10px; font-weight: 500; }
html[lang="fa"] .brand b::after { content: " · مرکز کنترل DNS"; }

.scope-box {
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 10px;
}
.scope-box label { color: #9db0c9; }
.scope-box select { background: #142943; border-color: #294463; }
.nav-filter-label input { background: #13263e !important; border-color: #294463 !important; }
.nav-section summary { color: #93a8c3; border-radius: 10px; }
.nav-section[open] summary, .nav-section summary:hover { background: rgba(255,255,255,.055); }
.nav-group-icon { background: #183352; color: #7db0ff; }
.nav-count { background: #183352; color: #adc7e8; }
.nav-pages button { min-height: 38px; color: #b9c9dd; }
.nav-pages button.active { background: linear-gradient(90deg, rgba(21,94,239,.26), rgba(21,94,239,.11)); color: #fff; }
html[dir="rtl"] .nav-pages button.active { background: linear-gradient(270deg, rgba(21,94,239,.26), rgba(21,94,239,.11)); }
.aside-actions { border-top: 1px solid rgba(255,255,255,.08); padding-top: 11px; }

main { background: var(--canvas); }
header {
  padding: 19px 28px 17px;
  min-height: 84px;
  background: rgba(255,255,255,.93);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(18,38,63,.035);
}
header h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
header p { color: var(--ink-soft); line-height: 1.75; }
.page-breadcrumb { color: #7b899c; }
.header-actions button { min-height: 38px; }
#api-status { background: var(--success-soft); color: var(--success); font-weight: 750; }
#scope-status { max-width: 270px; overflow: hidden; text-overflow: ellipsis; }
#content { max-width: 1560px; padding: 24px 28px 56px; }

/* Keep the previous engineering journey available, but make the product task
 * header the primary explanation. */
.journey-strip { display: none; }
.product-page-guide {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
}
.product-page-guide h2 { margin: 3px 0 4px; font-size: 16px; }
.product-page-guide p { margin: 0; color: var(--ink-soft); line-height: 1.75; }
.product-guide-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.product-guide-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 20px;
}
.product-guide-copy { flex: 1; min-width: 0; }

button {
  min-height: 36px;
  border-radius: 10px;
  padding: 8px 13px;
  background: var(--primary);
  font-weight: 720;
  box-shadow: none;
}
button:hover { background: var(--primary-strong); box-shadow: 0 7px 18px rgba(21,94,239,.17); }
button.secondary, .secondary, button.ghost { background: #edf1f7; color: #26364d; }
button.secondary:hover, button.ghost:hover { background: #e3e9f2; box-shadow: none; }
button.link-button { padding: 4px 0; min-height: auto; background: transparent; color: var(--primary); box-shadow: none; }
button.link-button:hover { background: transparent; text-decoration: underline; transform: none; }

.card, .panel, .table-wrap {
  border-color: var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
}
.card, .panel { padding: 18px; }
.card .label { color: var(--ink-soft); line-height: 1.7; }
.card .value { font-size: 28px; }
.table-wrap { overflow: auto; background: var(--surface); }
table { font-size: 12.5px; }
th { background: #f7f9fc; color: #556579; font-weight: 760; }
th, td { padding: 13px 14px; }
html[dir="rtl"] th:not(.technical):not([data-technical]),
html[dir="rtl"] td:not(.technical):not([data-technical]) { text-align: right; }
html[dir="ltr"] th:not(.technical):not([data-technical]),
html[dir="ltr"] td:not(.technical):not([data-technical]) { text-align: left; }
.pill { font-weight: 750; padding: 5px 9px; }
.pill.good, .pill.healthy, .pill.succeeded, .status-positive { background: var(--success-soft); color: var(--success); }
.pill.warning, .pill.warn, .pill.queued, .pill.running, .status-warning { background: var(--warning-soft); color: var(--warning); }
.pill.danger, .pill.failed, .status-negative { background: var(--danger-soft); color: var(--danger); }
.pill.neutral { background: #eef2f7; color: #526176; }

/* Dashboard */
.ops-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr);
  gap: 22px;
  align-items: stretch;
  padding: 25px 27px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 12%, rgba(83,158,255,.34), transparent 36%),
    linear-gradient(125deg, #10213b 0%, #123b70 62%, #155eef 100%);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(18,59,112,.22);
}
.ops-hero h2 { margin: 6px 0 9px; font-size: 25px; }
.ops-hero p { margin: 0; max-width: 760px; color: #d4e5fb; line-height: 1.9; }
.ops-eyebrow { color: #8fc3ff; font-size: 11px; font-weight: 820; }
.ops-state {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 17px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 15px;
  background: rgba(255,255,255,.09);
  backdrop-filter: blur(8px);
}
.ops-state-row { display: flex; align-items: center; gap: 11px; }
.ops-state-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 5px rgba(255,255,255,.08); }
.ops-state-dot.ok { background: #52d7a0; }
.ops-state-dot.warn { background: #ffca64; }
.ops-state-dot.bad { background: #ff8c83; }
.ops-state strong { font-size: 17px; }
.ops-state small { display: block; margin-top: 5px; color: #d4e5fb; line-height: 1.7; }
.ops-state-actions { display: flex; gap: 8px; margin-top: 16px; }
.ops-state-actions button { background: #fff; color: #173a67; }
.ops-state-actions button.secondary { background: rgba(255,255,255,.13); color: #fff; border: 1px solid rgba(255,255,255,.15); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-top: 16px;
}
.kpi-card {
  min-height: 128px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 17px;
  box-shadow: var(--shadow-sm);
}
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); }
.kpi-card .value { margin-top: 12px; font-size: 25px; font-weight: 850; }
.kpi-card .label { color: var(--ink-soft); font-size: 12px; }
.kpi-card .hint { margin-top: 6px; color: #758399; font-size: 11px; line-height: 1.6; }
.kpi-card.attention { border-color: #f1cc8c; background: linear-gradient(180deg,#fff,#fffaf0); }
.kpi-card.critical { border-color: #f0bbb6; background: linear-gradient(180deg,#fff,#fff6f5); }

.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(330px, .88fr); gap: 16px; margin-top: 16px; }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.panel-title h3 { margin: 0; font-size: 16px; }
.panel-title p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.attention-list, .activity-list, .service-list, .launch-grid { display: flex; flex-direction: column; gap: 9px; }
.attention-item, .activity-item, .service-item {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid #edf0f5;
  border-radius: 12px;
  background: #fff;
}
.attention-item:hover, .service-item:hover { background: #fafcff; border-color: #d6e2f2; }
.item-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.item-icon.warn { background: var(--warning-soft); color: var(--warning); }
.item-icon.bad { background: var(--danger-soft); color: var(--danger); }
.item-copy b { display: block; font-size: 12.5px; }
.item-copy small { display: block; margin-top: 3px; color: var(--ink-soft); line-height: 1.55; }
.launch-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
.launch-card {
  text-align: start;
  min-height: 105px;
  padding: 14px;
  background: #f8fbff;
  color: var(--ink);
  border: 1px solid #e0e9f6;
  box-shadow: none;
}
.launch-card:hover { background: var(--primary-soft); color: var(--ink); border-color: #bbd2f5; transform: none; box-shadow: none; }
.launch-card span { display: block; font-size: 19px; margin-bottom: 7px; color: var(--primary); }
.launch-card b { display: block; }
.launch-card small { display: block; color: var(--ink-soft); margin-top: 4px; line-height: 1.6; }
.no-data-note { display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; border-radius: 11px; background: #f6f8fb; color: var(--ink-soft); line-height: 1.7; font-size: 11.5px; }

/* Resource experience */
.resource-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.resource-hero h2 { margin: 0; font-size: 17px; }
.resource-hero p { margin: 6px 0 0; color: var(--ink-soft); line-height: 1.7; }
.resource-cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.resource-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 17px; box-shadow: var(--shadow-sm); }
.resource-card:hover { border-color: #bfd3ed; box-shadow: var(--shadow-md); }
.resource-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.resource-card h3 { margin: 0; font-size: 15px; }
.resource-card .sub { margin-top: 5px; color: var(--ink-soft); font-size: 11.5px; line-height: 1.6; }
.resource-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 15px 0; }
.fact { padding: 9px 10px; border-radius: 10px; background: #f7f9fc; min-width: 0; }
.fact span { display: block; color: #748297; font-size: 10.5px; margin-bottom: 4px; }
.fact b, .fact code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.resource-actions { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 12px; border-top: 1px solid #edf0f5; }
.resource-actions button { flex: 0 0 auto; }
.progress-steps { display: flex; align-items: flex-start; gap: 0; margin: 15px 0 12px; overflow: auto; padding-bottom: 3px; }
.progress-step { display: flex; align-items: center; min-width: max-content; color: #8996a8; font-size: 10px; }
.progress-step::after { content: ""; width: 18px; height: 1px; background: #d8e0ea; margin: 0 5px; }
.progress-step:last-child::after { display: none; }
.progress-step i { display: grid; place-items: center; width: 20px; height: 20px; margin-inline-end: 5px; border-radius: 50%; background: #eef2f7; font-style: normal; font-size: 9px; }
.progress-step.done { color: var(--success); }
.progress-step.done i { background: var(--success-soft); }
.progress-step.active { color: var(--primary); font-weight: 800; }
.progress-step.active i { background: var(--primary-soft); }

/* Monitoring */
.monitor-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; }
.monitor-status-card { padding: 17px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.monitor-status-card .metric { margin-top: 10px; font-size: 26px; font-weight: 850; }
.monitor-status-card .caption { color: var(--ink-soft); font-size: 11.5px; line-height: 1.65; }
.monitor-layout { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(330px,.8fr); gap: 16px; margin-top: 16px; }
.signal-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.signal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.signal-bar { height: 10px; margin-top: 13px; border-radius: 999px; background: #edf1f6; overflow: hidden; position: relative; direction: ltr; }
.signal-bar > span { display: block; height: 100%; min-width: 4px; background: var(--danger); border-radius: inherit; }
.signal-threshold { display: flex; justify-content: space-between; color: #7b899c; font-size: 10px; margin-top: 6px; direction: ltr; }
.technical-details { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.technical-details summary { cursor: pointer; padding: 12px 14px; font-weight: 760; }
.technical-details > div, .technical-details > pre, .technical-details > p { margin: 0; padding: 0 14px 14px; }

/* Modal and forms */
.modal { direction: ltr; }
.modal-card { direction: ltr; border-radius: 18px; }
html[dir="rtl"] .modal-card { direction: rtl; }
.form-actions { direction: ltr; }
html[dir="rtl"] .form-actions { direction: rtl; }
input, select, textarea { border-color: #cfd8e5; border-radius: 10px; min-height: 42px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(21,94,239,.13); border-color: #6a9cf2; }

/* Login physical placement */
body:has(#login:not(.hidden)) {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 20%, rgba(21,94,239,.18), transparent 32%),
    linear-gradient(125deg,#eef4ff,#f8fafc 55%,#eef2f8);
}
.center-card { margin: 10vh 8vw 0 auto; box-shadow: var(--shadow-md); border: 1px solid rgba(255,255,255,.8); }
html[dir="ltr"] .center-card { margin: 10vh auto 0 8vw; }

@media (max-width: 1250px) {
  .kpi-grid, .monitor-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .resource-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ops-hero, .dashboard-layout, .monitor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 850px) {
  #shell, html[dir="rtl"] #shell, html[dir="ltr"] #shell {
    display: block !important;
    height: auto;
  }
  aside { width: 100%; height: auto; }
  main { height: auto; }
  #content { padding: 16px; }
  header { padding: 16px; }
  .product-page-guide, .resource-hero { align-items: flex-start; flex-direction: column; }
  .product-guide-actions { justify-content: flex-start; }
  .kpi-grid, .monitor-summary, .resource-cards, .launch-grid { grid-template-columns: 1fr; }
  .ops-hero { padding: 20px; }
}

/* Phase 12 operational readiness */
.readiness-hero{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;padding:26px;border:1px solid var(--border);border-radius:18px;background:linear-gradient(135deg,var(--panel),var(--panel-soft));box-shadow:var(--shadow-sm)}
.readiness-hero h2{margin:.35rem 0 .55rem;font-size:clamp(1.45rem,2.2vw,2.15rem)}
.readiness-hero p{max-width:850px;margin:0;color:var(--muted);line-height:1.9}
.eyebrow{font-size:.78rem;font-weight:800;letter-spacing:.04em;color:var(--primary)}
.readiness-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-top:16px}
.readiness-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:16px}
.readiness-component{padding:18px;border:1px solid var(--border);border-radius:14px;background:var(--panel-soft)}
.readiness-component h3{font-size:1rem;margin:0}
.readiness-component p{margin:.3rem 0 0;color:var(--muted);font-size:.88rem}
.dependency-line{display:flex;justify-content:space-between;gap:18px;margin-top:14px;padding-top:12px;border-top:1px dashed var(--border);font-size:.82rem}
.dependency-line span{color:var(--muted)}
.dependency-line b{direction:ltr;unicode-bidi:isolate;text-align:end;overflow-wrap:anywhere}
@media(max-width:1100px){.readiness-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.readiness-grid{grid-template-columns:1fr}}
@media(max-width:700px){.readiness-hero{display:block}.readiness-kpis{grid-template-columns:1fr}.dependency-line{display:block}.dependency-line b{display:block;margin-top:6px;text-align:start}}

#api-status[data-state="unknown"],#api-status[data-state="pending"]{opacity:.72}
#api-status[data-state="error"]{font-weight:800;text-decoration:underline}
#api-status[data-state="ok"]{font-weight:700}

/* Phase 40 — approved dark operator-console alignment.
 * The six registered panel references remain the visual authority: dense dark
 * workspace, blue operational accents, true RTL/LTR and isolated technical data.
 */
:root {
  --canvas: #071321;
  --surface: #0e1e30;
  --surface-soft: #12263b;
  --ink: #e8f0fa;
  --ink-soft: #9fb0c6;
  --line: #233a53;
  --primary: #2894ff;
  --primary-strong: #1579d6;
  --primary-soft: #12375a;
  --success: #4ad69a;
  --success-soft: #113b31;
  --warning: #ffc45d;
  --warning-soft: #443318;
  --danger: #ff8278;
  --danger-soft: #44211f;
  --nav: #081625;
  --nav-soft: #10263d;
  --shadow-sm: 0 5px 18px rgba(0,0,0,.20);
  --shadow-md: 0 18px 52px rgba(0,0,0,.34);
  --border: var(--line);
  --panel: var(--surface);
  --panel-soft: var(--surface-soft);
  --muted: var(--ink-soft);
}
body, main { background: var(--canvas); color: var(--ink); }
header {
  background: rgba(8,22,37,.94);
  border-bottom-color: var(--line);
  box-shadow: 0 5px 22px rgba(0,0,0,.22);
}
header p, .page-breadcrumb, .muted, .card .label, .field-help, .form-note,
.resource-hero p, .product-page-guide p, .panel-title p, .item-copy small,
.launch-card small, .resource-card .sub, .monitor-status-card .caption,
.readiness-component p, .dependency-line span { color: var(--ink-soft); }
.product-page-guide, .card, .panel, .table-wrap, .resource-card, .monitor-status-card,
.kpi-card, .signal-card, .attention-item, .activity-item, .service-item,
.modal-card, .center-card, .toast, .empty-state, .resource-intro {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.card, .panel, .table-wrap, .resource-card, .monitor-status-card, .kpi-card,
.product-page-guide { box-shadow: var(--shadow-sm); }
th { background: #11253a; color: #aebdd0; }
th, td { border-bottom-color: #1e344b; }
tbody tr:hover { background: #10243a; }
input, select, textarea {
  background: #0a1a2a;
  color: var(--ink);
  border-color: #31506e;
}
input::placeholder, textarea::placeholder { color: #70859e; }
input:focus, select:focus, textarea:focus { outline-color: rgba(40,148,255,.22); border-color: #418ed3; }
button.secondary, .secondary, button.ghost, .close {
  background: #172b40;
  color: #dce8f6;
}
button.secondary:hover, button.ghost:hover, .close:hover { background: #203a55; }
.pill, .pill.neutral { background: #172c42; color: #c6d6e8; }
.fact, .no-data-note, .form-note, .technical-details, .launch-card {
  background: #10243a;
  color: var(--ink);
  border-color: var(--line);
}
.fact span, .signal-threshold { color: #879bb3; }
.resource-actions, .form-actions { border-color: var(--line); }
.attention-item, .activity-item, .service-item { border-color: #20364d; }
.attention-item:hover, .service-item:hover, .launch-card:hover { background: #142d47; border-color: #315a82; }
.kpi-card.attention { background: linear-gradient(180deg,#102237,#2f2818); border-color:#67552b; }
.kpi-card.critical { background: linear-gradient(180deg,#102237,#311f22); border-color:#704044; }
.signal-bar, .progress-step i { background: #1b3148; }
.progress-step::after { background: #2b455f; }
.empty-state { border-style: dashed; border-color: #33536f; }
.empty-state b { color: var(--ink); }
.danger-callout, .danger-zone { background: #351d20; border-color: #704048; color: #ffd5d1; }
.error { color: #ffd2ce; background: #43211f; border: 1px solid #73413d; }
.secret-once { background:#382e16; border-color:#7a632b; color:#ffe8a8; }
body:has(#login:not(.hidden)) {
  background:
    radial-gradient(circle at 18% 20%, rgba(40,148,255,.18), transparent 34%),
    linear-gradient(125deg,#071321,#0b1c2e 55%,#091827);
}
.center-card { border-color:#29445f; }
.reference-grid img { border-color:#31506e; }
#api-status { background:var(--success-soft); color:var(--success); }

/* Mobile navigation is a real drawer instead of a long menu above content. */
.mobile-nav-toggle { display:none; }
.nav-backdrop { display:none; }
@media (max-width:850px) {
  #shell, html[dir="rtl"] #shell, html[dir="ltr"] #shell { display:block!important; min-height:100vh; }
  main { min-height:100vh; }
  aside {
    position:fixed;
    z-index:120;
    top:0;
    bottom:0;
    width:min(320px,86vw);
    height:100vh;
    transition:transform .18s ease;
    box-shadow:0 24px 64px rgba(0,0,0,.46);
  }
  html[dir="rtl"] aside { right:0; left:auto; transform:translateX(105%); }
  html[dir="ltr"] aside { left:0; right:auto; transform:translateX(-105%); }
  body.nav-open aside { transform:translateX(0); }
  .mobile-nav-toggle { display:inline-grid; place-items:center; min-width:40px; }
  .nav-backdrop {
    position:fixed;
    z-index:110;
    inset:0;
    width:100%;
    height:100%;
    border:0;
    border-radius:0;
    background:rgba(1,8,16,.66);
    padding:0;
  }
  body.nav-open .nav-backdrop { display:block!important; }
  nav { display:flex; grid-template-columns:none; }
  header { position:sticky; top:0; }
}

/* Final theme layer: it intentionally follows legacy product rules so a
 * preference changes every shared surface, rather than only the shell. */
html[data-theme] .resource-card,
html[data-theme] .monitor-status-card,
html[data-theme] .signal-card,
html[data-theme] .kpi-card,
html[data-theme] .launch-card,
html[data-theme] .fact,
html[data-theme] .no-data-note,
html[data-theme] .form-note,
html[data-theme] .technical-details,
html[data-theme] .empty-state,
html[data-theme] .resource-intro {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
  border-radius: 8px;
}
html[data-theme] .kpi-card.attention,
html[data-theme] .kpi-card.critical { background: var(--surface); border-color: var(--line); }
html[data-theme] .attention-item,
html[data-theme] .activity-item,
html[data-theme] .service-item { background: transparent; border-color: var(--line); }
html[data-theme] .attention-item:hover,
html[data-theme] .activity-item:hover,
html[data-theme] .service-item:hover,
html[data-theme] .launch-card:hover { background: var(--primary-soft); border-color: var(--primary); }
html[data-theme] th { background: var(--surface-soft); color: var(--ink-soft); }
html[data-theme] input::placeholder,
html[data-theme] textarea::placeholder { color: var(--ink-soft); opacity: .78; }
html[data-theme] .nav-section summary { border-radius: 6px; }
html[data-theme] .nav-section[open] summary,
html[data-theme] .nav-section summary:hover { background: rgba(255,255,255,.075); }
html[data-theme] .nav-section-pages button { border-radius: 5px; }
html[data-theme] .nav-section-pages button.active { background: var(--primary); color: #fff; }
html[data-theme] .nav-section-pages button.active::before { background: #fff; }

/* Zone record tables are operational work surfaces: keep the search and
 * destructive actions visible without turning every cell into a card. */
.record-table-toolbar { display:flex; align-items:center; gap:12px; margin:12px 0; }
.record-table-toolbar input { max-width:420px; margin-top:0; }
.record-table-toolbar .muted { font-size:12px; }
[data-rr-row] td:last-child { min-width:150px; }
[data-rr-row] td:last-child .actions { justify-content:flex-start; }
[data-rr-delete] { background:var(--danger-soft,#fff0ee)!important; color:var(--danger,#b42318)!important; border:1px solid color-mix(in srgb, var(--danger,#b42318) 28%, transparent)!important; }
[data-rr-delete]:hover { background:var(--danger,#b42318)!important; color:#fff!important; }
@media (max-width:700px){ .record-table-toolbar { align-items:stretch; flex-direction:column; } .record-table-toolbar input { max-width:none; } }
.table-toolbar { display:flex; align-items:center; gap:12px; margin:0 0 12px; }
.table-toolbar input { flex:1; max-width:460px; margin-top:0; }
@media (max-width:700px){ .table-toolbar { align-items:stretch; flex-direction:column; } .table-toolbar input { max-width:none; } }
.health-region{display:inline-flex;align-items:center;gap:.35rem;margin:.15rem .25rem;padding:.2rem .4rem;border:1px solid var(--line);border-radius:6px;white-space:nowrap}.health-region small{color:var(--muted)}
