:root {
  color-scheme: light;
  --ink: #19191c;
  --muted: #656169;
  --paper: #f6f3ed;
  --surface: #fffdfa;
  --line: #dcd6cd;
  --accent: #8f2034;
  --accent-dark: #74182a;
  --teal: #8f2034;
  --soft-teal: #f4e6e8;
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f8f3ea;
  --muted: #c8bfbc;
  --paper: #0c0c0d;
  --surface: #151517;
  --line: #343438;
  --accent: #d06b7d;
  --accent-dark: #e28695;
  --teal: #d06b7d;
  --soft-teal: #2a181e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 8%, rgba(143, 32, 52, .13), transparent 24rem),
    linear-gradient(180deg, #fffdfa, var(--paper));
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 85% 8%, rgba(159, 32, 55, .07), transparent 24rem),
    linear-gradient(180deg, #111113, var(--paper));
}

button, a { font: inherit; }

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 5vw;
  border-bottom: 1px solid rgba(25, 25, 28, .12);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(10px);
}

:root[data-theme="dark"] .brand-bar { background: rgba(10, 10, 11, .96); }

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: .14em;
}

.brand-word { color: var(--op-nav-text); }
.brand-actions { display: flex; align-items: center; gap: .75rem; }
.theme-toggle {
  min-height: 40px;
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.proof-pill, .private-banner {
  border: 1px solid rgba(143, 32, 52, .28);
  border-radius: 999px;
  color: var(--teal);
  background: var(--soft-teal);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .04em;
  padding: .5rem .8rem;
}

.shell-main {
  width: min(1120px, 90vw);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 6.5rem) 0;
}

.hero { max-width: 760px; }
.hero.compact { margin: 0 auto 2.5rem; }

.kicker, .eyebrow, .feature-label {
  margin: 0 0 .6rem;
  color: var(--teal);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(2.25rem, 7vw, 5.2rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.lede, .identity-line {
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  line-height: 1.65;
}

.language-link {
  display: inline-flex;
  margin-bottom: 1.5rem;
  color: var(--teal);
  font-weight: 750;
}

.identity-grid, .module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}

.identity-card, .module-card, .launch-result {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgba(25, 25, 28, .06);
}

.identity-card strong, .module-card h2 { font-size: 1.25rem; }

button, .primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: .75rem 1rem;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

button:hover, .primary-action:hover { background: var(--accent-dark); }
button:focus-visible, a:focus-visible { outline: 3px solid #e6ad36; outline-offset: 3px; }

.workspace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.workspace-actions { display: flex; align-items: center; gap: 1rem; }
.workspace-actions form { margin: 0; }
.quiet-button { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.quiet-button:hover { color: #fff; }
.private-banner { display: block; width: fit-content; margin-bottom: 3.5rem; }
.lab-action {
  display: inline-flex;
  margin: -2rem 0 3rem;
  color: var(--teal);
  font-weight: 800;
}
.admin-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.authority-section { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.authority-card { border-inline-start: 5px solid var(--accent); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.admin-stack { display: grid; gap: 1rem; }
.admin-card { margin: 1rem 0 2rem; padding: clamp(1.1rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.admin-card h2, .admin-card h3 { margin: .6rem 0 .3rem; }
.compact-card { display: flex; flex-direction: column; gap: .8rem; margin: 0; }
.admin-form { display: grid; gap: 1rem; }
.admin-form label, .assignment-form label { display: grid; gap: .4rem; color: var(--muted); font-weight: 700; }
input, select { width: 100%; min-height: 44px; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--paper); font: inherit; }
input[type="checkbox"] { width: 1.1rem; min-height: 1.1rem; accent-color: var(--accent); }
.two-fields, .assignment-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.assignment-form button { grid-column: 1 / -1; }
.permission-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: .8rem; }
.permission-group { min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: 14px; }
.permission-group legend { padding: 0 .4rem; color: var(--teal); font-weight: 850; }
.permission-option { display: grid !important; grid-template-columns: auto 1fr; align-items: start; gap: .65rem !important; padding: .55rem 0; color: var(--ink) !important; }
.permission-option small, .assignment-list small { display: block; margin-top: .2rem; color: var(--muted); font-weight: 400; }
.field-guidance { color: var(--muted); font-weight: 400; line-height: 1.45; }
.permission-option code { overflow-wrap: anywhere; }
.admin-card-head { display: flex; justify-content: space-between; gap: 1rem; }
.inline-form { margin-top: 1rem; }
.status-check { display: flex !important; grid-template-columns: none !important; align-items: center; gap: .5rem !important; }
.assignment-list, .history-list { display: grid; gap: .65rem; padding: 0; list-style: none; }
.assignment-list li, .history-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; }
.history-list li { flex-wrap: wrap; justify-content: flex-start; }
.module-topline { color: var(--muted); font-size: .8rem; }
.status-dot { display: inline-block; width: .55rem; height: .55rem; margin-inline-end: .4rem; border-radius: 50%; background: #3ba86b; }
.module-card code, .launch-result code { overflow-wrap: anywhere; color: var(--teal); }
.feature-list { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.feature-list li { padding: .35rem .6rem; border-radius: 999px; background: var(--paper); font-size: .78rem; }
.module-card .primary-action { margin-top: auto; }
.module-card.is-emphasized { border-color: var(--accent); box-shadow: 0 18px 48px rgba(143, 32, 52, .14); }
.default-badge, .demo-badge {
  display: inline-flex;
  width: fit-content;
  padding: .35rem .6rem;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .035em;
}
.demo-badge { background: var(--teal); }
.feature-list a { color: var(--teal); font-weight: 750; text-decoration-thickness: .08em; }
.empty-state { padding: 2rem; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); }
.reservation { margin-top: 2rem; color: var(--muted); }
.launch-result { margin: 2rem 0; }
.launch-result.allowed { border-inline-start: 5px solid var(--teal); }
.launch-result.denied { border-inline-start: 5px solid #a73333; }
.launch-result dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; }
.launch-result dt { color: var(--muted); }
.launch-result dd { margin: 0; min-width: 0; }
.primary-action.inline { width: fit-content; }
.quiet-link { color: var(--ink); font-weight: 750; }

.lab-grid { display: grid; gap: 1rem; }
.lab-module { padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.lab-module-head, .lab-feature { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lab-module h2 { margin: .65rem 0 .25rem; font-size: clamp(1.35rem, 3vw, 2rem); }
.state { display: inline-flex; padding: .3rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 850; }
.state.on { color: #0a573a; background: #c8f0de; }
.state.off { color: #7c3434; background: #f5d9d9; }
:root[data-theme="dark"] .state.on { color: #c8f0de; background: #174c37; }
:root[data-theme="dark"] .state.off { color: #ffdada; background: #562d2d; }
.lab-feature-list { display: grid; gap: .7rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.lab-feature { padding: .85rem; border: 1px solid var(--line); border-radius: 14px; }
.lab-feature strong, .lab-feature code { display: block; }
.lab-feature code { margin-top: .25rem; color: var(--muted); }
.toggle-action { min-width: 7rem; }
.toggle-action:disabled { cursor: not-allowed; opacity: .45; }
.lab-hint { color: var(--muted); }
.reset-panel { margin-top: 1.5rem; }

.setup-entry-card, .setup-summary, .setup-card, .current-setup {
  margin: 0 0 2rem;
  padding: clamp(1.1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}
.setup-entry-card { border-inline-start: 5px solid var(--accent); }
.setup-entry-card h2, .setup-summary h2, .setup-card h2 { margin: .7rem 0; }
.setup-summary h2 span { color: var(--muted); font-size: .8em; }
.setup-summary.neutral { border-style: dashed; color: var(--muted); }
.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.setup-card { display: flex; flex-direction: column; min-width: 0; margin: 0; }
.setup-card .primary-action { margin-top: auto; }
.setup-facts { display: grid; grid-template-columns: minmax(8rem, .7fr) minmax(0, 1.3fr); gap: .65rem 1rem; }
.setup-facts dt { color: var(--muted); }
.setup-facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.override-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .8rem; margin-top: 1.25rem; }
.override-form label { display: grid; gap: .4rem; color: var(--muted); font-weight: 700; }
.delta-list { display: grid; gap: .75rem; margin: 2rem 0; padding: 0; list-style: none; }
.delta-row { padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.delta-row > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.delta-row dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem .8rem; }
.delta-row dt { color: var(--muted); }
.delta-row dd { margin: 0; overflow-wrap: anywhere; }
.preview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }

footer {
  width: min(1120px, 90vw);
  margin: 0 auto;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
}

[dir="rtl"] .kicker, [dir="rtl"] .eyebrow, [dir="rtl"] .feature-label { letter-spacing: 0; }
[dir="rtl"] h1 { letter-spacing: -.025em; }

@media (max-width: 680px) {
  .brand-bar { min-height: 62px; padding: 0 1rem; }
  .proof-pill { max-width: 55%; text-align: center; }
  .brand-actions { gap: .35rem; }
  .theme-toggle { min-width: 44px; max-width: 8.5rem; }
  .shell-main { width: min(100% - 2rem, 1120px); padding: 2.5rem 0; }
  .workspace-head { align-items: flex-start; flex-direction: column; }
  .workspace-actions { width: 100%; justify-content: space-between; }
  .identity-grid, .module-grid { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
  .setup-facts, .delta-row dl { grid-template-columns: 1fr; }
  .override-form { grid-template-columns: 1fr; }
  .override-form button, .preview-actions, .preview-actions form, .preview-actions button { width: 100%; }
  .launch-result dl { grid-template-columns: 1fr; }
  .lab-module-head, .lab-feature { align-items: stretch; flex-direction: column; }
  .two-fields, .assignment-form { grid-template-columns: 1fr; }
  .assignment-list li { align-items: stretch; flex-direction: column; }
  .toggle-action { width: 100%; }
  h1 { font-size: clamp(2.15rem, 12vw, 3.4rem); }
}
