:root {
  --bg: #faf7f2; --surface: #ffffff; --ink: #231c17; --muted: #7a6d62; --line: #e9e1d6;
  --accent: #b4532a; --accent-ink: #fff; --danger: #b3261e; --ok: #2f6b3a;
  --radius: 12px; --shadow: 0 1px 2px rgba(40,25,10,.06), 0 6px 20px rgba(40,25,10,.06);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 500; line-height: 1.2; }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: .2rem 0 .4rem; }
h3 { font-size: 1.1rem; margin: 0 0 .75rem; }
main { padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem; max-width: 1240px; margin: 0 auto; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.narrow { max-width: 640px; margin: 2rem auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--accent); font-weight: 600; margin: 0; }
.inline { display: inline; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: Fraunces, Georgia, serif; font-size: 1.25rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand-mark { width: 22px; height: 26px; border-radius: 3px 6px 6px 3px; background: linear-gradient(135deg, var(--accent), #7d3519); box-shadow: inset 3px 0 0 rgba(0,0,0,.2); }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.topbar nav a, .linklike { color: var(--ink); text-decoration: none; font-weight: 500; }
.topbar nav a:hover { color: var(--accent); }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.linklike.danger { color: var(--danger); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--accent); color: var(--accent-ink) !important; border: 1px solid var(--accent); border-radius: 999px; padding: .6rem 1.2rem; font: 600 .95rem/1 Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer; transition: filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent) !important; }
.btn-sm { padding: .4rem .85rem; font-size: .85rem; }
.btn-lg { padding: .85rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
input, textarea, select { width: 100%; font: inherit; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: .9rem; }
label > input, label > textarea, label > select { margin-top: .3rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.form-error { background: #fdecea; color: var(--danger); padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; }
.flash { max-width: 1240px; margin: 1rem auto 0; padding: .75rem 1rem; border-radius: 10px; width: calc(100% - 2 * clamp(1rem, 4vw, 3rem)); }
.flash-ok { background: #e8f3ea; color: var(--ok); }
.flash-error { background: #fdecea; color: var(--danger); }

/* Landing */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: center; padding: 3rem 0 4rem; }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); margin: .6rem 0 1rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.hero-cta { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.5rem 0 .75rem; }
.mock-book { display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 3 / 2; filter: drop-shadow(0 25px 35px rgba(60,30,10,.25)); transform: rotate(-3deg); }
.mock-page { background: #fbf6ec; padding: 9%; display: flex; flex-direction: column; gap: 6%; }
.mock-page.left { border-radius: 6px 0 0 6px; background-image: linear-gradient(270deg, rgba(0,0,0,.12), transparent 9%); }
.mock-page.right { border-radius: 0 6px 6px 0; background-image: linear-gradient(90deg, rgba(0,0,0,.12), transparent 9%); }
.mock-page p { margin: 0; font-family: Fraunces, serif; font-style: italic; font-size: .85rem; text-align: center; color: #6b5a4c; }
.ph { flex: 1; border: 5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.ph1 { background: linear-gradient(160deg, #f4b787, #d36c3c 55%, #5b6e8c); }
.ph2 { background: linear-gradient(200deg, #9fc6c1, #4f7f86); }
.ph3 { background: linear-gradient(180deg, #e8d3a6, #b88a4a); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.features article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.features p { margin: 0; color: var(--muted); }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; max-width: 960px; margin: 0 auto; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; display: flex; flex-direction: column; }
.plan-featured { border: 2px solid var(--accent); box-shadow: var(--shadow); }
.price { font-family: Fraunces, serif; font-size: 2.2rem; margin: 0 0 1rem; }
.price span { font-size: .95rem; color: var(--muted); }
.plan ul { padding-left: 1.1rem; margin: 0 0 1.5rem; flex: 1; color: var(--muted); }
.plan li { margin-bottom: .35rem; }

/* Auth */
.auth-card { max-width: 420px; margin: 3rem auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }

/* Dashboard */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.new-album { display: flex; gap: .5rem; flex-wrap: wrap; }
.new-album input { width: min(260px, 100%); }
.usage { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.usage-bar { width: min(280px, 100%); height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--accent); }
.empty { text-align: center; padding: 4rem 1rem; border: 2px dashed var(--line); border-radius: var(--radius); }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; }
.album-card { text-decoration: none; color: var(--ink); }
.album-cover { aspect-ratio: 4 / 5; border-radius: 4px 10px 10px 4px; background: linear-gradient(135deg, var(--bind, #6b2f1d), var(--bind-2, #4a1f12)); padding: 14%; display: flex; align-items: center; justify-content: center; box-shadow: inset 6px 0 8px rgba(0,0,0,.25), var(--shadow); transition: transform .2s; }
.album-card:hover .album-cover { transform: translateY(-3px) rotate(-1deg); }
.album-cover img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 5px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.album-cover span { color: var(--gilt, #e6c88f); font-family: Fraunces, serif; font-size: 1.2rem; text-align: center; }
.album-meta { display: flex; flex-direction: column; padding: .6rem .2rem; }
.theme-classic  { --bind: #6b2f1d; --bind-2: #4a1f12; --gilt: #e6c88f; }
.theme-linen    { --bind: #c9b99a; --bind-2: #a8977a; --gilt: #fffaf0; }
.theme-midnight { --bind: #1d2540; --bind-2: #10152a; --gilt: #c9cfe8; }
.theme-blush    { --bind: #d9a3a0; --bind-2: #b98380; --gilt: #fff6f4; }

/* Editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.head-actions { display: flex; gap: .5rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.danger-zone { border-color: #f1c8c4; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 2.25rem 1rem; border: 2px dashed #d8c9b6; border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: center; transition: background .15s, border-color .15s; }
.dropzone.over { background: #fbefe7; border-color: var(--accent); }
.upload-status { margin: .75rem 0; font-size: .9rem; }
.upload-status .bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: .35rem; }
.upload-status .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-status .err { color: var(--danger); }
.hint { margin: 1rem 0 .5rem; }
.photo-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; }
.photo-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .5rem; position: relative; cursor: grab; }
.photo-tile.dragging { opacity: .4; }
.photo-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; background: #efe8de; }
.photo-tile .caption { margin-top: .45rem; padding: .35rem .5rem; font-size: .85rem; }
.tile-actions { display: flex; justify-content: space-between; padding: .4rem .15rem 0; font-size: .8rem; }
.tile-actions .linklike { font-size: .8rem; color: var(--muted); }
.tile-actions .linklike.danger { color: var(--danger); }
.badge { position: absolute; top: .9rem; left: .9rem; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; }
.badge-inline { background: #f3e6dc; color: var(--accent); font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; }
.copy-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.copy-row input { font-size: .8rem; }

/* Account */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.plan-switch { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.plan-option { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; }
.plan-option.current { border-color: var(--accent); background: #fdf6f1; }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; }
.stats strong { font-family: Fraunces, serif; font-size: 1.6rem; font-weight: 500; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 500; }
.row-actions { display: flex; gap: .4rem; }
.plan-set { display: flex; gap: .4rem; align-items: center; }
.plan-set select { width: auto; padding: .3rem .5rem; font-size: .85rem; }
.section-gap { margin-top: 2rem; }
.pending-note { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; background: #fdf6e3; border: 1px solid #f0dfb0; border-radius: 10px; padding: .6rem .9rem; margin-bottom: .75rem; font-size: .9rem; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 1.5rem; }
  .editor { grid-template-columns: 1fr; }
}
