:root {
  --gold: #b8870b;
  --gold-strong: #c89505;
  --ink: #1b0d00;
  --ink-2: #2a1708;
  --paper: #f8f5ee;
  --panel: #ffffff;
  --muted: #746b5f;
  --line: rgba(27, 13, 0, 0.12);
  --shadow: 0 24px 80px rgba(27, 13, 0, 0.15);
}

[data-theme="dark"] {
  --paper: #0f0f0e;
  --panel: #181715;
  --ink: #fbf7ef;
  --ink-2: #f1e6d2;
  --muted: #a99f91;
  --line: rgba(255, 255, 255, 0.09);
  --shadow: 0 26px 90px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(184, 135, 11, 0.09), transparent 38%),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button,
input {
  font: inherit;
}

img {
  max-width: 100%;
}

.kicker {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.button-primary,
.button-ghost,
.auth-form button,
.login-aside button,
.topbar-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 800;
}

.button-primary,
.auth-form button,
.topbar-actions a {
  border: 0;
  color: #ffffff;
  background: linear-gradient(135deg, var(--ink-2), #090705);
  box-shadow: 0 12px 36px rgba(184, 135, 11, 0.16);
}

[data-theme="dark"] .button-primary,
[data-theme="dark"] .auth-form button,
[data-theme="dark"] .topbar-actions a {
  color: #1b0d00;
  background: linear-gradient(135deg, #f7d177, var(--gold));
}

.button-ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.welcome-hero {
  min-height: 100vh;
  padding: 26px clamp(20px, 5vw, 80px) 70px;
}

.welcome-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.welcome-nav img,
.login-brand img,
.sidebar img {
  width: min(230px, 56vw);
}

.welcome-nav a {
  color: var(--gold);
  font-weight: 800;
}

.welcome-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: clamp(36px, 7vw, 96px);
  align-items: center;
  padding-top: clamp(70px, 12vh, 150px);
}

.welcome-grid h1,
.login-panel h1,
.dashboard-topbar h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(2.5rem, 6vw, 6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.welcome-grid p,
.login-panel p,
.aside-card p {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.device-preview {
  display: grid;
  place-items: center;
}

.phone-frame {
  width: min(360px, 88vw);
  min-height: 640px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}

.phone-card {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 20px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.phone-card.hero-card {
  min-height: 250px;
  background:
    linear-gradient(180deg, transparent 42%, rgba(0, 0, 0, 0.46)),
    linear-gradient(135deg, rgba(184, 135, 11, 0.55), rgba(27, 13, 0, 0.92));
}

.phone-card span {
  height: 12px;
  border-radius: 999px;
  background: var(--line);
}

.phone-card button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: #111111;
}

.login-page {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(320px, 0.74fr);
  min-height: 100vh;
}

.login-panel {
  display: grid;
  align-content: center;
  padding: clamp(28px, 7vw, 92px);
}

.login-brand {
  display: grid;
  gap: 12px;
  margin-bottom: 46px;
}

.login-brand span {
  color: var(--gold);
  font-weight: 900;
  text-transform: uppercase;
}

.auth-form {
  display: grid;
  gap: 18px;
  width: min(460px, 100%);
  margin-top: 34px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.auth-form input {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--panel);
}

.subtle-link {
  margin-top: 18px;
  color: var(--gold);
  font-weight: 800;
}

.login-aside {
  display: grid;
  align-content: space-between;
  padding: clamp(24px, 5vw, 62px);
  background:
    radial-gradient(circle at 25% 20%, rgba(184, 135, 11, 0.24), transparent 32%),
    var(--ink-2);
  color: #ffffff;
}

.theme-toggle,
.icon-button {
  justify-self: end;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: currentColor;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.aside-card {
  max-width: 520px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.aside-card h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 26px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 44px;
}

.sidebar a {
  padding: 13px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.sidebar a.active,
.sidebar a:hover {
  color: var(--ink);
  background: var(--panel);
}

.dashboard-main {
  padding: clamp(22px, 4vw, 46px);
}

.dashboard-topbar,
.topbar-actions,
.metric-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-topbar {
  justify-content: space-between;
  margin-bottom: 28px;
}

.topbar-actions {
  flex-wrap: wrap;
}

.icon-button {
  width: 46px;
  min-height: 46px;
  border-radius: 8px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 26px;
}

.metric-row article,
.section-manager,
.mobile-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-row article {
  display: grid;
  gap: 8px;
  padding: 22px;
}

.metric-row span,
.metric-row small {
  color: var(--muted);
  font-weight: 800;
}

.metric-row strong {
  font-size: 2.2rem;
}

.builder-shell {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
  gap: 24px;
}

.mobile-preview {
  display: grid;
  place-items: center;
  padding: 22px;
}

.preview-screen {
  width: min(320px, 100%);
  min-height: 620px;
  padding: 14px;
  border-radius: 28px;
  background: #f3f1ec;
}

.preview-hero {
  min-height: 250px;
  border-radius: 20px;
  background: linear-gradient(135deg, #c89505, #1b0d00);
}

.preview-section {
  margin-top: 12px;
  padding: 18px;
  border-radius: 18px;
  color: #1b0d00;
  background: #ffffff;
}

.preview-section p {
  color: #6b6257;
}

.preview-section.compact {
  display: grid;
  gap: 14px;
}

.preview-section button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: #111111;
}

.section-manager {
  padding: 22px;
}

.manager-head h2 {
  margin: 0 0 18px;
}

.section-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.section-item button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.drag-handle {
  color: var(--gold);
  font-weight: 900;
}

.not-found {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.not-found img {
  width: min(260px, 80vw);
}

@media (max-width: 980px) {
  .welcome-grid,
  .login-page,
  .dashboard-layout,
  .builder-shell,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 620px) {
  .welcome-actions,
  .dashboard-topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button-primary,
  .button-ghost,
  .topbar-actions a,
  .icon-button {
    width: 100%;
  }

  .sidebar nav {
    grid-template-columns: 1fr;
  }
}
