:root {
  --forest: #102d26;
  --forest-light: #1f463b;
  --blush: #d6c0c1;
  --blush-light: #eadcdb;
  --gold: #b58b4b;
  --cream: #f6f0e9;
  --ink: #18322b;
  --muted: #6f7d78;
  --paper: #fffaf4;
  --line: #d8cfc4;
  --danger: #8d403f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", sans-serif;
}
h1, h2, h3, strong, .brand { font-family: "Manrope", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 .55rem;
  color: var(--gold);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.button {
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: .75rem 1rem;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font-weight: 600;
  transition: 160ms ease;
}
.button:hover { background: var(--blush-light); }
.button:disabled { cursor: wait; opacity: .6; }
.button-primary {
  display: inline-flex;
  justify-content: center;
  border-color: var(--gold);
  background: var(--forest);
  color: var(--blush-light);
}
.button-primary:hover { background: var(--forest-light); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--forest);
  color: var(--blush-light);
}
.login-shell {
  width: min(1120px, calc(100% - 3rem));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: center;
}
.login-copy h1 {
  margin: 0;
  font-size: clamp(4rem, 9vw, 8rem);
  line-height: .82;
  letter-spacing: -.08em;
}
.login-copy h1 span { color: var(--blush); }
.login-copy > p:not(.eyebrow) {
  max-width: 34rem;
  margin-top: 2rem;
  color: var(--blush-light);
  font-size: 1.1rem;
  line-height: 1.7;
}
.login-copy > p.login-error:not(.eyebrow) {
  margin-top: 1.25rem;
  padding: .8rem 1rem;
  border: 1px solid var(--gold);
  border-radius: .75rem;
  background: rgba(181, 139, 75, .14);
  color: var(--cream);
}
.tool-visual { position: relative; aspect-ratio: 1; display: grid; place-items: center; }
.spanner-mark {
  z-index: 2;
  width: 9rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 5px solid var(--gold);
  border-radius: 4px;
  transform: rotate(-7deg);
  background: var(--blush);
  color: var(--forest);
  font: 600 5rem "Manrope";
  box-shadow: 14px 14px 0 rgba(0, 0, 0, .14);
}
.orbit { position: absolute; border: 1px solid rgba(214, 192, 193, .32); border-radius: 50%; }
.orbit-one { inset: 12%; }
.orbit-two { inset: 1%; border-style: dashed; }
.metric-chip {
  position: absolute;
  z-index: 3;
  min-width: 9rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: rgba(31, 70, 59, .92);
}
.metric-chip strong, .metric-chip span { display: block; }
.metric-chip strong { color: var(--blush); font-size: 1.5rem; }
.metric-chip span { color: var(--blush-light); font-size: .8rem; }
.metric-one { top: 12%; right: 0; }
.metric-two { bottom: 10%; left: 0; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 18rem;
  display: flex;
  flex-direction: column;
  border-right: 6px solid var(--gold);
  background: var(--forest);
  color: var(--blush-light);
}
.brand {
  min-height: 5.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(214, 192, 193, .16);
  font-size: 1.25rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.brand > span {
  width: 2.25rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: var(--blush);
  color: var(--forest);
}
.server-picker { padding: 1.25rem 1.25rem .75rem; }
.server-picker label {
  display: block;
  margin-bottom: .45rem;
  color: var(--blush);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.server-picker select {
  width: 100%;
  border: 1px solid rgba(214, 192, 193, .38);
  border-radius: 4px;
  padding: .7rem;
  background: var(--forest-light);
  color: white;
}
.sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: .4rem 1rem 1.5rem;
  scrollbar-color: var(--gold) transparent;
}
.nav-group {
  margin: 1.3rem .6rem .45rem;
  color: var(--blush);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: .7rem;
  align-items: center;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
  padding: .65rem .65rem;
  background: transparent;
  color: rgba(234, 220, 219, .72);
  cursor: pointer;
  text-align: left;
  transition: 150ms ease;
}
.nav-item:hover { color: white; background: rgba(214, 192, 193, .08); }
.nav-item.active {
  border-left-color: var(--gold);
  background: rgba(214, 192, 193, .12);
  color: white;
}
.nav-mark { color: var(--gold); font: 500 .65rem "Manrope"; letter-spacing: .08em; }
.profile {
  min-height: 4.8rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: .85rem 1.2rem;
  border-top: 1px solid rgba(214, 192, 193, .16);
}
.avatar {
  width: 2.5rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--blush);
  color: var(--forest);
  font-weight: 600;
}
.profile strong, .profile span { display: block; font-size: .8rem; }
.profile span { color: var(--blush); }

.dashboard { margin-left: 18rem; padding: 3rem clamp(1.5rem, 5vw, 5rem) 6rem; }
.dashboard-header, .panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
}
.dashboard-header h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  letter-spacing: -.06em;
  line-height: .95;
}
.status-pill {
  padding: .65rem .9rem;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--blush-light);
  color: var(--danger);
  font-size: .78rem;
  font-weight: 600;
}
.status-pill.online { background: var(--forest); color: var(--blush-light); }
.install-banner {
  margin-top: 2rem;
  padding: 1.2rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--blush-light);
  box-shadow: 8px 8px 0 rgba(181, 139, 75, .14);
}
.install-banner p { margin: .25rem 0 0; color: var(--muted); }
.empty-state {
  margin-top: 5rem;
  padding: 4rem 2rem;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--paper);
  text-align: center;
}
.empty-state h2 { margin: 0; }
.empty-state > p:last-child { color: var(--muted); }

.dashboard-panel { display: none; margin-top: 4rem; }
.dashboard-panel.active { display: block; }
.panel-heading { margin-bottom: 1.5rem; }
.panel-heading h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -.04em; }
.panel-heading p:last-child { max-width: 44rem; margin: .55rem 0 0; color: var(--muted); line-height: 1.6; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stats article {
  min-height: 10rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--blush);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .06);
}
.stats span, .stats small { color: var(--forest-light); }
.stats strong { margin: auto 0 .25rem; font-size: 2rem; }
.data-card, .control-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.data-card { margin-top: 2rem; padding: 1.4rem; }
.data-card h3 { margin: 0; }
.data-card > p { color: var(--muted); line-height: 1.65; }
.data-card code { color: var(--forest); font-weight: 600; }
.table-key { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.table-key span { padding: .75rem; border-right: 1px solid var(--line); color: var(--forest); font-family: monospace; }
.table-key span:last-child { border-right: 0; }
.section-state {
  padding: 1.1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-color: var(--gold);
}
.section-state strong, .section-state small { display: block; }
.section-state small { margin-top: .35rem; color: var(--muted); }
.settings-grid, .role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.field-control, .control-card {
  padding: 1.15rem;
}
.field-control {
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.field-control > span, .control-card > span {
  display: block;
  margin-bottom: .35rem;
  font-weight: 600;
}
.field-control small, .control-card small {
  display: block;
  margin-bottom: .7rem;
  color: var(--muted);
  line-height: 1.45;
}
.field-control input, .field-control select, .field-control textarea,
.role-grid select, .access-controls select, .manager-field input,
.manager-field textarea, .record-actions input, .record-actions select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: .7rem;
  outline: 0;
  background: white;
  color: var(--ink);
}
.field-control textarea, .manager-field textarea { resize: vertical; }
.field-control input:focus, .field-control select:focus,
.field-control textarea:focus, .role-grid select:focus,
.access-controls select:focus, .manager-field input:focus,
.manager-field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(181, 139, 75, .14);
}
.checkbox-control { display: flex; align-items: center; gap: .8rem; }
.checkbox-control > span { margin: 0; }
.checkbox-control input { width: auto; accent-color: var(--forest); }
.role-grid select { min-height: 14rem; }
.role-grid option { padding: .45rem; }
.empty-controls { grid-column: 1 / -1; }
.empty-controls strong, .empty-controls small { display: block; }
.section-access { margin-top: 1rem; }
.section-access > div:first-child strong, .section-access > div:first-child small {
  display: block;
}
.section-access > div:first-child small { margin-top: .35rem; }
.access-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.access-controls label > span, .manager-field > span {
  display: block;
  margin-bottom: .35rem;
  font-weight: 600;
}
.access-controls label > small {
  display: block;
  min-height: 2.8rem;
  color: var(--muted);
}
.access-controls select[multiple] { min-height: 10rem; }
.device-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.settings-column, .designer-fields { display: grid; gap: 1rem; }
.designer-column {
  padding: 1rem;
  border: 1px solid var(--gold);
  background: var(--blush-light);
}
.device-preview {
  margin-top: 1rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-left: .4rem solid #57f287;
  border-radius: 4px;
  background: #fff;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .06);
}
.device-preview > small { color: var(--muted); letter-spacing: .1em; }
.device-preview h3 { margin: .6rem 0 1rem; }
.management-card { margin-top: 1rem; }
.management-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.management-heading p { margin: .35rem 0 0; color: var(--muted); }
[data-manager-content] { display: grid; gap: 1rem; }
.record-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--cream);
}
.record-card > div:first-child strong, .record-card > div:first-child small,
.record-card > small { display: block; }
.record-card details { margin: .8rem 0; }
.record-card pre, .code-grid pre {
  max-width: 100%;
  overflow: auto;
  padding: .8rem;
  background: var(--forest);
  color: var(--cream);
}
.record-actions { display: flex; gap: .6rem; align-items: center; margin-top: .8rem; }
.record-actions input { flex: 1; }
.note-editor { display: grid; gap: .8rem; }
.manager-field { display: block; }
.code-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.code-grid pre { margin: 0; white-space: pre-wrap; }
.button-danger { border-color: var(--danger); color: var(--danger); }
.muted { color: var(--muted); }
.disabled-panel { opacity: .5; pointer-events: none; }
.switch { position: relative; flex: 0 0 auto; width: 3.2rem; height: 1.75rem; }
.switch input { position: absolute; opacity: 0; }
.switch span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--blush-light);
  cursor: pointer;
  transition: .2s;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 1.2rem;
  aspect-ratio: 1;
  top: .22rem;
  left: .25rem;
  border-radius: 50%;
  background: var(--forest);
  transition: .2s;
}
.switch input:checked + span { border-color: var(--gold); background: var(--forest-light); }
.switch input:checked + span::after { transform: translateX(1.35rem); background: var(--blush); }
.toast {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 100;
  max-width: min(28rem, calc(100% - 4rem));
  padding: .85rem 1.2rem;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--forest);
  color: var(--blush-light);
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
  transition: .2s;
}
.toast.show { opacity: 1; transform: none; }

.policy-page { width: min(760px, calc(100% - 3rem)); margin: 0 auto; padding: 4rem 0 6rem; }
.policy-page .brand { width: fit-content; min-height: auto; margin-bottom: 5rem; padding: 0; color: var(--forest); }
.policy-page h1 { margin: 0 0 2rem; font-size: clamp(2.8rem, 7vw, 5rem); line-height: .95; letter-spacing: -.06em; }
.policy-page h2 { margin: 2.5rem 0 .6rem; }
.policy-page p { color: var(--muted); line-height: 1.75; }

@media (max-width: 1050px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .tool-visual { display: none; }
  .sidebar { position: static; width: 100%; max-height: none; border-right: 0; border-bottom: 6px solid var(--gold); }
  .sidebar nav { max-height: 18rem; }
  .profile { display: none; }
  .dashboard { margin-left: 0; }
  .settings-grid, .role-grid, .access-controls, .device-workspace,
  .code-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .login-copy h1 { font-size: 4rem; }
  .dashboard { padding: 2rem 1rem 4rem; }
  .dashboard-header, .panel-heading, .install-banner { align-items: flex-start; flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .table-key { grid-template-columns: 1fr; }
  .table-key span { border-right: 0; border-bottom: 1px solid var(--line); }
}
