:root {
  --paper: #fcf8f5;
  --card: #ffffff;
  --ink: #24151a;
  --muted: #64505a;
  --line: #eedfd9;
  --soft: #f6ebe5;
  --accent: #b3154f;
  --danger: #b3261e;
  --brand: linear-gradient(100deg, #b8145f, #d12f3f 52%, #c2460f);
  --on-brand: #ffffff;
  --display: 'Bricolage Grotesque', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #170e11;
    --card: #23171b;
    --ink: #faf1ee;
    --muted: #cbb8bc;
    --line: #402c32;
    --soft: #302127;
    --accent: #ff93a8;
    --danger: #ff9d94;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #170e11;
  --card: #23171b;
  --ink: #faf1ee;
  --muted: #cbb8bc;
  --line: #402c32;
  --soft: #302127;
  --accent: #ff93a8;
  --danger: #ff9d94;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; overflow-x: clip; background: var(--paper); color: var(--ink); font: 500 16px/1.5 var(--sans); }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 24px var(--display); color: inherit; text-decoration: none; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; color: var(--on-brand); background: var(--brand); border: 0; border-radius: 12px; font-weight: 800; text-align: center; text-decoration: none; }
.button:hover { filter: brightness(1.06); }
.button.ghost { color: var(--ink); background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }
.button.light { color: #a3124f; background: #ffffff; }
.button:disabled { cursor: default; filter: none; }
.button.danger { color: #ffffff; background: #b3261e; }
.link { min-height: 44px; padding: 0 4px; color: var(--ink); background: none; border: 0; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; }
.danger-link { color: var(--danger); }

.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100dvh; }
.login-card { display: flex; flex-direction: column; justify-content: center; gap: 14px; width: min(100%, 520px); margin-inline: auto; padding: 40px 24px; }
.login-card h1 { margin-top: 28px; font: 800 clamp(36px, 5vw, 52px)/1.05 var(--display); }
.auth-form { display: grid; gap: 14px; margin-top: 14px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
.field input { width: 100%; min-height: 50px; padding: 0 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; font-size: 16px; font-weight: 500; }
.field input:focus { border-color: var(--accent); outline: none; }
.field small { font-size: 13px; font-weight: 500; color: var(--muted); }
.form-error { min-height: 22px; color: var(--danger); font-size: 15px; font-weight: 700; }
.auth-form .button:disabled { opacity: .6; cursor: progress; }
.switch { color: var(--muted); }
.forgot { justify-self: end; min-height: 32px; font-size: 14px; }
.form-status { min-height: 22px; color: var(--muted); font-size: 15px; font-weight: 700; }
.form-status.error { color: var(--danger); }
.form-status:empty, .form-error:empty { display: none; }
.login.single { grid-template-columns: minmax(0, 1fr); }
.settings { width: min(900px, 100%); gap: 18px; }
.settings h1 { font: 800 clamp(36px, 5vw, 52px)/1.05 var(--display); }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px; padding: 26px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.setting h2 { font: 800 24px/1.2 var(--display); }
.setting-info p { margin-top: 6px; overflow-wrap: anywhere; }
.setting .auth-form { margin-top: 0; }
.setting-body { display: grid; align-content: start; justify-items: start; gap: 12px; }
.setting-value { font: 800 26px/1.2 var(--display); }
.danger-zone { border-color: var(--danger); }
.dialog .auth-form { margin-top: 0; }
.login-side { display: flex; align-items: center; padding: 48px; color: #ffffff; background: var(--brand); }
.login-side p { font: 800 clamp(42px, 5.4vw, 76px)/1.08 var(--display); }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px max(24px, calc((100% - 1160px) / 2)); background: var(--paper); border-bottom: 1px solid var(--line); }
.bar-end { display: flex; align-items: center; gap: 14px; min-width: 0; }
.badge { padding: 4px 12px; background: var(--soft); border-radius: 999px; font-size: 14px; font-weight: 800; }
.badge.pro { color: var(--on-brand); background: var(--brand); }
.user { display: block; overflow: hidden; line-height: 44px; font-size: 15px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }

.page { display: grid; gap: 36px; width: min(1160px, 100%); margin-inline: auto; padding: 36px 24px 64px; }
.welcome { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px; }
.welcome h1 { font: 800 clamp(38px, 5vw, 56px)/1.05 var(--display); }
.new-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stats article { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.stats h2 { font-size: 15px; font-weight: 700; color: var(--muted); }
.stat { margin-top: 4px; font: 800 34px/1.15 var(--display); }
.meter { height: 8px; margin-top: 10px; overflow: hidden; background: var(--soft); border-radius: 999px; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.list-head h2, .plan-panel h2 { font: 800 30px/1.15 var(--display); }
.search input { width: min(280px, 100%); min-height: 46px; padding: 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: 16px; }
.designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-items: start; gap: 22px 18px; }
.design { position: relative; min-width: 0; }
.star { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: #ffffff; background: rgb(20 8 12 / .62); border: 0; border-radius: 50%; font-size: 22px; line-height: 1; }
.star.on { color: #ffd166; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.views { display: flex; flex-wrap: wrap; gap: 6px; }
.views button { min-height: 44px; padding: 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: 15px; font-weight: 700; }
.views button[aria-pressed="true"] { color: var(--on-brand); background: var(--brand); border-color: transparent; }
.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.logo-row img { width: 72px; height: 72px; padding: 6px; object-fit: contain; background: var(--soft); border-radius: 14px; }
.brand-swatches { display: flex; gap: 8px; }
.brand-swatches:empty { display: none; }
.brand-swatches i { display: block; width: 42px; height: 42px; border-radius: 50%; box-shadow: 0 1px 4px rgb(60 20 32 / .3); }
.design-open { display: block; }
.design img { display: block; width: 100%; height: auto; background: var(--soft); border-radius: 12px; box-shadow: 0 6px 16px rgb(60 20 32 / .16); }
.design h3 { margin-top: 10px; overflow: hidden; font-size: 16px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.design-actions { display: flex; gap: 8px; margin-top: 10px; }
.small-button { min-height: 44px; padding: 0 16px; font-size: 15px; }
.design-actions .small-button { flex: 1; }
.more-button { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 11px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.more-button:hover, .more-button[aria-expanded="true"] { border-color: var(--accent); }
.back-link { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); font-size: 15px; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--ink); }
.toolbar-end { display: flex; flex-wrap: wrap; gap: 10px; }
.sort { display: block; width: 150px; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 30px; }
.page-button { min-width: 44px; min-height: 44px; padding: 0 8px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: 15px; font-weight: 800; }
.page-button.wide { padding: 0 16px; }
.page-button:hover:not(:disabled) { border-color: var(--accent); }
.page-button:disabled { opacity: .45; cursor: default; }
.page-button[aria-current="page"] { color: var(--on-brand); background: var(--brand); border-color: transparent; }
.page-gap { min-width: 24px; color: var(--muted); font-weight: 800; text-align: center; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: 16px; text-align: center; }
.empty h3 { font: 800 24px var(--display); }
.empty .button { margin-top: 10px; }

.plan-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding: 30px; color: #ffffff; background: var(--brand); border-radius: 20px; scroll-margin-top: 80px; }
.eyebrow { font-size: 15px; font-weight: 800; }
.plan-price { margin-block: 4px 12px; font-size: 18px; }
.plan-price b { font: 800 46px/1.1 var(--display); }
.plan-panel li + li { margin-top: 4px; }
.plan-action { display: grid; gap: 10px; width: min(100%, 300px); font-size: 14px; text-align: center; }

.dialog { width: min(92vw, 420px); padding: 26px; color: var(--ink); background: var(--card); border: 0; border-radius: 18px; }
.dialog::backdrop { background: rgb(20 8 12 / .55); }
.dialog h2 { font: 800 26px/1.15 var(--display); }
.dialog p { margin-top: 8px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }

@media (max-width: 760px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-side { display: none; }
  .login-card { padding-inline: 16px; }
  .bar { padding: 10px 16px; }
  .user { display: inline-flex; max-width: 34vw; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 20px; }
  .page { gap: 28px; padding: 24px 16px 48px; }
  .new-actions, .new-actions .button { flex: 1 1 100%; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .search, .search input { width: 100%; }
  .designs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .toolbar-end, .toolbar-end .search { width: 100%; }
  .sort { width: 100%; }
  .badge { display: none; }
  .bar-end { gap: 8px; }
  .page-button.wide { padding: 0 10px; }
  .plan-panel { padding: 22px; }
  .plan-action { width: 100%; }
}
