:root {
  --bg: #ffffff;
  --bg-soft: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --text: #202124;
  --text-2: #5f6368;
  --text-3: #80868b;
  --border: #e4e6e8;
  --accent: #1a73e8;
  --accent-soft: #e8f0fe;
  --danger: #d93025;
  --danger-soft: #fce8e6;
  --hover: #f1f3f4;
  --shadow: 0 1px 2px rgba(60,64,67,.18), 0 2px 6px rgba(60,64,67,.12);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.24);
  --radius: 12px;
  --topbar: 64px;
  --sidebar: 244px;
  --gap: 4px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --bg-soft: #1c1d1f;
    --surface: #202124;
    --surface-2: #2d2e30;
    --text: #e8eaed;
    --text-2: #9aa0a6;
    --text-3: #80868b;
    --border: #35363a;
    --accent: #8ab4f8;
    --accent-soft: #23324a;
    --danger: #f28b82;
    --danger-soft: #3b2221;
    --hover: #2a2b2e;
    --shadow: 0 1px 3px rgba(0,0,0,.5);
    --shadow-lg: 0 10px 36px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { -webkit-user-drag: none; user-select: none; }
::selection { background: var(--accent); color: #fff; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- layout */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 8px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 8px; min-width: 0; }
.brand-logo { width: 34px; height: 34px; flex: 0 0 auto; }
.brand-name { font-size: 19px; font-weight: 500; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none !important; }

.searchbox {
  flex: 1; max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 16px;
  background: var(--surface-2); border-radius: 999px;
  color: var(--text-2);
}
.searchbox:focus-within { background: var(--surface); box-shadow: var(--shadow); }
.searchbox input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px;
}
.searchbox input::placeholder { color: var(--text-2); }
.search-clear { border: 0; background: transparent; color: var(--text-2); display: none; padding: 4px; border-radius: 50%; }
.search-clear:hover { background: var(--hover); }
.searchbox.has-value .search-clear { display: flex; }

.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn:disabled { opacity: .4; cursor: default; }

.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, #4285f4, #34a853);
  color: #fff; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 4px;
}
.avatar-btn:hover { box-shadow: 0 0 0 4px var(--hover); }

.shell { display: flex; padding-top: var(--topbar); min-height: 100vh; }
.sidebar {
  position: fixed; top: var(--topbar); bottom: 0; left: 0; width: var(--sidebar);
  padding: 8px 12px 16px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-radius: 0 999px 999px 0; margin-right: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500; border: 0; background: transparent;
  width: calc(100% - 8px); text-align: left;
}
.nav-item svg { flex: 0 0 auto; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .nav-count { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--text-3); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 16px; }
.sidebar-foot { margin-top: auto; padding: 14px 16px 0; font-size: 12px; color: var(--text-3); line-height: 1.6; }
.storage-bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
.storage-bar > div { height: 100%; background: var(--accent); border-radius: 4px; }

main.page {
  flex: 1; min-width: 0; margin-left: var(--sidebar);
  padding: 8px 24px 80px;
}
.page-head { display: flex; align-items: center; gap: 12px; padding: 14px 4px 6px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 500; margin: 0; letter-spacing: -.3px; }
.page-sub { color: var(--text-2); font-size: 13px; }
.page-head .spacer { flex: 1; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #10203a; } }
.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { border: 0; background: none; color: var(--accent); padding: 0; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- grid */
.month-section { margin-bottom: 10px; }
.month-head {
  position: sticky; top: var(--topbar); z-index: 5;
  display: flex; align-items: baseline; gap: 8px;
  margin: 0; padding: 12px 4px 10px;
  font-size: 17px; font-weight: 600; letter-spacing: -.2px;
  background: var(--bg);
}
.month-head .month-count { font-size: 12px; font-weight: 400; color: var(--text-3); }
.rows { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: var(--gap); }

.tile {
  position: relative; flex: 0 0 auto; overflow: hidden; border-radius: 3px;
  background: var(--surface-2); cursor: pointer; outline: none;
  transform: translateZ(0);
}
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease, opacity .2s;
}
.tile:hover img { transform: scale(1.02); }
.tile.ready img { opacity: 1; }
.tile:not(.ready)::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.12) 45%, transparent 70%);
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.tile .tile-error { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 12px; text-align: center; padding: 8px; }
.tile:focus-visible { box-shadow: 0 0 0 3px var(--accent); }

.tile-badge {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0,0,0,.62); color: #fff; font-size: 11px; font-weight: 500;
  padding: 2px 6px; border-radius: 5px; pointer-events: none;
  display: flex; align-items: center; gap: 4px; backdrop-filter: blur(4px);
}
.tile-fav {
  position: absolute; left: 7px; bottom: 7px; color: #fff; pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
}
.tile-check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.95);
  background: rgba(0,0,0,.22); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  color: transparent; padding: 0; opacity: 0; transition: opacity .12s, background .12s;
}
.tile:hover .tile-check, .grid.selecting .tile-check, .tile.selected .tile-check { opacity: 1; }
.tile.selected .tile-check { background: var(--accent); border-color: #fff; color: #fff; }
.tile.selected::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: rgba(26,115,232,.22); border: 3px solid var(--accent); border-radius: 3px;
  pointer-events: none;
}
.tile.selected img { transform: scale(.94); }

.sentinel { height: 120px; display: grid; place-items: center; color: var(--text-3); }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 90px 20px; color: var(--text-2); text-align: center;
}
.empty svg { opacity: .35; }
.empty h3 { margin: 0; font-size: 17px; font-weight: 500; color: var(--text); }
.empty p { margin: 0; font-size: 13px; line-height: 1.6; max-width: 340px; }

/* ---------------------------------------------------------------- selection bar */
.selection-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  z-index: 300; display: flex; align-items: center; gap: 4px;
  background: #202124; color: #fff; padding: 6px 8px 6px 20px;
  border-radius: 999px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  max-width: calc(100vw - 24px); overflow-x: auto;
}
.selection-bar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.selection-bar .count { font-weight: 600; font-size: 14px; margin-right: 8px; white-space: nowrap; }
.selection-bar .sb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px; border: 0; border-radius: 999px;
  background: transparent; color: #e8eaed; font-size: 13px; white-space: nowrap;
}
.selection-bar .sb-btn:hover { background: rgba(255,255,255,.12); }
.selection-bar .sb-btn.danger { color: #f28b82; }
.selection-bar .divider { width: 1px; height: 22px; background: rgba(255,255,255,.2); margin: 0 4px; }
.selection-bar .sb-close { margin-left: 4px; }

/* ---------------------------------------------------------------- albums */
.album-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 22px 18px; padding: 10px 4px 30px;
}
.album-card { border: 0; background: none; padding: 0; text-align: left; color: inherit; }
.album-cover {
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.album-card:hover .album-cover img { transform: scale(1.03); }
.album-cover .album-empty-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.album-cover .shared-chip {
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,.55); color: #fff; border-radius: 999px; padding: 3px 8px; font-size: 11px;
}
.album-meta { padding: 9px 2px 0; }
.album-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.album-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------------------------------------------------------------- upload */
.uploader {
  position: fixed; right: 18px; bottom: 18px; z-index: 400; width: min(360px, calc(100vw - 24px));
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); overflow: hidden;
  transform: translateY(12px); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.uploader.show { opacity: 1; transform: none; pointer-events: auto; }
.uploader-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.uploader-head .title { font-weight: 600; font-size: 13px; flex: 1; }
.uploader-head .sub { font-size: 12px; color: var(--text-2); }
.uploader-list { max-height: 220px; overflow-y: auto; padding: 6px 0; }
.upload-row { display: flex; align-items: center; gap: 10px; padding: 6px 14px; font-size: 12px; }
.upload-row .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-row .pct { color: var(--text-2); font-variant-numeric: tabular-nums; }
.upload-row .bar { position: absolute; }
.upload-progress { height: 3px; background: var(--surface-2); }
.upload-progress > div { height: 100%; background: var(--accent); transition: width .15s; }
.upload-row.done .pct { color: #188038; }
.upload-row.error .pct { color: var(--danger); }

/* ---------------------------------------------------------------- lightbox */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: #0b0b0c; color: #fff; display: flex; flex-direction: column; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lb-top {
  position: absolute; inset: 0 0 auto 0; z-index: 4; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; min-height: 60px;
  background: linear-gradient(to bottom, rgba(0,0,0,.7), transparent);
}
.lb-top .lb-title { flex: 1; min-width: 0; padding: 0 8px; }
.lb-top .lb-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-top .lb-date { font-size: 12px; color: rgba(255,255,255,.65); margin-top: 2px; }
.lb-btn { width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.lb-btn:hover { background: rgba(255,255,255,.14); }
.lb-btn.fav-on { color: #f28b82; }
.lb-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.lb-stage img.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .18s ease; will-change: transform; user-select: none; }
.lb-stage video { max-width: 100%; max-height: 100%; background: #000; outline: 0; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.35); color: #fff; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); opacity: .9;
}
.lb-nav:hover { background: rgba(0,0,0,.6); }
.lb-nav.prev { left: 14px; } .lb-nav.next { right: 14px; }
.lb-nav:disabled { opacity: .2; }
.lb-counter { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-size: 12px; color: rgba(255,255,255,.7); background: rgba(0,0,0,.4); padding: 4px 10px; border-radius: 999px; }
.lb-info {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); z-index: 5;
  background: #1c1d1f; border-left: 1px solid #303134; padding: 70px 22px 24px;
  overflow-y: auto; transform: translateX(100%); transition: transform .22s ease;
}
.lb-info.show { transform: none; }
.lb-info h4 { margin: 0 0 14px; font-size: 13px; color: #9aa0a6; font-weight: 500; letter-spacing: .3px; text-transform: uppercase; }
.info-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid #2b2c2f; font-size: 13px; }
.info-row .k { color: #9aa0a6; flex: 0 0 auto; }
.info-row .v { text-align: right; word-break: break-word; }
.lb-info .info-desc { white-space: pre-wrap; font-size: 13px; line-height: 1.6; color: #e8eaed; }
.lb-menu {
  position: absolute; top: 56px; right: 14px; z-index: 10; min-width: 210px;
  background: #2d2e30; border-radius: 10px; padding: 6px; box-shadow: var(--shadow-lg);
}
.lb-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 7px; background: transparent; color: #e8eaed; font-size: 13px; text-align: left; }
.lb-menu button:hover { background: rgba(255,255,255,.1); }
.lb-menu button.danger { color: #f28b82; }

/* ---------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fadeIn .14s;
}
.modal {
  width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 24px; animation: pop .16s ease;
}
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
.modal.wide { width: min(860px, 100%); }
.modal h3 { margin: 0 0 6px; font-size: 19px; font-weight: 600; }
.modal .modal-sub { color: var(--text-2); font-size: 13px; margin: 0 0 18px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg); outline: 0;
}
.field textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 13px; margin: 10px 0; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-error { color: var(--danger); font-size: 12.5px; margin: 10px 0 0; min-height: 16px; }

/* picker */
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; max-height: 52vh; overflow-y: auto; padding: 4px; }
.picker-tile { position: relative; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: var(--surface-2); border: 0; padding: 0; }
.picker-tile img { width: 100%; height: 100%; object-fit: cover; }
.picker-tile .pick-check { position: absolute; top: 5px; left: 5px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.25); display: grid; place-items: center; color: transparent; }
.picker-tile.picked .pick-check { background: var(--accent); color: #fff; }
.picker-tile.picked::after { content: ""; position: absolute; inset: 0; background: rgba(26,115,232,.28); border: 2px solid var(--accent); }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #323232; color: #fff; padding: 11px 18px; border-radius: 9px;
  font-size: 13px; box-shadow: var(--shadow-lg); animation: toastIn .2s;
  max-width: min(560px, calc(100vw - 30px)); line-height: 1.45;
}
.toast.error { background: #c5221f; }
.toast.success { background: #137333; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg-soft); }
.auth-card {
  width: min(430px, 100%); background: var(--surface); border-radius: 22px;
  padding: 34px 32px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.auth-logo { width: 58px; height: 58px; margin-bottom: 16px; }
.auth-card h1 { margin: 0 0 6px; font-size: 23px; font-weight: 600; letter-spacing: -.4px; }
.auth-card .sub { color: var(--text-2); font-size: 13.5px; margin: 0 0 24px; line-height: 1.55; }
.auth-tabs { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; }
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.auth-card .btn-primary { width: 100%; height: 44px; margin-top: 6px; }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--text-3); text-align: center; line-height: 1.6; }

/* ---------------------------------------------------------------- admin */
.admin-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 6px 0 22px; overflow-x: auto; }
.admin-tabs button { border: 0; background: none; padding: 12px 16px; font-size: 14px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.admin-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { background: var(--surface-2); border-radius: 14px; padding: 16px 18px; }
.stat-card .label { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.stat-card .value { font-size: 22px; font-weight: 600; letter-spacing: -.4px; }
.stat-card .foot { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.admin-section { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; margin-bottom: 18px; }
.admin-section h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.admin-section .desc { color: var(--text-2); font-size: 12.5px; margin: 0 0 14px; line-height: 1.55; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-wrap { overflow-x: auto; }
.invite-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: 1.5px; font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--surface-2); color: var(--text-2); }
.badge.admin { background: var(--accent-soft); color: var(--accent); }
.progress-line { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.progress-line > div { height: 100%; background: var(--accent); transition: width .3s; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; min-width: 140px; flex: 1; }
.inline-form .btn { height: 42px; }

/* ---------------------------------------------------------------- share page */
.share-head { max-width: 1200px; margin: 0 auto; padding: 40px 20px 18px; text-align: center; }
.share-head h1 { margin: 0 0 8px; font-size: 26px; font-weight: 600; letter-spacing: -.5px; }
.share-head p { margin: 0; color: var(--text-2); font-size: 13px; }
.share-body { max-width: 1400px; margin: 0 auto; padding: 0 16px 60px; }
.share-foot { text-align: center; color: var(--text-3); font-size: 12px; padding: 20px 0 50px; }
.pw-card { width: min(400px, 100%); margin: 80px auto; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 30px; }
.pw-card h2 { margin: 12px 0 6px; font-size: 19px; }
.pw-card p { color: var(--text-2); font-size: 13px; margin: 0 0 18px; }

/* ---------------------------------------------------------------- misc */
.menu-pop {
  position: fixed; z-index: 1500; min-width: 210px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 11px; padding: 6px; box-shadow: var(--shadow-lg);
}
.menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 12px; border-radius: 7px; font-size: 13px; text-align: left; color: var(--text); }
.menu-pop button:hover { background: var(--hover); }
.menu-pop button.danger { color: var(--danger); }
.menu-pop .sep { height: 1px; background: var(--border); margin: 5px 6px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.tag button { border: 0; background: none; padding: 0; color: var(--text-3); display: flex; }

.drawer-backdrop { display: none; }

@media (max-width: 980px) {
  :root { --sidebar: 0px; }
  .menu-btn { display: inline-flex !important; }
  .brand-name { font-size: 17px; }
  .sidebar {
    z-index: 80; width: 260px; background: var(--bg);
    transform: translateX(-100%); transition: transform .22s ease;
    border-right: 1px solid var(--border); box-shadow: var(--shadow-lg);
    top: 0; padding-top: 18px;
  }
  body.drawer-open .sidebar { transform: none; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
  main.page { margin-left: 0; padding: 4px 14px 90px; }
  .searchbox { max-width: none; }
  .month-head { top: 0; }
  .brand { padding: 0 4px; }
  .topbar { padding: 0 6px; gap: 4px; }
}
@media (max-width: 640px) {
  .brand-name { display: none; }
  .top-actions .upload-btn span { display: none; }
  .top-actions .upload-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
  .searchbox { height: 42px; padding: 0 12px; }
  .page-title { font-size: 19px; }
  .selection-bar { bottom: 12px; padding-left: 14px; }
  .lb-info { width: 100%; }
  .lb-nav { width: 40px; height: 40px; }
  .lb-nav.prev { left: 6px; } .lb-nav.next { right: 6px; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 12px; }
  .modal { padding: 20px; border-radius: 16px; }
  .toasts { bottom: 120px; }
}

@media (hover: none), (pointer: coarse) {
  .tile-check { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- drop zone */
.drop-overlay {
  position: fixed; inset: 10px; z-index: 900; display: none;
  place-items: center; gap: 12px; flex-direction: column;
  border: 3px dashed var(--accent); border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 9%, var(--bg));
  color: var(--accent); font-size: 17px; font-weight: 600; pointer-events: none;
}
.drop-overlay.show { display: grid; }
.drop-overlay svg { opacity: .85; }

/* ---------------------------------------------------------------- key/value rows */
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv-row .k { color: var(--text-2); flex: 0 0 auto; }
.kv-row .v { text-align: right; word-break: break-all; }
