/* ==========================================================================
   Admin dashboard
   ========================================================================== */

.page-admin { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100dvh; }

/* ---------------------------------------------------------------- sidebar */
.sidenav {
  position: sticky; top: 0; align-self: start; height: 100dvh;
  display: flex; flex-direction: column; gap: 26px; padding: 26px 18px;
  border-right: 1px solid var(--line); background: var(--bg-soft);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px; }
.brand__mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font-family: var(--font-display); font-size: 1.35rem; font-weight: 500;
  letter-spacing: 0.02em;
}
.brand__text { display: grid; line-height: 1.05; }
.brand__name { font-family: var(--font-display); font-size: 1.22rem; letter-spacing: 0.01em; }
.brand__sub { font-size: 0.63rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted); }
.sidenav__links { display: grid; gap: 4px; }
.sidenav__link {
  display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 12px;
  border-radius: 10px; color: var(--ink-2); font-size: 0.88rem; font-weight: 450;
  border: 1px solid transparent; background: none; cursor: pointer; width: 100%; text-align: left;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.sidenav__link:hover { background: var(--surface); color: var(--ink); }
.sidenav__link.is-active { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 550; box-shadow: var(--shadow-sm); }
.sidenav__link .ic { width: 17px; height: 17px; opacity: 0.8; }
.sidenav__foot { margin-top: auto; display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.sidenav__user { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.sidenav__username { font-size: 0.84rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { margin: 0; }
[data-theme-toggle] .tt-moon { display: none; }
[data-mode='dark'] [data-theme-toggle] .tt-moon { display: inline-flex; }
[data-mode='dark'] [data-theme-toggle] .tt-sun { display: none; }

/* ----------------------------------------------------------------- layout */
.content { padding: 30px 34px 64px; max-width: 1320px; width: 100%; }
.topbar { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 26px; }
.topbar__title { flex: 1 1 auto; }
.topbar__title h1 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 500; letter-spacing: 0; }
.topbar__title p { color: var(--muted); font-size: 0.86rem; margin-top: 3px; }
.topbar__actions { display: flex; gap: 8px; flex: none; }
.only-mobile { display: none; }

/* ------------------------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat {
  display: grid; gap: 2px; padding: 18px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, transform 0.18s var(--ease);
}
.stat:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.stat__icon { color: var(--muted); }
.stat__icon .ic { width: 17px; height: 17px; }
.stat__value { font-family: var(--font-display); font-size: 2.1rem; line-height: 1.1; margin-top: 6px; }
.stat__label { font-size: 0.76rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.stat__label em { text-transform: none; letter-spacing: 0; font-style: normal; }

/* ----------------------------------------------------------------- panels */
.panel {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-xl);
  padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel > h2, .panel--split h2 { font-family: var(--font-display); font-size: 1.22rem; margin-bottom: 12px; }
.panel--split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.steps-mini, .notes { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--ink-2); font-size: 0.88rem; }
.steps-mini li::marker { color: var(--accent); }
.kv { margin: 0; display: grid; gap: 10px; }
.kv > div { display: grid; grid-template-columns: 190px 1fr; gap: 14px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); font-size: 0.87rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.mini-list { display: grid; gap: 10px; }
.mini-row {
  display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: var(--r-md);
  border: 1px solid transparent; transition: background 0.16s, border-color 0.16s;
}
.mini-row:hover { background: var(--surface-2); border-color: var(--line); }
.mini-row__thumb { width: 52px; height: 62px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.mini-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-row__main { flex: 1 1 auto; display: grid; gap: 2px; min-width: 0; }
.mini-row__title { font-size: 0.92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row__meta { font-size: 0.78rem; color: var(--muted); }
.mini-row__right { display: flex; align-items: center; gap: 12px; flex: none; }
.mini-row__photos { font-size: 0.78rem; color: var(--muted); }

.empty { display: grid; justify-items: center; gap: 10px; padding: 54px 20px; text-align: center; color: var(--muted); }
.empty__icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.empty__icon .ic { width: 22px; height: 22px; }
.empty h3 { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }
.empty p { font-size: 0.88rem; max-width: 40ch; }
.empty .btn { margin-top: 8px; }

/* ---------------------------------------------------------------- filters */
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 22px; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search .input { padding-left: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 0.8rem; color: var(--ink-2);
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.chip:hover { border-color: var(--line-strong); }
.chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ------------------------------------------------------------ gallery cards */
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 22px; }
.gal-card {
  border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s;
}
.gal-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); transform: translateY(-2px); }
.gal-card__cover { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.gal-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.gal-card:hover .gal-card__cover img { transform: scale(1.03); }
.gal-card__ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.gal-card__badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.gal-card__badges .pill { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(6px); }
.gal-card__count {
  position: absolute; right: 10px; bottom: 10px; font-size: 0.72rem; letter-spacing: 0.04em;
  background: color-mix(in srgb, #121110 62%, transparent); color: #f5f1eb; padding: 4px 9px; border-radius: 999px;
}
.gal-card__body { padding: 18px; display: grid; gap: 6px; }
.gal-card__title { font-family: var(--font-display); font-size: 1.18rem; line-height: 1.25; }
.gal-card__title a:hover { color: var(--accent); }
.gal-card__client { font-size: 0.84rem; color: var(--muted); }
.gal-card__meta { display: grid; gap: 4px; margin: 6px 0 4px; }
.gal-card__meta > div { display: flex; gap: 8px; font-size: 0.78rem; }
.gal-card__meta dt { color: var(--muted); min-width: 84px; }
.gal-card__meta dd { margin: 0; color: var(--ink-2); }
.gal-card__actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.gal-card__actions .btn { padding: 0 10px; }

/* ------------------------------------------------------------------ menus */
.menu { position: relative; margin-left: auto; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 216px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); padding: 6px; display: none;
}
.menu.is-open .menu__panel { display: grid; }
.menu__panel button {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  border: none; background: none; text-align: left; font-size: 0.85rem; cursor: pointer; color: var(--ink-2);
}
.menu__panel button:hover { background: var(--surface-2); color: var(--ink); }
.menu__panel button.is-danger { color: var(--danger); }
.menu__panel .ic { width: 15px; height: 15px; opacity: 0.75; }

/* ----------------------------------------------------------------- wizard */
.wizsteps {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 22px; padding: 0;
}
.wizsteps__item {
  display: flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 0.78rem; color: var(--muted);
}
.wizsteps__item.is-done { color: var(--ink-2); }
.wizsteps__item.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.wizsteps__num {
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); font-size: 0.68rem; font-weight: 600;
}
.wizsteps__item.is-active .wizsteps__num { background: color-mix(in srgb, var(--bg) 24%, transparent); color: var(--bg); }
.wizsteps__item.is-done .wizsteps__num { background: var(--ok-soft); color: var(--ok); }

.wizard { border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.wizpanel { display: none; padding: 28px; gap: 18px; }
.wizpanel.is-active { display: grid; }
.wizpanel__title { font-family: var(--font-display); font-size: 1.45rem; }
.wizpanel__hint { color: var(--muted); font-size: 0.87rem; max-width: 72ch; margin-top: -8px; }
.wizpanel__actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.wiznav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px; border-top: 1px solid var(--line); background: var(--bg-soft);
}
.wiznav__count { font-size: 0.8rem; color: var(--muted); }

.scanbox { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 20px; background: var(--surface-2); min-height: 120px; }
.scanbox__idle { display: grid; justify-items: center; gap: 8px; color: var(--muted); font-size: 0.86rem; text-align: center; padding: 12px; }
.scanbox__idle .ic { width: 26px; height: 26px; }
.scan-summary { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 0.84rem; color: var(--ink-2); margin-top: 14px; }
.scan-summary strong { font-weight: 600; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; max-height: 460px; overflow-y: auto; padding: 4px; margin-top: 14px; }
.pick {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  border: 2px solid transparent; padding: 0; cursor: pointer; transition: border-color 0.16s, transform 0.16s var(--ease);
}
.pick img { width: 100%; height: 100%; object-fit: cover; }
.pick:hover { transform: translateY(-2px); }
.pick.is-on { border-color: var(--accent); }
.pick__tick { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); opacity: 0; transition: opacity 0.16s; }
.pick.is-on .pick__tick { opacity: 1; }
.pick__tick .ic { width: 13px; height: 13px; }
.pick__name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 0.62rem; color: #f7f3ed; background: linear-gradient(transparent, rgba(0,0,0,.7)); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick--broken { display: grid; place-items: center; color: var(--muted); }
.pick-grid--preview { max-height: 320px; }
.pick-ph { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface); }
.pick-ph img { width: 100%; height: 100%; object-fit: cover; }

.cover-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 24px; align-items: start; }
.cover-preview { display: grid; gap: 10px; }
.cover-preview__box { border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); aspect-ratio: 16 / 9; display: grid; place-items: center; position: relative; }
.cover-preview__box img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview__row { display: grid; grid-template-columns: 4fr 5fr; gap: 10px; }
.cover-preview__box--portrait { aspect-ratio: 4 / 5; }
.cover-preview__box--square { aspect-ratio: 1; }
.cover-preview__ph { display: grid; justify-items: center; gap: 6px; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 10px; text-align: center; }
.cover-preview__ph .ic { width: 20px; height: 20px; }
.cover-preview__ph em { font-style: normal; }
.cover-preview__name { font-size: 0.8rem; color: var(--muted); word-break: break-all; }
.cover-picker { border-left: 1px solid var(--line); padding-left: 20px; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.theme-card {
  position: relative; display: grid; gap: 6px; padding: 14px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.theme-card:hover { border-color: var(--line-strong); }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card__preview { color: var(--ink); background: var(--surface); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.theme-card__preview svg { display: block; width: 100%; height: auto; }
.theme-card__name { font-family: var(--font-display); font-size: 1.1rem; margin-top: 4px; }
.theme-card__desc { font-size: 0.76rem; color: var(--muted); line-height: 1.45; }
.theme-card__tick { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); opacity: 0; transition: opacity 0.16s; }
.theme-card__tick .ic { width: 13px; height: 13px; }
.theme-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.theme-card:has(input:checked) .theme-card__tick { opacity: 1; }
.theme-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.durations { display: flex; flex-wrap: wrap; gap: 10px; }
.duration {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); font-size: 0.86rem; cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}
.duration input { accent-color: var(--accent); }
.duration:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

.toggles { display: grid; gap: 12px; }
.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__ui { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background 0.18s; margin-top: 1px; }
.toggle__ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform 0.18s var(--ease); }
.toggle input:checked + .toggle__ui { background: var(--ok); }
.toggle input:checked + .toggle__ui::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle__ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle__text { display: grid; gap: 2px; }
.toggle__text strong { font-size: 0.88rem; font-weight: 550; }
.toggle__text em { font-style: normal; font-size: 0.78rem; color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 0.86rem; color: var(--ink-2); }
.switch input { accent-color: var(--accent); }

.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented__opt { display: inline-flex; }
.segmented__opt input { position: absolute; opacity: 0; pointer-events: none; }
.segmented__opt span { display: inline-flex; align-items: center; height: 32px; padding: 0 16px; border-radius: 999px; font-size: 0.84rem; color: var(--muted); cursor: pointer; }
.segmented__opt input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.mode-panel { display: none; }
.mode-panel.is-on { display: block; }

.summary { display: grid; gap: 10px; padding: 18px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); }
.summary__row { display: flex; gap: 12px; font-size: 0.86rem; }
.summary__row dt { color: var(--muted); min-width: 150px; }
.summary__row dd { margin: 0; color: var(--ink-2); }

/* ------------------------------------------------------------------- auth */
.page-auth { display: grid; place-items: center; min-height: 100dvh; padding: 24px; background:
  radial-gradient(1000px 600px at 12% -8%, var(--accent-soft), transparent 60%),
  radial-gradient(900px 500px at 105% 105%, var(--ok-soft), transparent 55%), var(--bg); }
.auth { width: 100%; max-width: 420px; }
.auth__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 32px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; }
.auth__title { font-family: var(--font-display); font-size: 1.7rem; margin-top: 6px; }
.auth__sub { color: var(--muted); font-size: 0.86rem; margin-top: -8px; }
.auth__foot { font-size: 0.75rem; color: var(--muted); text-align: center; }
.page-auth .brand { justify-content: flex-start; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .page-admin { grid-template-columns: 1fr; }
  .sidenav {
    position: fixed; inset: 0 auto 0 0; width: 268px; z-index: 60; transform: translateX(-102%);
    transition: transform 0.24s var(--ease); box-shadow: var(--shadow-lg); overflow-y: auto;
  }
  .sidenav.is-open { transform: none; }
  .only-mobile { display: inline-flex; }
  .content { padding: 20px 18px 60px; }
  .topbar__title h1 { font-size: 1.55rem; }
  .cover-layout { grid-template-columns: 1fr; }
  .cover-picker { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
  .wizpanel { padding: 20px; }
  .kv > div { grid-template-columns: 1fr; gap: 2px; }
  .gal-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; }
  .topbar__actions { width: 100%; }
  .topbar__actions .btn { flex: 1 1 auto; }
  .wizsteps__item span:not(.wizsteps__num) { display: none; }
  .wizsteps__item { padding: 6px 9px; }
  .wizsteps__item.is-active span:not(.wizsteps__num) { display: inline; }
  .wiznav { flex-wrap: wrap; }
  .wiznav__count { order: -1; width: 100%; text-align: center; }
  .gal-card__actions .btn { flex: 1 1 auto; }
  .menu { margin-left: 0; flex: 1 1 auto; }
  .menu > .btn { width: 100%; }
}

/* ==========================================================================
   Revision 2 — device preview, logo manager, watermark controls
   ========================================================================== */

.wizpanel__sub {
  font-family: var(--font-display); font-size: 1.05rem; margin-top: 18px;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.wiznav__right { display: flex; align-items: center; gap: 12px; }
.dirty-flag { font-size: 0.74rem; color: var(--warn); white-space: nowrap; }

/* ------------------------------------------------------------ device preview */

.devbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2); margin-bottom: 14px;
}
.devbar__tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.devbar__right { display: flex; gap: 6px; flex-wrap: wrap; }
.devtab {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid transparent; background: transparent;
  font-size: 0.82rem; color: var(--muted); cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.devtab .ic { width: 15px; height: 15px; }
.devtab:hover { color: var(--ink); }
.devtab.is-on { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-sm); }

.devstage {
  position: relative; width: 100%; max-width: 100%;
  /* the fixed-width device must not inflate the page's intrinsic width */
  contain: inline-size;
  display: flex; justify-content: center;
  align-items: flex-start; overflow: hidden; padding: 4px 0;
  background:
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--ink) 3%, transparent) 0 10px, transparent 10px 20px),
    var(--surface-2);
  border-radius: var(--r-md);
}
.device {
  transform-origin: top center; flex: none;
  transition: width 0.24s var(--ease), height 0.24s var(--ease), transform 0.24s var(--ease);
  border-radius: 14px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line-strong); box-shadow: 0 18px 48px -22px rgba(0, 0, 0, 0.45);
  display: grid; grid-template-rows: 26px 1fr;
}
.device--desktop { border-radius: 10px; }
.device--tablet { border-radius: 18px; }
.device--mobile { border-radius: 26px; }
.device__chrome {
  display: flex; align-items: center; gap: 5px; padding: 0 10px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.device__chrome span { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.device__chrome i {
  font-style: normal; margin-left: auto; font-size: 0.62rem; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}
.device__screen { position: relative; overflow: hidden; background: #fff; }
.device__screen iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
@media (max-width: 720px) {
  .devbar { flex-direction: column; align-items: stretch; }
  .devbar__right { justify-content: space-between; }
}

/* -------------------------------------------------------------- logo manager */

.logo-manager { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }
.logo-item {
  margin: 0; display: grid; gap: 7px; padding: 10px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface-2);
}
.logo-item.is-global { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.logo-item__box {
  display: grid; place-items: center; height: 72px; border-radius: 8px;
  background: repeating-conic-gradient(var(--surface) 0% 25%, var(--surface-2) 0% 50%) 50% / 14px 14px;
  border: 1px solid var(--line);
}
.logo-item__box img { max-height: 48px; max-width: 88%; width: auto; object-fit: contain; }
.logo-item figcaption { display: grid; gap: 3px; }
.logo-item__name { font-size: 0.76rem; font-weight: 600; }
.logo-item__name em { color: var(--muted); font-style: normal; font-weight: 400; }
.logo-item__meta { font-size: 0.68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.logo-item__actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.logo-item__actions .btn { height: 28px; padding: 0 8px; font-size: 0.7rem; }

.dropzone {
  display: grid; justify-items: center; gap: 6px; padding: 22px 16px; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2); cursor: pointer; transition: border-color 0.16s, background 0.16s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone__icon { color: var(--muted); }
.dropzone strong { font-size: 0.86rem; }
.dropzone em { font-style: normal; font-size: 0.74rem; color: var(--muted); }
.logo-preview { display: grid; gap: 10px; margin-top: 14px; }
.logo-preview__box {
  display: grid; place-items: center; min-height: 90px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: repeating-conic-gradient(var(--surface) 0% 25%, var(--surface-2) 0% 50%) 50% / 14px 14px;
}
.logo-preview__box img { max-height: 64px; max-width: 100%; object-fit: contain; }

.logo-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.logo-chip {
  width: 66px; height: 44px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; display: grid; place-items: center; padding: 5px;
}
.logo-chip img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-chip.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* --------------------------------------------------------- watermark panel */

.wm-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.wm-layout.is-dim { opacity: 0.55; }
.wm-form { display: grid; gap: 16px; }
.wm-pos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wm-pos__opt {
  display: grid; gap: 4px; justify-items: center; padding: 8px 4px 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  cursor: pointer; transition: border-color 0.16s, background 0.16s;
}
.wm-pos__opt input { position: absolute; opacity: 0; pointer-events: none; }
.wm-pos__opt span {
  width: 46px; height: 32px; border-radius: 4px; background: var(--surface);
  border: 1px solid var(--line); position: relative; display: block;
}
.wm-pos__opt em { font-style: normal; font-size: 0.64rem; color: var(--muted); }
.wm-pos__opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.wm-pos__opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.wm-dot { position: absolute; width: 12px; height: 5px; border-radius: 1px; background: var(--accent); }
.wm-dot--top-left { left: 5px; top: 5px; }
.wm-dot--top-center { left: 50%; top: 5px; transform: translateX(-50%); }
.wm-dot--top-right { right: 5px; top: 5px; }
.wm-dot--bottom-left { left: 5px; bottom: 5px; }
.wm-dot--bottom-center { left: 50%; bottom: 5px; transform: translateX(-50%); }
.wm-dot--bottom-right { right: 5px; bottom: 5px; }

.input--range { padding: 0; height: auto; accent-color: var(--accent); }
output { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }

.wm-preview { display: grid; gap: 10px; position: sticky; top: 12px; }
.wm-preview__frame {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
  aspect-ratio: 4 / 3; display: grid; place-items: center;
}
.wm-preview__frame img { width: 100%; height: 100%; object-fit: cover; }
.wm-preview__ph { font-size: 0.78rem; color: var(--muted); padding: 16px; text-align: center; }
.wm-preview__mark {
  position: absolute; display: none; pointer-events: none;
  width: var(--wm-size, 18%); aspect-ratio: 3 / 1;
  background-image: var(--wm-logo); background-repeat: no-repeat;
  background-position: center; background-size: contain;
  opacity: var(--wm-opacity, 0.55);
}
.wm-preview__frame[data-wm='1'] .wm-preview__mark { display: block; }
.wm-preview__frame[data-wm-x='left'] .wm-preview__mark { left: var(--wm-margin, 4%); }
.wm-preview__frame[data-wm-x='right'] .wm-preview__mark { right: var(--wm-margin, 4%); }
.wm-preview__frame[data-wm-x='center'] .wm-preview__mark { left: 50%; transform: translateX(-50%); }
.wm-preview__frame[data-wm-y='top'] .wm-preview__mark { top: var(--wm-margin, 4%); }
.wm-preview__frame[data-wm-y='bottom'] .wm-preview__mark { bottom: var(--wm-margin, 4%); }
.wm-preview__frame[data-wm-y='center'] .wm-preview__mark { top: 50%; transform: translateY(-50%); }
.wm-preview__frame[data-wm-x='center'][data-wm-y='center'] .wm-preview__mark { transform: translate(-50%, -50%); }

.theme-card__tag {
  font-style: normal; font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 99px; padding: 0 5px;
}
.toggle--tight { padding: 10px 12px; }

@media (max-width: 980px) {
  .logo-manager { grid-template-columns: 1fr; }
  .wm-layout { grid-template-columns: 1fr; }
  .wm-preview { position: static; }
}

/* Small screens: the top bar must never push the page sideways, whatever the
   gallery title length or however many action buttons a view has. */
@media (max-width: 560px) {
  .topbar {
    display: grid; grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: 'nav title' 'actions actions';
    align-items: start; gap: 10px 12px;
  }
  .topbar > .iconbtn { grid-area: nav; }
  .topbar__title { grid-area: title; min-width: 0; }
  .topbar__actions { grid-area: actions; flex-wrap: wrap; width: 100%; min-width: 0; }
  .topbar__actions > * { flex: 1 1 0; min-width: 0; }
  .topbar__title h1, .topbar__title p { overflow-wrap: anywhere; }
}

/* grid items default to min-width:auto, which lets a wide child (the 1440px
   device frame) push the whole page sideways — always allow shrinking. */
.page-admin > .content { min-width: 0; }

/* ==========================================================================
   Profile photo (Days Gallery)
   ========================================================================== */

.avatar-btn {
  position: relative; flex: none; width: 34px; height: 34px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: none;
  cursor: pointer; overflow: visible; line-height: 0;
  transition: border-color 0.16s, transform 0.16s var(--ease);
}
.avatar-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-btn__img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block;
  background: var(--surface-2);
}
.avatar-btn__fallback { width: 100%; height: 100%; font-size: 0.85rem; }
.avatar-btn__badge {
  position: absolute; right: -3px; bottom: -3px;
  width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); opacity: 0; transition: opacity 0.16s;
}
.avatar-btn__badge .ic { width: 9px; height: 9px; }
.avatar-btn:hover .avatar-btn__badge,
.avatar-btn:focus-visible .avatar-btn__badge { opacity: 1; }
.avatar--lg { width: 100%; height: 100%; font-size: 2.1rem; border-radius: 50%; }

/* ------------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal__scrim {
  position: absolute; inset: 0; background: rgba(15, 13, 12, 0.55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal__card {
  position: relative; width: min(460px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 22px; display: grid; gap: 14px; box-shadow: var(--shadow-lg);
  animation: modalIn 0.18s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal__head h2 { font-family: var(--font-display); font-size: 1.35rem; }
.modal__hint { font-size: 0.8rem; color: var(--muted); }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

.avatar-editor { display: flex; gap: 16px; align-items: center; }
.avatar-editor__box {
  flex: none; width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.avatar-editor__box img { width: 100%; height: 100%; object-fit: cover; }
.avatar-editor__actions { display: grid; gap: 8px; justify-items: start; }
.avatar-editor__actions .btn { justify-self: start; }

@media (max-width: 480px) {
  .avatar-editor { flex-direction: column; align-items: flex-start; gap: 12px; }
  .modal__foot { flex-direction: column-reverse; }
  .modal__foot .btn { width: 100%; }
}

/* ==========================================================================
   Collapsible sidebar (desktop) — mobile keeps the existing drawer
   ========================================================================== */

.sidenav__head { display: flex; align-items: center; gap: 8px; }
.sidenav__head .brand { flex: 1 1 auto; min-width: 0; }
.sidenav__collapse {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); cursor: pointer;
  transition: color 0.16s, border-color 0.16s, transform 0.18s var(--ease);
}
.sidenav__collapse:hover { color: var(--ink); border-color: var(--line-strong); }
.sidenav__collapse .ic { width: 15px; height: 15px; }
.sidenav__collapse.collapse-ic { transform: none; }

/* the drawer on small screens uses the top-bar toggle instead */
@media (max-width: 980px) { .sidenav__collapse { display: none; } }

@media (min-width: 981px) {
  /* smooth width change; content column follows because it is a grid track */
  .page-admin { transition: grid-template-columns 0.22s var(--ease); }
  .sidenav, .sidenav__link, .brand { transition: padding 0.22s var(--ease), gap 0.22s var(--ease); }

  [data-nav='collapsed'] .page-admin { grid-template-columns: 76px minmax(0, 1fr); }
  [data-nav='collapsed'] .sidenav { padding: 22px 10px; align-items: center; }
  [data-nav='collapsed'] .sidenav__head { justify-content: center; width: 100%; }
  [data-nav='collapsed'] .brand__text,
  [data-nav='collapsed'] .sidenav__username,
  [data-nav='collapsed'] .tt-label { display: none; }
  [data-nav='collapsed'] .brand { justify-content: center; padding: 0; gap: 0; }
  [data-nav='collapsed'] .sidenav__collapse .ic { transform: rotate(180deg); }
  [data-nav='collapsed'] .sidenav__links { width: 100%; }
  [data-nav='collapsed'] .sidenav__link {
    justify-content: center; padding: 0; gap: 0; width: 44px; height: 44px; margin-inline: auto;
  }
  [data-nav='collapsed'] .sidenav__link > span:not(.tt-sun):not(.tt-moon) { display: none; }
  [data-nav='collapsed'] .sidenav__foot { width: 100%; align-items: center; }
  [data-nav='collapsed'] .sidenav__user { justify-content: center; padding: 0; }
  [data-nav='collapsed'] .logout-form { display: grid; justify-items: center; }
  /* active state stays obvious when the labels are gone */
  [data-nav='collapsed'] .sidenav__link.is-active {
    background: var(--ink); border-color: var(--ink); color: var(--bg); box-shadow: none;
  }
  [data-nav='collapsed'] .sidenav__link.is-active .ic { opacity: 1; }

  /* lightweight tooltip on hover / keyboard focus */
  [data-nav='collapsed'] .sidenav__link[data-label] { position: relative; }
  [data-nav='collapsed'] .sidenav__link[data-label]:hover::after,
  [data-nav='collapsed'] .sidenav__link[data-label]:focus-visible::after {
    content: attr(data-label);
    position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    background: var(--ink); color: var(--bg); font-size: 0.76rem; font-weight: 500;
    padding: 5px 10px; border-radius: 7px; white-space: nowrap; z-index: 70;
    box-shadow: var(--shadow-md); pointer-events: none;
  }
}

/* ==========================================================================
   Drive uploader
   ========================================================================== */

/* the UA rule [hidden]{display:none} loses to .btn{display:inline-flex} */
.btn[hidden], .toggle[hidden], .panel[hidden], .banner[hidden] { display: none !important; }

.page-drive .up-facts { margin: 10px 0 0; }
.up-account { display: inline-flex; align-items: center; gap: 7px; font-size: 0.86rem; color: var(--ink-2); }
.up-account .ic { width: 15px; height: 15px; color: var(--ok); }
.is-disabled { opacity: 0.5; pointer-events: none; }
.oauth-help { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); display: grid; gap: 12px; }
.oauth-help[hidden] { display: none; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 12px; }
.crumb {
  border: 0; background: none; padding: 4px 6px; border-radius: 6px;
  font-size: 0.82rem; color: var(--muted); cursor: pointer;
}
.crumb:hover { background: var(--surface-2); color: var(--ink); }
.crumb.is-current { color: var(--ink); font-weight: 600; }
.crumb-sep { color: var(--line-strong); font-size: 0.8rem; }

.folder-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.folder {
  display: flex; align-items: center; gap: 9px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  cursor: pointer; text-align: left; font-size: 0.86rem; color: var(--ink-2);
  transition: border-color 0.16s, background 0.16s;
}
.folder:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }
.folder__icon { font-size: 1rem; line-height: 1; }
.folder__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.target {
  display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px;
  border: 1px solid var(--ok); border-radius: var(--r-md); background: var(--ok-soft);
}
.target > .ic { color: var(--ok); flex: none; }
.target > div { flex: 1 1 auto; display: grid; gap: 1px; min-width: 0; }
.target strong { font-size: 0.9rem; }
.target span { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

.up-bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 14px 0 8px; }
.up-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.25s var(--ease); }
.up-summary { font-size: 0.82rem; color: var(--muted); margin-bottom: 12px; }

.queue { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.qitem {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.qitem__thumb { width: 46px; height: 46px; border-radius: 6px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-size: 1.1rem; }
.qitem__thumb img { width: 100%; height: 100%; object-fit: cover; }
.qitem__main { display: grid; gap: 3px; min-width: 0; }
.qitem__name { font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem__meta { font-size: 0.74rem; color: var(--muted); }
.qitem__meta em { font-style: normal; }
.qitem__bar { height: 3px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.qitem__bar span { display: block; height: 100%; background: var(--accent); transition: width 0.2s linear; }
.qitem__pct { font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.qitem__x {
  border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 6px;
  border-radius: 6px; font-size: 0.85rem;
}
.qitem__x:hover { background: var(--danger-soft); color: var(--danger); }
.qitem[data-status='done'] { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.qitem[data-status='done'] .qitem__pct { color: var(--ok); }
.qitem[data-status='failed'] { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.qitem[data-status='failed'] .qitem__pct { color: var(--danger); }
.qitem[data-status='uploading'] { border-color: var(--accent); }

@media (max-width: 620px) {
  .qitem { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .qitem__pct { display: none; }
  .folder-list { grid-template-columns: 1fr 1fr; }
}
