:root {
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
  --c-primary: #2e3192;
  --c-secondary: #58595b;
  --c-accent: #6266e0;
  --c-bg: #121214;
  --c-surface: #1f1f24;
  --c-text: #ecebe8;
  --c-muted: #9c9ca3;
  --c-on: #ffffff;
}

body.app--client { color-scheme: light dark; }

h1, h2, h3 {
  font-family: Oswald, sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin: 0;
}

p { margin: 0; }

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; color: inherit; }

img { max-width: 100%; display: block; }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse at 80% 20%, rgba(98, 102, 224, 0.28), transparent 42%),
    linear-gradient(#2c2c33 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, #2c2c33 1px, transparent 1px) 0 0 / 48px 48px,
    #121214;
}

.auth-card {
  width: min(440px, 100%);
  background: rgba(31, 31, 36, 0.94);
  border: 1px solid #2c2c33;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;
  color: #2e3192;
  font-family: Oswald, sans-serif;
  font-weight: 700;
  text-decoration: none;
  overflow: hidden;
}

.mark img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  display: block;
}

.eyebrow {
  margin-top: 1rem;
  color: var(--c-accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-card h1, .hero-block h2 { font-size: 2rem; text-transform: uppercase; margin: 0.35rem 0 0.6rem; }
.lede, .muted, .fine { color: var(--c-muted); }
.fine { margin-top: 1.2rem; font-size: 0.9rem; }
.admin-entry {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.2rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  color: var(--c-text);
  font-weight: 600;
  text-decoration: none;
}
.admin-entry:hover { background: color-mix(in srgb, var(--c-text) 8%, transparent); text-decoration: none; }
.admin-entry__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--c-primary);
  color: var(--c-on);
  flex-shrink: 0;
}
.admin-entry__icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stack { display: grid; gap: 1rem; margin-top: 1.2rem; }
.stack > .btn { justify-self: start; }

.field, .check, .choice { display: grid; gap: 0.35rem; }
.field span, .color-field span { font-size: 0.92rem; font-weight: 600; }
.field small, .choice small, .name-cell small { color: var(--c-muted); font-weight: 400; }

input, textarea, select {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--c-text) 16%, transparent);
  background: color-mix(in srgb, var(--c-bg) 70%, var(--c-surface));
  border-radius: 10px;
  padding: 0.72rem 0.8rem;
}

textarea { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.72rem 1.2rem;
  background: var(--c-primary);
  color: var(--c-on);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--c-text); border-color: color-mix(in srgb, var(--c-text) 22%, transparent); }
.btn--block { width: 100%; }
.btn--small { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.form-error, .flash {
  border-radius: 12px;
  padding: 0.8rem 1rem;
  margin: 0 0 1rem;
}

.form-error, .flash--err { background: color-mix(in srgb, #e85d5d 18%, var(--c-surface)); color: var(--c-text); }
.flash--ok { background: color-mix(in srgb, #3dbe7a 18%, var(--c-surface)); }
.flash--warn { background: color-mix(in srgb, #e2b203 18%, var(--c-surface)); }

.app { min-height: 100vh; }
.nav-check { position: absolute; opacity: 0; pointer-events: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.2rem;
  background: var(--c-surface);
  border-right: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent);
  z-index: 30;
}

.lockup, .side-nav a, .name-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.lockup strong, .side-user strong { display: block; }
.lockup small, .side-user span { color: var(--c-muted); font-size: 0.82rem; }
.lockup .mark, .logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  flex-shrink: 0;
}

.side-nav { display: grid; gap: 0.25rem; }
.side-nav a {
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
}
.side-nav a[aria-current="page"], .mini__side .is-on {
  background: color-mix(in srgb, var(--c-primary) 18%, transparent);
}
.side-user { margin-top: auto; display: grid; gap: 0.35rem; }
.side-user .btn { margin-top: 0.4rem; }

.workspace { margin-left: 260px; min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 72px;
  padding: 0 1.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--c-text) 10%, transparent);
}
.topbar h1 { font-size: 1.45rem; text-transform: uppercase; }
.burger { display: none; }
.content { width: min(1100px, calc(100% - 3rem)); margin: 1.5rem auto 3rem; display: grid; gap: 1rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat, .panel, .card {
  background: var(--c-surface);
  border: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent);
  border-radius: 16px;
}
.stat { padding: 1.1rem 1.2rem; }
.stat strong { display: block; font-family: Oswald, sans-serif; font-size: 2rem; }
.stat span, .card p, .panel__head p { color: var(--c-muted); }
.panel { padding: 1.2rem 1.3rem 1.4rem; }
.panel__head, .page-actions, .inline-form, .suggest, .suggest__actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.panel__head { margin-bottom: 1rem; align-items: flex-start; flex-wrap: wrap; }
.panel__head p { flex: 1 0 100%; max-width: 68ch; }
.page-actions { justify-content: flex-start; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.table th, .table td { padding: 0.75rem 0.45rem; border-bottom: 1px solid color-mix(in srgb, var(--c-text) 10%, transparent); vertical-align: middle; }
.name-cell span { display: grid; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-text) 25%, transparent); }
.badge { border-radius: 999px; padding: 0.15rem 0.55rem; background: color-mix(in srgb, var(--c-text) 10%, transparent); font-size: 0.78rem; font-weight: 600; }
.badge--on { background: color-mix(in srgb, var(--c-primary) 22%, transparent); }

.form-grid, .color-grid, .choice-list, .cards { display: grid; gap: 0.9rem; }
.form-grid { grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: 1 / -1; }
.check, .choice { grid-template-columns: auto 1fr; align-items: start; }
.choice { padding: 0.8rem; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent); }
.choice span, .name-cell span { display: grid; }

.subnav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.subnav a {
  color: var(--c-text);
  border: 1px solid color-mix(in srgb, var(--c-text) 16%, transparent);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  text-decoration: none;
}

.brand-layout { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 1rem; align-items: start; }
.color-grid { grid-template-columns: 1fr 1fr; }
.color-field__row { display: flex; gap: 0.5rem; }
.color-field input[type="color"] { width: 52px; height: 42px; padding: 0.2rem; }
.mini {
  display: grid;
  grid-template-columns: 92px 1fr;
  min-height: 180px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--c-text) 16%, transparent);
  background: var(--c-bg);
  color: var(--c-text);
}
.mini__side, .mini__main { padding: 0.8rem; display: grid; align-content: start; gap: 0.45rem; }
.mini__side { background: var(--c-surface); font-size: 0.8rem; }
.mini__card { background: var(--c-surface); border-radius: 8px; padding: 0.45rem 0.55rem; }
.mini .btn { width: fit-content; padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.mini img, .logo-current { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 8px; }
.logo-current { width: 72px; height: 72px; }
.logo-form { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid color-mix(in srgb, var(--c-text) 10%, transparent); }
.suggest {
  margin-bottom: 1rem;
  padding: 0.9rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--c-primary) 12%, var(--c-surface));
}
.swatches { display: flex; gap: 0.35rem; margin-top: 0.55rem; }
.swatches i { width: 22px; height: 22px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.inline-form small { color: var(--c-muted); }

.hero-block h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); text-transform: uppercase; }
.cards { grid-template-columns: repeat(3, 1fr); }
.card { padding: 1.2rem; color: inherit; text-decoration: none; }
.card:hover { border-color: var(--c-accent); text-decoration: none; transform: translateY(-2px); }
.card h2 { font-size: 1.35rem; text-transform: uppercase; margin: 0.8rem 0 0.35rem; }
.card__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--c-primary);
  color: var(--c-on);
}
.module .card__icon { margin-bottom: 0.8rem; }
.note {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--c-primary) 10%, var(--c-surface));
}
.note p { color: var(--c-muted); margin-top: 0.25rem; }
.empty { padding: 0.4rem 0; }
.preview-banner {
  padding: 0.7rem 1.5rem;
  background: color-mix(in srgb, var(--c-accent) 18%, var(--c-surface));
}
.portal-note { margin-top: 0.5rem; }

.side-nav svg, .card__icon svg, .name-cell svg, .module .card__icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.scrim { display: none; }

@media (max-width: 960px) {
  .cards, .stats, .brand-layout { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-105%); transition: transform 0.2s ease; }
  .nav-check:checked ~ .sidebar { transform: none; }
  .nav-check:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 25; }
  .workspace { margin-left: 0; }
  .burger { display: inline-flex; border: 1px solid color-mix(in srgb, var(--c-text) 20%, transparent); border-radius: 999px; padding: 0.35rem 0.7rem; }
  .content { width: min(1100px, calc(100% - 1.5rem)); }
  .form-grid, .color-grid { grid-template-columns: 1fr; }
  .panel__head, .suggest { flex-direction: column; align-items: stretch; }
}

:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
