@import url("nav.css");

:root {
  --bg: #f3f6f6;
  --surface: #ffffff;
  --surface-2: #f7fafa;
  --text: #0f1f1e;
  --text-2: #3f5553;
  --muted: #6b7f7d;
  --border: #e1e8e8;
  --border-2: #cfdada;
  --accent: #4dcfcb;
  --accent-2: #00a09d;
  --accent-3: #007a77;
  --accent-soft: #e6f6f5;
  --accent-ring: rgba(0, 160, 157, .18);
  --warn-bg: #fffaeb;
  --warn-border: #fedf89;
  --warn-text: #93370d;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --customer: #475467;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--twj-font); color: var(--text); background: var(--bg); min-height: 100vh; font-size: 14.5px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-3); }
h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; }
html[lang=ar] h1, html[lang=ar] h2, html[lang=ar] h3 { letter-spacing: 0; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.page { max-width: 1480px; padding: 32px 40px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.3; color: var(--text); }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 820px; font-size: 14.5px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent-3); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px; }
.card + .card, .grid + .card, .card + .grid { margin-top: 20px; }
.card h2 { margin: 0 0 4px; font-size: 17px; color: var(--text); }
.card h3 { margin: 22px 0 10px; font-size: 14.5px; color: var(--text-2); }
.card .sub { color: var(--muted); margin: 0 0 18px; font-size: 13.5px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .page { padding: 20px 16px 48px; } }

/* ── Controls ───────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; white-space: nowrap; line-height: 1.4; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent-2); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-3); }
.btn-dark { background: var(--twj-side-bg); color: #fff; }
.btn-dark:hover { background: #1b3432; }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-3); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f4c7c3; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }

label.field, .field { display: block; margin-bottom: 16px; }
.field > span, label.field > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14px; color: var(--text); line-height: 1.4;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input::placeholder, textarea::placeholder { color: #98a8a6; }
.mono { font-family: var(--twj-mono); font-size: 12.5px; }

/* ── Status & badges ────────────────────────────────────────────────────── */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-draft { background: #f2f4f7; color: #475467; }
.status-submitted { background: #fffaeb; color: #b54708; }
.status-reviewed { background: var(--ok-soft); color: var(--ok); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f2f4f7; color: #475467; white-space: nowrap; }
.tag-reuse { background: #eef4ff; color: #3538cd; }
.tag-build { background: var(--accent-soft); color: var(--accent-3); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: start; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid #edf2f2; vertical-align: top; color: var(--text-2); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #fafcfc; }
table.data input, table.data select { padding: 7px 9px; font-size: 13px; border-radius: 8px; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
table.data tr.total td { background: var(--surface-2); font-weight: 700; color: var(--text); }

/* ── KPI tiles ──────────────────────────────────────────────────────────── */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow-sm); }
.kpi-icon { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-3); display: grid; place-items: center; flex-shrink: 0; }
.kpi-icon svg { width: 20px; height: 20px; }
.kpi .k-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .k-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .k-unit { color: var(--muted); font-size: 12.5px; }

/* ── Notices ────────────────────────────────────────────────────────────── */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); margin: 12px 0; color: var(--text-2); font-size: 13.5px; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.notice-ok { background: var(--accent-soft); border-color: #b5e6e4; color: var(--accent-3); }
.empty { text-align: center; color: var(--muted); padding: 56px 20px; }
.empty svg { width: 44px; height: 44px; color: var(--border-2); margin-bottom: 10px; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tabs button { background: none; border: none; font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); padding: 11px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 8px; }
.tabs button svg { width: 16px; height: 16px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent-3); border-bottom-color: var(--accent-2); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Dialog ─────────────────────────────────────────────────────────────── */
dialog { border: none; border-radius: 18px; padding: 0; box-shadow: 0 30px 80px rgba(12,26,25,.35); width: min(560px, calc(100vw - 32px)); font-family: var(--twj-font); color: var(--text); }
dialog::backdrop { background: rgba(12, 26, 25, .5); backdrop-filter: blur(2px); }
dialog form, dialog .dlg { padding: 26px; }
dialog h2 { margin: 0 0 16px; font-size: 18px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* ── Auth ───────────────────────────────────────────────────────────────── */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, 1fr); background: #fff; }
.auth-brand { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 110% -10%, rgba(77,207,203,.25), transparent 60%), linear-gradient(160deg, #0c1a19, #10302e 60%, #0b3f3c); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; }
.auth-brand .logo-chip { display: inline-flex; background: #fff; border-radius: 14px; padding: 10px 14px; align-self: flex-start; }
.auth-brand .logo-chip img { height: 34px; display: block; }
.auth-brand h1 { font-size: 34px; line-height: 1.3; margin: auto 0 14px; max-width: 520px; }
.auth-brand p { color: #b7cfcd; font-size: 15.5px; max-width: 520px; margin: 0 0 30px; }
.auth-points { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 14px; max-width: 520px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: #d6e6e5; }
.auth-points svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.auth-brand small { color: #6f8b89; margin-top: 30px; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; position: relative; }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.auth-card h2 { margin: 0; font-size: 24px; }
.auth-card .muted { margin: -6px 0 8px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.auth-card .btn { width: 100%; padding: 11px 16px; }
.auth-lang { position: absolute; top: 20px; inset-inline-end: 24px; }
.auth-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-logo { width: 200px; margin: 0 auto 8px; }
.dev-warning { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
@media (max-width: 900px) { .auth-body { grid-template-columns: 1fr; } .auth-brand { display: none; } }

/* ── Project cards ──────────────────────────────────────────────────────── */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.project-card { display: flex; flex-direction: column; gap: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s; }
.project-card:hover { box-shadow: var(--shadow); border-color: var(--border-2); }
.project-card h3 { margin: 0; font-size: 16.5px; color: var(--text); }
.project-card .meta { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.project-card .meta svg { width: 14px; height: 14px; }
.progress { height: 6px; background: #edf2f2; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 999px; }
html[dir=rtl] .progress > div { background: linear-gradient(270deg, var(--accent-2), var(--accent)); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats div { background: var(--surface-2); border: 1px solid #edf2f2; border-radius: 10px; padding: 9px 12px; }
.stats b { display: block; font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }

/* ── Questionnaire ──────────────────────────────────────────────────────── */
.q-layout { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .q-layout { grid-template-columns: 1fr; } .q-side { position: static !important; } }
.q-side { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 20px; }
.q-side .card { padding: 18px; }
.q-side .card + .card { margin-top: 0; }
.q-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.q-steps button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: start; background: none; border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--text-2); }
.q-steps button:hover { background: var(--surface-2); }
.q-steps button.active { background: var(--accent-soft); color: var(--accent-3); font-weight: 600; }
.q-steps .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; background: var(--surface-2); padding: 1px 8px; border-radius: 999px; }
.q-steps .done .count { color: var(--ok); background: var(--ok-soft); }
.question { padding: 20px 0; border-bottom: 1px solid #edf2f2; }
.question:last-child { border-bottom: none; padding-bottom: 4px; }
.question .q-label { font-weight: 600; color: var(--text); font-size: 15px; }
.question .q-label .req { color: var(--danger); margin-inline-start: 4px; }
.question .q-alt { color: var(--muted); font-size: 13px; margin-top: 3px; }
.question .q-input { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 14px; cursor: pointer; background: #fff; transition: .12s; font-size: 14px; color: var(--text-2); }
.chip span:hover { border-color: var(--accent-2); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent-2); color: var(--accent-3); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent-2); }
.chip input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-ring); }
.chip input:disabled + span { cursor: not-allowed; opacity: .7; }
.with-unit { display: flex; align-items: center; gap: 10px; max-width: 280px; }
.with-unit em { color: var(--muted); font-style: normal; }
.section-kicker { font-size: 12.5px; color: var(--accent-3); font-weight: 600; }

/* ── Reuse decision list ────────────────────────────────────────────────── */
.decision { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf2f2; font-size: 13.5px; color: var(--text-2); }
.decision:last-child { border-bottom: none; }

/* ── Diagrams & files ───────────────────────────────────────────────────── */
.diagram-box { border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 20px; overflow: auto; min-height: 340px; }
.diagram-box svg { max-width: 100%; height: auto; }
.diagram-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.file-list { display: grid; grid-template-columns: 320px 1fr; gap: 18px; }
@media (max-width: 1000px) { .file-list { grid-template-columns: 1fr; } }
.file-list ul { list-style: none; margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; gap: 2px; align-self: start; }
.file-list li button { width: 100%; text-align: start; background: transparent; border: none; border-radius: 8px; padding: 9px 12px; font: inherit; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.file-list li button svg { width: 16px; height: 16px; margin-top: 3px; color: var(--muted); flex-shrink: 0; }
.file-list li button:hover { background: var(--surface-2); }
.file-list li button small { display: block; color: var(--muted); direction: ltr; text-align: start; }
.file-list li button.active { background: var(--accent-soft); color: var(--accent-3); }
.file-list li button.active svg { color: var(--accent-3); }
pre.code { margin: 0; background: #0c1a19; color: #d5ecea; padding: 18px; border-radius: 12px; overflow: auto; max-height: 640px; font-family: var(--twj-mono); font-size: 12.5px; line-height: 1.6; direction: ltr; text-align: left; }

/* ── Admin ──────────────────────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .admin-layout { grid-template-columns: 1fr; } .admin-menu { position: static !important; } }
.admin-menu { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 24px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow-sm); }
.admin-menu button { display: flex; align-items: center; gap: 10px; text-align: start; background: none; border: none; border-radius: 9px; padding: 10px 12px; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--text-2); }
.admin-menu button svg { width: 17px; height: 17px; color: var(--muted); }
.admin-menu button:hover { background: var(--surface-2); }
.admin-menu button.active { background: var(--accent-soft); color: var(--accent-3); font-weight: 600; }
.admin-menu button.active svg { color: var(--accent-3); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 20px; padding: 14px 18px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.savebar .spacer { flex: 1; }
.q-editor-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; background: #fff; }
.q-editor-item summary { cursor: pointer; font-weight: 600; display: flex; justify-content: space-between; gap: 10px; align-items: center; list-style: none; }
.q-editor-item summary::-webkit-details-marker { display: none; }
.q-editor-item[open] { box-shadow: var(--shadow); border-color: var(--border-2); }
.q-editor-item[open] summary { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #edf2f2; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ── RTL ────────────────────────────────────────────────────────────────── */
html[dir=rtl] .mono, html[dir=rtl] pre, html[dir=rtl] .diagram-box { direction: ltr; }
html[dir=rtl] input.mono { text-align: left; }

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .no-print, .tabs, .toolbar, .savebar { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .tab-panel { display: block !important; break-before: page; }
  .page { padding: 0; max-width: none; }
}

/* ── Sizing & architecture screen ───────────────────────────────────────── */
.kpi-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1400px) { .kpi-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .kpi-strip { grid-template-columns: 1fr 1fr; } }
.kpi-strip .kpi { padding: 16px 18px; }
.kpi-strip .k-value { font-size: 23px; }

.calc-layout { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1200px) { .calc-layout { grid-template-columns: 1fr; } .calc-settings { position: static !important; max-height: none !important; } }
.calc-settings { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-inline-end: 4px; scrollbar-width: thin; }
.calc-settings .card { padding: 18px 20px; }
.calc-settings .card + .card { margin-top: 0; }
.set-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--text); }
.set-title .num { width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-3); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.set-title .spacer { flex: 1; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.fields .full { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.fld > small { font-size: 12px; color: var(--muted); }
.fld input, .fld select { padding: 8px 10px; font-size: 13.5px; }
.fld input[type=number] { direction: ltr; text-align: start; }
html[dir=rtl] .fld input[type=number] { text-align: right; }
.hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: #cfdada; position: relative; transition: background .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent-2); }
.switch input:checked + .track::after { transform: translateX(16px); }
html[dir=rtl] .switch input:checked + .track::after { transform: translateX(-16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--accent-ring); }
.switch input:disabled + .track { opacity: .5; }

.reuse-list { display: flex; flex-direction: column; }
.reuse-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf2f2; }
.reuse-row:last-child { border-bottom: none; }
.reuse-row .rl { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.reuse-row .rl svg { width: 17px; height: 17px; color: var(--muted); }
.reuse-row.on .rl { color: var(--text); font-weight: 600; }
.reuse-row.on .rl svg { color: #3538cd; }
.reuse-extra { padding: 4px 0 10px; }

.layer { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: #fff; overflow: hidden; }
.layer:last-child { margin-bottom: 0; }
.layer-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.layer-head:hover { background: var(--surface-2); }
.layer-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-3); display: grid; place-items: center; flex-shrink: 0; }
.layer-ic svg { width: 17px; height: 17px; }
.layer.off .layer-ic { background: #f2f4f7; color: #98a2b3; }
.layer.customer .layer-ic { background: #eef4ff; color: #3538cd; }
.layer-text { flex: 1; min-width: 0; }
.layer-text b { display: block; font-size: 13.5px; color: var(--text); }
.layer-text span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: start; }
html[dir=rtl] .layer-text span { text-align: right; }
.layer-chev { color: var(--muted); transition: transform .15s; display: flex; }
.layer-chev svg { width: 16px; height: 16px; }
.layer.open .layer-chev { transform: rotate(90deg); }
html[dir=rtl] .layer.open .layer-chev { transform: rotate(-90deg); }
.layer-body { display: none; padding: 4px 14px 14px; border-top: 1px solid #edf2f2; }
.layer.open .layer-body { display: block; padding-top: 14px; }
.layer.off .layer-text b { color: var(--muted); }

.calc-main .card { padding: 0; overflow: hidden; }
.calc-main .tabs { padding: 0 20px; margin: 0; background: #fff; }
.calc-main .tab-panel { padding: 20px; }
.diagram-ws { position: relative; border: 1px solid var(--border); border-radius: 12px; background:
  radial-gradient(circle, #dfe7e7 1px, transparent 1px) 0 0 / 18px 18px, #fbfdfd; height: 640px; overflow: hidden; cursor: grab; direction: ltr; }
.diagram-ws.grabbing { cursor: grabbing; }
.diagram-ws .stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.diagram-ws .stage svg { display: block; max-width: none !important; height: auto; }
.diagram-ws:fullscreen { height: 100vh; border-radius: 0; }
.ws-tools { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; display: flex; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: var(--shadow); direction: ltr; }
.ws-tools button { width: 32px; height: 32px; border: none; background: none; border-radius: 7px; cursor: pointer; color: var(--text-2); display: grid; place-items: center; font: inherit; font-weight: 600; }
.ws-tools button:hover { background: var(--surface-2); color: var(--accent-3); }
.ws-tools button svg { width: 16px; height: 16px; }
.ws-tools .zoom { min-width: 48px; font-size: 12.5px; color: var(--muted); display: grid; place-items: center; }
.ws-status { position: absolute; bottom: 12px; inset-inline-start: 12px; font-size: 12px; color: var(--muted); background: rgba(255,255,255,.9); padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 16px; height: 12px; border-radius: 3px; border: 1.5px solid; display: inline-block; }
.legend .lg-prov { border-color: #00a09d; background: #fff; }
.legend .lg-store { border-color: #007a77; background: #ecfaf9; }
.legend .lg-cust { border-color: #64748b; border-style: dashed; background: #f1f5f9; }
.formula { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.formula li { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.formula li b { display: block; margin-bottom: 4px; color: var(--text); }
.formula li code { font-family: var(--twj-mono); font-size: 12.5px; color: var(--accent-3); direction: ltr; display: block; text-align: start; }

/* ── environment bar ─────────────────────────────────────────────────────── */
.env-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.env-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.env-tab { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 10px; border: 1px solid transparent; background: transparent; font: inherit; cursor: pointer; color: var(--text-2); text-decoration: none; }
.env-tab:hover { background: var(--surface-2); }
.env-tab.active { background: var(--accent-soft); border-color: #b5e6e4; color: var(--accent-3); }
.env-dot { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }
.env-tab.active .env-dot { background: var(--accent-2); box-shadow: 0 0 0 3px rgba(0,160,157,.18); }
.env-name { font-weight: 600; font-size: 14px; }
.env-meta { font-size: 12px; color: var(--muted); }
.env-add { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--border-2); background: #fff; color: var(--accent-3); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.env-add:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.env-add svg { width: 15px; height: 15px; }
.env-actions { display: flex; gap: 6px; }
.diagram-ws { background: #fff; }
/* keep wide code and tables inside their column */
.file-list > * { min-width: 0; }
.tab-panel, .card, .grid > * { min-width: 0; }
pre.code { max-width: 100%; }

/* ── products ────────────────────────────────────────────────────────────── */
.product-card { border: 1px solid var(--border); border-inline-start: 4px solid var(--pc, #00a09d); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.product-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.product-head b { font-size: 14px; color: var(--text); }
.product-head .spacer { flex: 1; }
.product-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pc, #00a09d); display: inline-block; flex-shrink: 0; }
.product-add select { border-style: dashed; color: var(--accent-3); font-weight: 600; }
.product-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.product-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f2f4f7; color: var(--text-2); }
.product-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--pc, #00a09d); display: inline-block; }

table.data td input, table.data td select { min-width: 90px; }
