:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #61706d;
  --line: #d9e1df;
  --accent: #18715b;
  --accent-strong: #105642;
  --warn: #a15c00;
  --shadow: 0 14px 35px rgba(25, 43, 39, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #020617;
  --panel: #0f172a;
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(148, 163, 184, 0.24);
  --accent: #06b6d4;
  --accent-strong: #0891b2;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }

.suite-nav-shell {
  position: sticky;
  top: 0;
  z-index: 80;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(248, 250, 252, 0.94);
  color: #0f172a;
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.14);
  backdrop-filter: blur(18px);
}

.suite-nav-inner {
  display: grid;
  grid-template-columns: minmax(280px, auto) minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  width: min(1760px, 100%);
  margin: 0 auto;
  padding: 14px 22px;
}

.suite-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(8, 145, 178, 0.28);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(8, 145, 178, 0.16), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(15, 23, 42, 0.04));
  color: #0f172a;
  padding: 12px 16px;
  text-decoration: none;
  box-shadow: 0 20px 56px rgba(2, 6, 23, 0.14);
}

.suite-nav-brand strong {
  display: block;
  font-size: 21px;
  font-weight: 900;
}

.suite-nav-brand small {
  display: block;
  margin-top: 2px;
  color: #475569;
  font-size: 12px;
  font-weight: 650;
}

.suite-nav-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 64px;
  border: 1px solid rgba(8, 145, 178, 0.52);
  border-radius: 20px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.52), transparent 28%),
    linear-gradient(135deg, rgba(8, 145, 178, 0.42), transparent 54%);
  box-shadow: 0 20px 44px rgba(8, 145, 178, 0.18);
}

.suite-nav-mark::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #0891b2, transparent);
}

.suite-mark-facade {
  display: grid;
  grid-template-columns: repeat(4, 10px);
  gap: 5px;
  transform: skewX(-9deg);
}

.suite-mark-facade i {
  display: block;
  height: 34px;
  border: 1px solid rgba(8, 145, 178, 0.38);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 28%),
    rgba(8, 145, 178, 0.2);
}

.suite-mark-facade i:nth-child(2),
.suite-mark-facade i:nth-child(4) {
  transform: translateY(8px);
}

.suite-nav-links,
.suite-nav-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.suite-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  background: rgba(8, 145, 178, 0.14);
  color: #0e7490;
  font-size: 11px;
  font-weight: 950;
}

.suite-nav-primary-link,
.suite-tools-mega summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.suite-nav-primary-link:hover,
.suite-tools-mega summary:hover,
.suite-tools-mega[open] summary {
  border-color: rgba(8, 145, 178, 0.52);
  background: rgba(8, 145, 178, 0.12);
}

.suite-tools-mega {
  position: relative;
}

.suite-tools-mega summary {
  list-style: none;
  background: rgba(8, 145, 178, 0.14);
}

.suite-tools-mega summary::-webkit-details-marker {
  display: none;
}

.suite-tools-mega summary::after {
  content: "v";
  color: #0891b2;
  font-weight: 950;
}

.suite-mega-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  z-index: 130;
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
  width: min(980px, calc(100vw - 36px));
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 28px;
  background: rgba(248, 250, 252, 0.98);
  padding: 16px;
  box-shadow: 0 30px 90px rgba(2, 6, 23, 0.26);
  backdrop-filter: blur(22px);
}

.suite-mega-column {
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.04);
  padding: 10px;
}

.suite-mega-column > p {
  margin: 0 0 8px;
  padding: 4px 6px;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.suite-nav-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  color: #0f172a;
  padding: 11px 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.suite-nav-menu-link:hover,
.suite-nav-menu-link.active {
  background: rgba(8, 145, 178, 0.12);
}

.suite-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 24px;
  background: rgba(2, 6, 23, 0.96);
  color: white;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.2);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
}

.theme-toggle button {
  min-height: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #cbd5e1;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.theme-toggle button[aria-pressed="true"] {
  background: rgba(103, 232, 249, 0.16);
  color: white;
}

.suite-brand,
.suite-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.suite-brand {
  gap: 14px;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  padding: 8px 10px;
  text-decoration: none;
}

.suite-brand strong {
  font-size: 18px;
}

.suite-brand small {
  display: block;
  margin-top: 2px;
  color: #94a3b8;
  font-size: 12px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 8px;
  background: rgba(103, 232, 249, 0.1);
  color: #a5f3fc;
  font-size: 12px;
  font-weight: 800;
}

.suite-brand .brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 15px;
}

.suite-links {
  flex-wrap: wrap;
}

.suite-menu {
  position: relative;
}

.suite-menu summary,
.suite-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  padding: 9px 11px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.suite-menu summary {
  list-style: none;
  cursor: pointer;
}

.suite-menu summary::-webkit-details-marker {
  display: none;
}

.suite-menu summary::after {
  content: "v";
  margin-left: 8px;
  color: #a5f3fc;
}

.suite-menu > div {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  display: grid;
  gap: 6px;
  width: 260px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.96);
  padding: 8px;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.28);
}

.suite-links a:hover,
.suite-menu summary:hover {
  border-color: rgba(103, 232, 249, 0.45);
  background: rgba(103, 232, 249, 0.11);
  color: white;
}

[data-summary] {
  position: relative;
}

[data-summary]::after {
  content: attr(data-summary);
  position: absolute;
  left: 50%;
  top: calc(100% + 12px);
  z-index: 50;
  width: min(310px, calc(100vw - 32px));
  transform: translate(-50%, -4px);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.97);
  color: #f8fafc;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.28);
  transition: opacity 160ms ease, transform 160ms ease;
}

[data-summary]:hover::after,
[data-summary]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .results-panel,
:root[data-theme="dark"] .summary-grid div,
:root[data-theme="dark"] pre {
  background: #111c2f;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] button {
  background: #0b1220;
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

:root[data-theme="dark"] .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #001017;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover { border-color: #98aaa5; }

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.primary:hover { background: var(--accent-strong); }

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.workspace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

h1, h2, p { margin: 0; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 15px; text-transform: uppercase; color: var(--muted); }

#save-status {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions.stacked { display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px; }

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  min-height: calc(100vh - 150px);
}

.form-panel {
  padding: 24px;
  border-right: 1px solid var(--line);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 22px 0 12px;
}

.section-head:first-child { margin-top: 0; }

.grid {
  display: grid;
  gap: 14px;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

input:focus, select:focus {
  outline: 2px solid rgba(24, 113, 91, 0.18);
  border-color: var(--accent);
}

.inline-action { align-self: end; }

.floor-count {
  display: flex;
  align-items: center;
  grid-template-columns: none;
  gap: 10px;
}

.floor-count input { width: 84px; }

.floors {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 12px;
}

.results-panel {
  padding: 24px;
  background: #f9fbfa;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.summary-grid strong { font-size: 20px; }

pre {
  min-height: 300px;
  white-space: pre-wrap;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: 14px/1.55 Consolas, "Courier New", monospace;
}

.warning {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #e6be76;
  border-radius: 6px;
  background: #fff7e8;
  color: var(--warn);
  font-weight: 700;
}

dialog {
  width: min(720px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(23, 33, 31, 0.38); }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 1050px) {
  .editor { grid-template-columns: 1fr; }
  .form-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1051px) {
  body { padding-left: 306px; }
  .suite-nav-shell {
    position: fixed;
    inset: 0 auto 0 0;
    width: 306px;
    overflow: hidden;
    border-right: 1px solid rgba(15, 23, 42, 0.12);
    border-bottom: 0;
  }
  .suite-nav-inner {
    display: flex;
    height: 100%;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    overflow-y: auto;
    padding: 18px 14px;
  }
  .suite-nav-brand {
    width: 100%;
    border-radius: 18px;
  }
  .suite-nav-mark {
    width: 58px;
    height: 54px;
    border-radius: 16px;
  }
  .suite-mark-facade {
    grid-template-columns: repeat(4, 8px);
    gap: 4px;
  }
  .suite-mark-facade i {
    height: 28px;
  }
  .suite-nav-links,
  .suite-nav-primary {
    display: grid;
    gap: 8px;
    align-items: stretch;
  }
  .suite-nav-primary-link,
  .suite-tools-mega summary {
    width: 100%;
    justify-content: space-between;
    border-radius: 12px;
  }
  .suite-tools-mega { position: static; }
  .suite-mega-panel {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-height: none;
    margin-top: 8px;
    border-radius: 14px;
    padding: 8px;
    box-shadow: none;
  }
  .suite-mega-column {
    border-radius: 12px;
    padding: 8px;
  }
  .suite-nav-menu-link {
    border-radius: 10px;
    padding: 9px 10px;
  }
  .theme-toggle {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    margin-top: auto;
  }
}

@media (max-width: 700px) {
  body { padding-left: 0; }
  .suite-nav-inner { grid-template-columns: 1fr; }
  .suite-nav-links { justify-content: flex-start; }
  .suite-mega-panel { position: static; grid-template-columns: 1fr; width: min(100%, 560px); margin-top: 10px; }
  .suite-nav-primary-link, .suite-tools-mega summary, .theme-toggle button { font-size: 11px; }
  .suite-nav-brand small { display: none; }
  .theme-toggle { width: fit-content; }
  .app-shell { padding: 12px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .grid.two, .grid.four, .floors, .summary-grid { grid-template-columns: 1fr; }
  .actions.stacked { grid-template-columns: 1fr; }
}
