:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #66716a;
  --line: #d7ddd8;
  --surface: #ffffff;
  --band: #f3f6f2;
  --field: #ffffff;
  --topbar: rgba(255, 255, 255, 0.94);
  --danger-bg: #fff2f0;
  --danger-line: #f0b4aa;
  --danger-text: #8d2417;
  --accent: #176b5f;
  --accent-dark: #0f4a43;
  --gold: #c8902f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eff5f1;
  --muted: #a9b7ad;
  --line: #2e3b34;
  --surface: #121a16;
  --band: #0b100d;
  --field: #0e1511;
  --topbar: rgba(14, 21, 17, 0.94);
  --danger-bg: #321613;
  --danger-line: #7f3227;
  --danger-text: #ffd0c8;
  --accent: #4fb9a6;
  --accent-dark: #8be0d1;
  --gold: #e0b25c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--band);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }

input, textarea, button {
  font: inherit;
}

.topbar {
  align-items: center;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 64px;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 1.08rem;
  font-weight: 800;
}

.nav {
  align-items: center;
  display: flex;
  gap: 18px;
}

.nav form { margin: 0; }

.link-button {
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}

.theme-toggle {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
}

.button:hover { background: var(--accent-dark); }

.button.secondary {
  background: transparent;
  color: var(--accent-dark);
}

.button.small {
  min-height: 36px;
  padding-inline: 14px;
}

.hero-home {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(15, 24, 20, 0.78), rgba(15, 24, 20, 0.22)),
    url("default-banner.svg") center/cover;
  color: #fff;
  display: flex;
  min-height: calc(100vh - 160px);
  padding: clamp(38px, 8vw, 86px);
}

.hero-copy {
  max-width: 660px;
}

h1, h2 {
  letter-spacing: 0;
  line-height: 1.03;
  margin: 0;
}

.hero-copy h1 {
  font-size: clamp(3rem, 9vw, 7rem);
}

.hero-copy p {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  line-height: 1.55;
  max-width: 560px;
}

.actions, .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.section, .dashboard, .customizer {
  margin: 0 auto;
  max-width: 1180px;
  padding: clamp(24px, 5vw, 56px);
}

.section.narrow { max-width: 820px; }

.dashboard {
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.panel.compact { align-self: start; }

.auth-shell {
  display: grid;
  min-height: calc(100vh - 64px);
  padding: 32px;
  place-items: center;
}

.auth-shell .panel {
  max-width: 440px;
  width: 100%;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.92rem;
  font-weight: 700;
  gap: 8px;
  margin: 18px 0;
}

input, textarea {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

textarea { resize: vertical; }

.error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  border-radius: 8px;
  color: var(--danger-text);
  padding: 12px;
}

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

.portal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 20px;
}

.portal-card span {
  font-size: 1.1rem;
  font-weight: 800;
}

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

.card-title {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.card-title img {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 36px;
  object-fit: contain;
  padding: 5px;
  width: 36px;
}

.card-title span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-actions {
  margin-top: auto;
}

.card-actions a {
  color: var(--accent-dark);
  font-weight: 800;
}

.preview-wrap {
  margin-bottom: 24px;
}

.portal-hero {
  background-image:
    linear-gradient(90deg, rgba(15, 24, 20, var(--overlay)), rgba(15, 24, 20, calc(var(--overlay) * 0.55))),
    var(--desktop-banner);
  background-position: center, var(--focal-x) var(--focal-y);
  background-size: cover;
  color: #fff;
  min-height: min(620px, calc(100vh - 96px));
  position: relative;
}

.portal-hero.public {
  align-items: end;
  display: flex;
  padding: clamp(32px, 8vw, 80px);
}

.editable-hero {
  align-items: end;
  border-radius: 8px;
  cursor: crosshair;
  display: flex;
  min-height: 440px;
  overflow: hidden;
  padding: clamp(22px, 5vw, 52px);
}

.portal-hero-content {
  max-width: 780px;
}

.portal-hero-content p {
  font-weight: 850;
  margin: 0;
  text-transform: uppercase;
}

.portal-mark {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
}

.portal-mark img {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  height: clamp(44px, 7vw, 72px);
  object-fit: contain;
  padding: 8px;
  width: clamp(44px, 7vw, 72px);
}

.portal-hero-content h1 {
  font-size: clamp(2.6rem, 8vw, 6.4rem);
  overflow-wrap: anywhere;
}

.portal-hero-content span {
  display: block;
  font-size: clamp(1rem, 2vw, 1.32rem);
  line-height: 1.5;
  margin-top: 18px;
  max-width: 640px;
}

.editor-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
}

.dropzone {
  align-items: center;
  border: 1px dashed #9aa8a0;
  border-radius: 8px;
  color: var(--accent-dark);
  cursor: pointer;
  justify-content: center;
  min-height: 92px;
  padding: 18px;
}

.dropzone input {
  border: 0;
  min-height: auto;
  padding: 8px 0 0;
}

.range-grid {
  display: grid;
  gap: 10px;
}

input[type="range"] {
  accent-color: var(--gold);
  padding: 0;
}

@media (max-width: 760px) {
  .dashboard, .editor-grid {
    grid-template-columns: 1fr;
  }

  .portal-hero {
    background-image:
      linear-gradient(0deg, rgba(15, 24, 20, var(--overlay)), rgba(15, 24, 20, calc(var(--overlay) * 0.45))),
      var(--mobile-banner);
    background-position: center, var(--mobile-focal-x) var(--mobile-focal-y);
    min-height: 500px;
  }

  .topbar {
    height: auto;
    min-height: 64px;
  }
}

.usage {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.pill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 10px;
}

.crumbs {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 20px;
}

.crumbs a {
  color: var(--accent-dark);
  font-weight: 800;
}

.file-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 20px 0;
  padding: 0;
}

.file-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.file-meta {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.file-meta a, .file-row > a {
  font-weight: 800;
}

.inline-form {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form label {
  flex: 1 1 180px;
  margin: 0;
}

select {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.share-box {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.grant-list, .plain-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.grant-list li, .plain-list li {
  align-items: center;
  display: flex;
  gap: 12px;
}

details summary {
  cursor: pointer;
  font-weight: 800;
}

.section .panel + .panel {
  margin-top: 16px;
}

.check {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 0;
}

.check input {
  min-height: auto;
  width: auto;
}
