/* Gallery Renamer — app styles. Change --accent to re-skin the whole app. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f9fafb; --text: #141821; --muted: #667085; --line: #e3e6ec;
  --accent: #2f55d4; --accent-ink: #ffffff; --accent-soft: #e9eeff; --accent-line: #c5d1ff;
  --danger: #c4261b; --danger-soft: #fdecea; --ok: #0f7a55; --ok-soft: #e3f6ee; --warn: #a4480a; --warn-soft: #fff1e0;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 6px 18px rgba(16,24,40,.07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117; --surface: #161a23; --surface-2: #1b202b; --text: #e9ebf1; --muted: #98a1b3; --line: #262c3a;
    --accent: #7c93ff; --accent-ink: #0b1020; --accent-soft: #1d2542; --accent-line: #34406d;
    --danger: #ff7b70; --danger-soft: #3a1c1a; --ok: #4fd1a1; --ok-soft: #14301f; --warn: #ffb066; --warn-soft: #382411;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.right { margin-left: auto; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .row.tight { gap: 8px; }
.stack > * + * { margin-top: 14px; } .grow { flex: 1 1 0; min-width: 0; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* --- header ------------------------------------------------------------------ */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.usage-pill { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; }
.usage-pill .bar { width: 54px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); } .badge.gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 80px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }

/* --- cards, forms, buttons ---------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.flat { box-shadow: none; } .card.pad-sm { padding: 14px; }
.card h2 { margin-bottom: .8em; }
.grid { display: grid; gap: 16px; } .grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
label.field { display: block; } label.field > span.lbl { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 5px; color: var(--text); }
label.field .hint { display: block; font-size: .78rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; outline: none; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.invalid { border-color: var(--danger); }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: flex; align-items: center; gap: 9px; font-size: .92rem; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; font: inherit; font-weight: 600; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); } .btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 11px; font-size: .85rem; } .btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 9px 12px; border-radius: 9px; font-size: .9rem; }
.form-ok { color: var(--ok); background: var(--ok-soft); padding: 9px 12px; border-radius: 9px; font-size: .9rem; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid var(--line); background: var(--surface); }
.banner.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.banner.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.banner.info { background: var(--accent-soft); border-color: transparent; }

/* --- auth --------------------------------------------------------------------- */
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 1.4rem; }

/* --- progress ------------------------------------------------------------------ */
.bar { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.bar.warn > i { background: #e5890a; } .bar.danger > i { background: var(--danger); }
.usage-card .num { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; } .usage-card .of { color: var(--muted); font-weight: 500; font-size: .95rem; }

/* --- dashboard projects ------------------------------------------------------------ */
.project-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; color: inherit; }
.project-card:hover { text-decoration: none; border-color: var(--accent-line); }
.project-card .cover { aspect-ratio: 16 / 9; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.project-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.project-card .meta { padding: 14px 16px; }
.project-card .title { font-weight: 650; }
.empty { text-align: center; padding: 56px 20px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty h2 { color: var(--text); }

/* --- project workspace ----------------------------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dropzone { border: 2px dashed var(--accent-line); background: var(--accent-soft); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--accent); cursor: pointer; transition: background .12s; }
.dropzone.over { background: var(--accent-line); } .dropzone strong { display: block; font-size: 1.05rem; }
.photos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.photo { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.photo.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.photo.dragging { opacity: .4; } .photo.drop-before { box-shadow: -4px 0 0 var(--accent); }
.photo .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); cursor: zoom-in; position: relative; }
.photo .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .sel { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,.92); border-radius: 6px; padding: 3px; line-height: 0; }
.photo .pos { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; padding: 2px 7px; border-radius: 99px; }
.photo .info { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 6px; }
.photo input.area { font-weight: 600; padding: 6px 9px; }
.photo .newname { font-size: .74rem; color: var(--muted); overflow-wrap: anywhere; min-height: 1.1em; }
.photo .orig { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 650; padding: 2px 8px; border-radius: 99px; width: fit-content; text-transform: uppercase; letter-spacing: .03em; }
.chip.pending { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip.queued { background: var(--accent-soft); color: var(--accent); } .chip.ready { background: var(--ok-soft); color: var(--ok); } .chip.error { background: var(--danger-soft); color: var(--danger); }
.spin { width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.job { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.job .bar { flex: 1 1 200px; }
details.settings > summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 8px; }
details.settings > summary::before { content: "▸"; color: var(--muted); transition: transform .12s; } details.settings[open] > summary::before { transform: rotate(90deg); }

/* --- brochure builder ------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: none; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.sticky { position: sticky; top: 76px; }
.plist { display: flex; flex-direction: column; gap: 6px; max-height: 560px; overflow: auto; padding-right: 4px; }
.prow { display: grid; grid-template-columns: 22px 64px 1fr auto auto auto; gap: 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.prow.off { opacity: .45; } .prow.dragging { opacity: .4; } .prow.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.prow img { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.prow .cap { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .handle { cursor: grab; color: var(--muted); user-select: none; }
.tog { font-size: .72rem; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); }
.colors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 22px; }
.colorrow { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.colorrow .name { flex: 1; font-size: .9rem; } .colorrow.auto input[type=color] { opacity: .55; }
.locked { position: relative; } .locked::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 55%, transparent); border-radius: var(--radius); pointer-events: none; }
.spec-row { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; margin-bottom: 6px; }
.logo-prev { height: 56px; max-width: 180px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: repeating-conic-gradient(#8881 0% 25%, transparent 0% 50%) 50% / 14px 14px; }

/* --- billing -------------------------------------------------------------------------------- */
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.plan { display: flex; flex-direction: column; gap: 12px; } .plan.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.plan .price { font-size: 2rem; font-weight: 750; letter-spacing: -.03em; } .plan .price small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; font-size: .9rem; }
.plan li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 8px; } .plan li.no { color: var(--muted); } .plan li.no::before { content: "–"; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: none; background: none; font: inherit; font-weight: 600; padding: 6px 14px; border-radius: 7px; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* --- modal + toast ----------------------------------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(8,10,16,.55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: min(520px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.modal.wide { width: min(980px, 100%); }
.modal-head { padding: 18px 22px 0; display: flex; align-items: center; } .modal-head h2 { margin: 0; }
.modal-body { padding: 14px 22px; } .modal-foot { padding: 12px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--text); color: var(--bg); padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow); font-size: .92rem; animation: pop .18s ease-out; }
.toast.error { background: var(--danger); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.lightbox img { max-width: 100%; max-height: 78vh; display: block; margin: 0 auto; border-radius: 8px; }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }

@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; } .sticky { position: static; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; } .nav { order: 3; width: 100%; overflow-x: auto; }
  .usage-pill { display: none; } main { padding: 18px 14px 80px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .photos { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .prow { grid-template-columns: 22px 54px 1fr auto; } .prow .tog.t2, .prow .tog.t3 { display: none; }
  .spec-row { grid-template-columns: 1fr; }
}
