:root {
  color-scheme: dark;
  --font-body: "Segoe UI Variable", "Segoe UI", Tahoma, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --bg: #07161a;
  --bg-alt: #0e252b;
  --surface: rgba(8, 30, 35, 0.84);
  --surface-strong: rgba(10, 37, 43, 0.96);
  --line: rgba(163, 208, 200, 0.14);
  --line-strong: rgba(163, 208, 200, 0.24);
  --text: #ecf4ef;
  --muted: #9eb5ad;
  --accent: #76e0c2;
  --accent-strong: #15aa83;
  --warn: #ffb460;
  --danger: #ff7a7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe5;
  --bg-alt: #ece2d0;
  --surface: rgba(255, 250, 243, 0.78);
  --surface-strong: rgba(255, 252, 247, 0.92);
  --line: rgba(24, 80, 74, 0.12);
  --line-strong: rgba(24, 80, 74, 0.22);
  --text: #18352f;
  --muted: #5f716d;
  --accent: #00745b;
  --accent-strong: #0f5d4c;
  --warn: #b47017;
  --danger: #bd3d3d;
  --shadow: 0 24px 60px rgba(66, 46, 14, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(118, 224, 194, 0.16), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(255, 180, 96, 0.18), transparent 24%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-alt) 100%);
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 92%);
}

.shell {
  width: min(1180px, calc(100vw - 1.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.masthead,
.band {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: start;
  padding: 1.5rem;
  border-radius: 18px;
}

.masthead h1,
.summary-copy h2,
.section-heading h2,
.auth-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.lead,
.support-copy,
.auth-copy p {
  margin: 0.75rem 0 0;
  max-width: 56rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.kicker {
  margin: 0 0 0.6rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.masthead-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #06241c;
  padding: 0.88rem 1.2rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

body[data-theme="light"] .action-button {
  color: #f5f3ea;
}

body[data-theme="light"] .action-button.ghost {
  color: var(--text);
  background: rgba(24, 80, 74, 0.05);
  border-color: rgba(24, 80, 74, 0.18);
}

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

.action-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.action-button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.locale-button {
  min-width: 4.5rem;
}

.action-button.wide {
  width: 100%;
}

.dashboard {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.auth-band {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(18rem, 28rem);
  gap: 1.2rem;
  margin-top: 1rem;
  padding: 1.3rem;
  border-radius: 18px;
}

.auth-form,
.stack-form {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  padding: 0.9rem 1rem;
}

body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea {
  background: rgba(255, 255, 255, 0.76);
}

textarea {
  resize: vertical;
}

.status-text {
  min-height: 1.4rem;
  margin: 0;
  color: var(--warn);
}

.summary-band,
.primary-band,
.content-band,
.admin-band {
  border-radius: 18px;
  padding: 1.3rem;
}

.summary-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.summary-stats,
.detail-grid,
.admin-grid,
.three-up,
.two-up {
  display: grid;
  gap: 0.8rem;
}

.summary-stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-chip,
.detail-block,
.entry-card,
.admin-panel,
.user-card {
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.stat-chip,
.detail-block {
  border-radius: 14px;
  padding: 1rem;
}

.stat-chip span,
.detail-block span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.stat-chip strong,
.detail-block strong {
  font-size: 1.05rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.content-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.content-column {
  min-width: 0;
}

.entry-list,
.user-list {
  display: grid;
  gap: 0.8rem;
}

.entry-card,
.admin-panel,
.user-card {
  border-radius: 14px;
  padding: 1rem;
}

.entry-card h3,
.user-card h3,
.admin-panel h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.entry-meta,
.user-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-body,
.guide-body,
.secret-value,
.support-text {
  line-height: 1.7;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entry-body,
.support-text,
.secret-value {
  white-space: pre-wrap;
}

.guide-body {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: var(--surface-strong);
}

.guide-body h2,
.guide-body h3 {
  font-family: var(--font-display);
  margin-top: 0;
}

.guide-body p,
.guide-body li {
  color: var(--text);
}

.guide-body ol {
  padding-left: 1.3rem;
}

.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 1rem;
}

.three-up {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.two-up {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact {
  align-items: end;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text);
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.user-card {
  display: grid;
  gap: 0.85rem;
}

.user-card header,
.secret-header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: start;
  min-width: 0;
}

.mini-actions,
.secret-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.mini-actions button,
.secret-actions button {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.detail-block h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.detail-block p {
  margin: 0;
}

.secret-value.is-blurred {
  filter: blur(7px);
  user-select: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.82rem;
  text-transform: capitalize;
}

.status-pill.online {
  color: var(--accent);
}

.status-pill.offline,
.status-pill.invalid {
  color: var(--danger);
}

.status-pill.unknown {
  color: var(--warn);
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .masthead,
  .auth-band,
  .summary-band,
  .content-band,
  .summary-stats {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .user-card header,
  .secret-header {
    align-items: start;
    flex-direction: column;
  }

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

@media (max-width: 640px) {
  .shell {
    width: calc(100vw - 1rem);
    padding-top: 0.75rem;
  }

  .masthead,
  .auth-band,
  .summary-band,
  .primary-band,
  .content-band,
  .admin-band {
    padding: 1rem;
    border-radius: 16px;
  }

  .masthead h1,
  .summary-copy h2,
  .section-heading h2,
  .auth-copy h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .masthead-actions {
    width: 100%;
  }

  .masthead-actions .action-button {
    flex: 1 1 8rem;
    text-align: center;
  }

  .secret-actions,
  .mini-actions {
    width: 100%;
  }

  .secret-actions button,
  .mini-actions button {
    flex: 1 1 9rem;
    text-align: center;
  }
}
