:root {
  color-scheme: light;
  --bg: #071013;
  --panel: #ffffff;
  --panel-soft: #f4f8f8;
  --line: #d4e0e2;
  --text: #203033;
  --muted: #657577;
  --brand: #ff1616;
  --brand-dark: #c80f14;
  --brand-2: #67d1cd;
  --brand-3: #ff1616;
  --danger: #b42318;
  --good: #0f7a4f;
  --warn: #b45309;
  --shadow: 0 24px 64px rgba(36, 41, 43, 0.14);
  --radius: 8px;
  --sidebar: 286px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(232, 243, 21, 0.07) 0 1px, transparent 1px 42px),
    linear-gradient(45deg, rgba(103, 209, 205, 0.06) 0 1px, transparent 1px 38px),
    linear-gradient(120deg, rgba(255, 22, 22, 0.13), transparent 24%, rgba(103, 209, 205, 0.1) 72%, transparent),
    var(--bg);
}

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

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
}

.login-visual {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 46px;
  color: #fff;
  background:
    linear-gradient(140deg, rgba(4, 9, 12, 0.98), rgba(13, 26, 29, 0.96) 52%, rgba(33, 10, 13, 0.92)),
    linear-gradient(90deg, rgba(232, 243, 21, 0.1), transparent 42%, rgba(103, 209, 205, 0.12));
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.login-visual::before {
  background:
    linear-gradient(90deg, rgba(103, 209, 205, 0.16) 1px, transparent 1px),
    linear-gradient(180deg, rgba(232, 243, 21, 0.1) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(110deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.24));
}

.login-visual::after {
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(232, 243, 21, 0.14) 28% 29%, transparent 29% 58%, rgba(103, 209, 205, 0.18) 58% 59%, transparent 59%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 8px);
  mix-blend-mode: screen;
}

.login-visual > * {
  position: relative;
  z-index: 1;
}

.login-visual h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(38px, 6vw, 82px);
  line-height: 0.95;
  letter-spacing: 0;
}

.login-visual p {
  max-width: 720px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 18px;
}

.tech-stage {
  position: absolute;
  inset: 92px 54px auto auto;
  width: min(38vw, 420px);
  aspect-ratio: 1.35;
  border: 1px solid rgba(103, 209, 205, 0.34);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(103, 209, 205, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(232, 243, 21, 0.12) 1px, transparent 1px),
    rgba(1, 8, 10, 0.48);
  background-size: 24px 24px;
  box-shadow: inset 0 0 34px rgba(103, 209, 205, 0.12), 0 24px 80px rgba(0, 0, 0, 0.22);
}

.tech-node,
.tech-line {
  position: absolute;
  display: grid;
  place-items: center;
}

.tech-node {
  width: 58px;
  height: 38px;
  border: 1px solid rgba(232, 243, 21, 0.66);
  border-radius: 6px;
  background: rgba(4, 9, 12, 0.92);
  color: #e8f315;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(232, 243, 21, 0.18);
}

.tech-node.core {
  left: 50%;
  top: 50%;
  width: 78px;
  height: 48px;
  transform: translate(-50%, -50%);
  border-color: rgba(103, 209, 205, 0.78);
  color: #ffffff;
}

.tech-node.node-a { left: 12%; top: 18%; }
.tech-node.node-b { right: 12%; top: 24%; }
.tech-node.node-c { right: 25%; bottom: 16%; }

.tech-line {
  height: 1px;
  transform-origin: left center;
  background: linear-gradient(90deg, transparent, rgba(103, 209, 205, 0.84), transparent);
}

.tech-line.line-a {
  left: 24%;
  top: 36%;
  width: 150px;
  transform: rotate(18deg);
}

.tech-line.line-b {
  left: 47%;
  top: 45%;
  width: 128px;
  transform: rotate(-14deg);
}

.tech-line.line-c {
  left: 52%;
  top: 62%;
  width: 112px;
  transform: rotate(32deg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-mark,
.avatar-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.brand-logo,
.document-brand-logo {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.brand-logo {
  width: 54px;
  height: 54px;
  padding: 5px;
}

.brand-logo img,
.document-brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 12px;
  max-width: 720px;
}

.metric-chip {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.metric-chip span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.metric-chip strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background: rgba(5, 17, 20, 0.76);
}

.login-card {
  width: min(100%, 520px);
  padding: 28px;
  border: 1px solid rgba(103, 209, 205, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.login-card h2,
.section-head h2,
.modal-card h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.login-card p,
.section-head p,
.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
}

.demo-users {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.demo-user-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel-soft);
  text-align: left;
}

.demo-user-button small {
  color: var(--muted);
  overflow-wrap: anywhere;
  text-align: right;
}

.login-user-select {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.login-user-select small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.person-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.person-cell > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.person-cell small {
  color: var(--muted);
}

.person-photo,
.account-photo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.account-photo {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.photo-fallback {
  display: grid;
  place-items: center;
  font-weight: 800;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

.field.full {
  grid-column: 1 / -1;
}

.field,
.inline-field {
  display: grid;
  gap: 6px;
}

.field span,
.inline-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field select,
.field textarea,
.inline-field input,
.inline-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.sample-toggle {
  display: none;
}

.sample-choice,
.sample-request-panel,
.sample-request-fields.full {
  grid-column: 1 / -1;
}

.sample-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--brand-dark);
  border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 68%, #fff), color-mix(in srgb, var(--brand-2) 26%, #fff));
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 38%, transparent);
}

.sample-choice input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand-3);
}

.sample-choice span {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

.sample-toggle:checked + .sample-choice,
.sample-choice:has(input:checked) {
  border-color: var(--brand-3);
  background: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}

.sample-request-fields {
  display: none;
}

.sample-toggle:checked ~ .sample-request-fields {
  display: grid;
}

.sample-request-panel {
  padding: 12px;
  border: 1px solid var(--brand-dark);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand) 12%, #fff);
}

.portal-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(103, 209, 205, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(232, 243, 21, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, #f7fbfb 0%, #edf4f3 56%, #f9fbf0 100%);
  background-size: 38px 38px, 38px 38px, auto;
}

.portal-shell.theme-dv {
  --brand: #e8f315;
  --brand-dark: #b8c400;
  --brand-2: #88b7b4;
  --brand-3: #020202;
  --good: #4f9b6d;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 22, 22, 0.12), transparent 24%),
    linear-gradient(165deg, #3a3f42 0%, #24292b 58%, #171b1d 100%);
  color: #fff;
  overflow-y: auto;
}

.theme-dv .sidebar {
  background:
    linear-gradient(180deg, rgba(232, 243, 21, 0.16), transparent 28%),
    linear-gradient(120deg, transparent 0 42%, rgba(136, 183, 180, 0.22) 42% 43%, transparent 43%),
    linear-gradient(165deg, #030303 0%, #101111 58%, #020202 100%);
}

.theme-dv .brand-logo,
.theme-dv .document-brand-logo {
  background: #020202;
  border-color: rgba(232, 243, 21, 0.42);
}

.theme-dv .brand-logo {
  box-shadow: 0 10px 28px rgba(232, 243, 21, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 18px;
}

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

.brand small,
.account-card small,
.side-note {
  color: rgba(255, 255, 255, 0.68);
}

.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.account-card > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.account-card .role-tag {
  justify-self: start;
}

.avatar-mark {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  background: var(--brand);
}

.role-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 22, 22, 0.18);
  color: #ffd7d7;
  font-size: 12px;
  font-weight: 800;
}

.theme-dv .role-tag {
  background: rgba(232, 243, 21, 0.16);
  color: #f2ff24;
}

.theme-dv .primary-button {
  background: var(--brand);
  color: #050505;
  border-color: var(--brand);
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.theme-dv .nav button.active,
.theme-dv .nav button:hover {
  color: #f7ff57;
  background: rgba(232, 243, 21, 0.12);
  box-shadow: inset 3px 0 0 var(--brand);
}

.nav-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.theme-dv .nav-mark {
  background: rgba(136, 183, 180, 0.22);
  color: #f2ff24;
}

.side-note {
  margin-top: auto;
  padding-top: 18px;
  font-size: 13px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  max-width: 100%;
  padding: 24px;
  position: relative;
}

.workspace::before {
  content: "";
  position: fixed;
  inset: 0 0 auto var(--sidebar);
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--brand-3));
  opacity: 0.9;
  pointer-events: none;
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: var(--radius);
  padding: 9px 13px;
  border: 1px solid transparent;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.secondary-button {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.theme-dv .secondary-button {
  border-color: rgba(136, 183, 180, 0.52);
  color: #263f3d;
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

.danger-button {
  background: #fff1f0;
  color: var(--danger);
  border-color: #fecaca;
}

.view {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
}

.section,
.stat-card,
.table-panel,
.form-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(29, 41, 55, 0.06);
}

.section {
  padding: 18px;
  min-width: 0;
  max-width: 100%;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head.compact {
  margin-bottom: 0;
}

.grid {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

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

.two-col {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  padding: 16px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.stat-card small {
  color: var(--muted);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.switch-row strong {
  display: block;
}

.switch-row small {
  color: var(--muted);
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
}

.toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.toggle span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: 0.18s ease;
}

.toggle span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: 0.18s ease;
}

.toggle input:checked + span {
  background: var(--brand-2);
}

.toggle input:checked + span::after {
  transform: translateX(20px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f2f1;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 900;
}

.pill.warn {
  background: #fff7ed;
  color: var(--warn);
}

.pill.good {
  background: #ecfdf5;
  color: var(--good);
}

.pill.danger {
  background: #fff1f0;
  color: var(--danger);
}

.help-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.catalog-card-grid,
.image-library-grid,
.product-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.catalog-card,
.image-library-card,
.model-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.catalog-card-media,
.preview-image {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 190px;
  background: #f3f5f5;
}

.catalog-card-media img,
.preview-image img,
.image-library-card img,
.model-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-image.horizontal-config-image {
  min-height: 280px;
}

.preview-image.horizontal-config-image img {
  width: 72%;
  height: 72%;
  max-width: 260px;
  max-height: 260px;
  transform: rotate(90deg);
  transform-origin: center;
}

.catalog-card-media span {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(36, 41, 43, 0.82);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.catalog-card-body,
.image-library-card,
.model-card > div {
  padding: 14px;
}

.catalog-card-body h3,
.model-card h3 {
  margin: 8px 0;
  font-size: 18px;
}

.catalog-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.catalog-specs div {
  padding: 8px;
  border-radius: 6px;
  background: var(--panel-soft);
}

.catalog-specs dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.catalog-specs dd {
  margin: 3px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.color-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
  vertical-align: -2px;
}

.catalog-card-price {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}

.catalog-card-price span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.muted-price {
  color: var(--muted);
}

.configurator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.configurator-preview {
  position: sticky;
  top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  overflow: hidden;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.summary-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-item strong {
  display: block;
  margin-top: 4px;
}

.color-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-strip button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(0, 0, 0, 0.24);
  border-radius: 999px;
  background: var(--swatch);
  color: var(--swatch-text);
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.color-strip button:hover {
  transform: translateY(-1px);
}

.color-strip button.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--brand), 0 6px 16px rgba(0, 0, 0, 0.18);
}

.material-link {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.config-subsection {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.subsection-head,
.fence-segment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.subsection-head strong,
.fence-segment-head strong {
  display: block;
}

.subsection-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.fence-segment-grid,
.gate-grid {
  display: grid;
  gap: 12px;
}

.fence-segment-card,
.gate-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.segment-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.segment-result-grid .summary-item {
  padding: 8px;
}

.image-library-card {
  display: grid;
  gap: 10px;
}

.image-library-card img {
  height: 170px;
  border-radius: 6px;
  background: var(--panel-soft);
}

.image-library-card strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.model-card {
  display: grid;
  grid-template-rows: 210px auto;
}

.model-card > img {
  padding: 12px;
  background: var(--panel-soft);
}

.db-cell-input {
  width: 160px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.permission-lock {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}

.permission-lock strong {
  display: block;
  font-size: 22px;
}

.permission-lock p {
  color: var(--muted);
}

.ai-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  display: grid;
  justify-items: end;
  gap: 10px;
  pointer-events: none;
}

.ai-chat-toggle,
.ai-chat-panel {
  pointer-events: auto;
}

.ai-chat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid rgba(103, 209, 205, 0.46);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: #051114;
  color: #fff;
  box-shadow: 0 18px 48px rgba(4, 12, 14, 0.28);
}

.ai-pulse,
.ai-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand);
  color: #050505;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 0 0 4px rgba(232, 243, 21, 0.18);
}

.ai-pulse::before {
  content: "AI";
}

.ai-chat-panel {
  display: none;
  width: min(380px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid rgba(103, 209, 205, 0.32);
  border-radius: var(--radius);
  background: rgba(5, 17, 20, 0.97);
  color: #fff;
  box-shadow: 0 28px 84px rgba(0, 0, 0, 0.4);
}

.ai-chat.open .ai-chat-panel {
  display: grid;
}

.ai-chat-panel header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid rgba(103, 209, 205, 0.22);
  background:
    linear-gradient(90deg, rgba(232, 243, 21, 0.12), transparent),
    linear-gradient(135deg, rgba(103, 209, 205, 0.14), transparent 60%);
}

.ai-chat-panel header div {
  display: grid;
  min-width: 0;
  margin-right: auto;
}

.ai-chat-panel header small {
  color: rgba(255, 255, 255, 0.62);
}

.ghost-button.compact {
  min-height: 32px;
  padding: 6px 9px;
  color: rgba(255, 255, 255, 0.74);
}

.ai-chat-messages {
  display: grid;
  gap: 8px;
  max-height: 310px;
  padding: 12px;
  overflow: auto;
}

.ai-message {
  width: fit-content;
  max-width: 92%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.45;
}

.ai-message.user {
  justify-self: end;
  background: var(--brand);
  color: #050505;
  font-weight: 700;
}

.ai-suggestions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
  overflow-x: auto;
}

.ai-suggestions button {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid rgba(103, 209, 205, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 800;
}

.ai-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(103, 209, 205, 0.2);
}

.ai-chat-form input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid rgba(103, 209, 205, 0.36);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.18s ease;
  z-index: 50;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.document-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.document-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 27, 29, 0.58);
}

.document-panel {
  position: relative;
  width: min(900px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: var(--radius);
  background: #eef2f1;
  box-shadow: var(--shadow);
}

.document-actions {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.document-page {
  display: grid;
  gap: 10px;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 12mm;
  box-sizing: border-box;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.document-head,
.document-grid,
.document-total {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.document-head {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.5fr);
  border-bottom: 2px solid var(--brand);
  padding-bottom: 10px;
}

.document-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.document-brand-logo {
  width: 56px;
  height: 56px;
  padding: 6px;
  border-color: var(--line);
  box-shadow: none;
}

.document-head h2 {
  margin: 0;
  font-size: 20px;
}

.document-head small,
.document-grid small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.document-grid > div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.document-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.document-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.document-table th,
.document-table td {
  padding: 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.document-table th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.document-total {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.document-page .summary-item {
  padding: 7px;
}

.document-page .summary-item span {
  font-size: 10px;
}

.document-page .summary-item strong {
  font-size: 12px;
}

.document-page .help-text {
  margin-top: 0;
  font-size: 11px;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body > *:not(.app) {
    display: none !important;
  }

  body,
  .app,
  .portal-shell {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .portal-shell > .sidebar,
  .portal-shell > .workspace,
  .document-backdrop,
  .document-actions {
    display: none !important;
  }

  .document-modal {
    position: static;
    display: block;
    padding: 0;
  }

  .document-panel {
    width: 210mm;
    max-height: none;
    margin: 0;
    overflow: visible;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }

  .document-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 12mm;
    page-break-after: avoid;
  }

  .document-head,
  .document-grid,
  .document-table,
  .document-total,
  .document-page .help-text {
    break-inside: avoid;
  }
}

@media (max-width: 980px) {
  .login-screen,
  .portal-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 360px;
  }

  .tech-stage {
    position: relative;
    inset: auto;
    width: min(100%, 420px);
    margin: 22px 0;
  }

  .login-metrics,
  .stats-grid,
  .two-col,
  .three-col,
  .configurator-layout,
  .segment-result-grid,
  .permission-grid,
  .field-grid.two {
    grid-template-columns: 1fr;
  }

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

  .configurator-preview {
    position: static;
  }

  .sidebar {
    position: static;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    overflow: visible;
  }

  .brand,
  .account-card {
    align-items: center;
  }

  .nav {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 14px 0 0;
    padding: 0 0 4px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .nav button {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .side-note {
    display: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .workspace::before {
    left: 0;
  }

}

@media (max-width: 620px) {
  body {
    overflow-x: hidden;
  }

  .login-screen {
    min-height: auto;
  }

  .login-visual {
    min-height: auto;
  }

  .tech-stage {
    aspect-ratio: 1.25;
  }

  .login-visual h1 {
    font-size: 30px;
    line-height: 1.02;
  }

  .login-visual p {
    font-size: 15px;
  }

  .login-metrics,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .workspace,
  .login-panel,
  .login-visual {
    padding: 16px;
  }

  .sidebar {
    padding: 14px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .account-card {
    padding: 10px;
  }

  .workspace {
    padding-top: 16px;
  }

  .section,
  .config-subsection,
  .fence-segment-card,
  .gate-card {
    padding: 12px;
  }

  .section-head {
    flex-direction: column;
  }

  .section-head h2,
  .login-card h2 {
    font-size: 21px;
  }

  .login-card {
    padding: 16px;
    box-shadow: 0 10px 28px rgba(36, 41, 43, 0.12);
  }

  .demo-users {
    max-height: 220px;
    margin: 14px 0;
  }

  .demo-user-button {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .demo-user-button small {
    width: 100%;
    text-align: left;
  }

  .person-cell {
    width: 100%;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .form-actions,
  .record-actions,
  .topbar-actions {
    width: 100%;
  }

  .form-actions > *,
  .record-actions > *,
  .topbar-actions > * {
    flex: 1 1 auto;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    min-width: 0;
    white-space: normal;
  }

  .table-wrap {
    margin-inline: -12px;
    width: calc(100% + 24px);
  }

  .data-table {
    min-width: 760px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }

  .catalog-card-grid,
  .image-library-grid,
  .product-model-grid {
    grid-template-columns: 1fr;
  }

  .color-strip {
    flex-wrap: nowrap;
    margin-inline: -12px;
    padding-inline: 12px;
    overflow-x: auto;
  }

  .color-strip button {
    flex: 0 0 auto;
  }

  .summary-grid,
  .segment-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-panel {
    width: 100%;
  }

  .ai-chat {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .ai-chat-toggle {
    width: 100%;
    justify-content: center;
  }

  .ai-chat.open .ai-chat-panel {
    width: 100%;
  }

  .ai-chat-form {
    grid-template-columns: 1fr;
  }
}
