:root {
  color-scheme: light;
  /* Sunlit Editorial Gallery Palette */
  --bg: #F6F3ED;
  --bg-warm: #EFEAE1;
  --panel: #FFFFFF;
  --tile: #F2EFE9;
  --edge: #E6E0D5;
  --line: #D8D0C3;

  --fg: #1F1C19;
  --soft: #4F4840;
  --mut: #7A7167;
  --dim: #9E958A;

  --on-accent: #FFFFFF;
  --danger: #C54646;
  --success: #3B7D5A;

  --shadow-xs: 0 1px 2px rgba(31, 28, 25, 0.05);
  --shadow-sm: 0 2px 10px rgba(31, 28, 25, 0.05), 0 1px 2px rgba(31, 28, 25, 0.04);
  --shadow-md: 0 12px 32px rgba(31, 28, 25, 0.09), 0 2px 6px rgba(31, 28, 25, 0.05);
  --shadow-lg: 0 24px 60px rgba(24, 20, 16, 0.16), 0 4px 14px rgba(24, 20, 16, 0.08);

  --c: #C4684B;
  --c-rgb: 196, 104, 75;
  --c-deep: #A85338;

  --radius: 14px;
  --radius-sm: 10px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
}

html[data-accent="terracotta"] { --c: #C4684B; --c-rgb: 196, 104, 75;  --c-deep: #A65237; }
html[data-accent="sage"]       { --c: #4E7A62; --c-rgb: 78, 122, 98;   --c-deep: #3D634F; }
html[data-accent="aegean"]     { --c: #356B94; --c-rgb: 53, 107, 148;  --c-deep: #295679; }
html[data-accent="teal"]       { --c: #227D7B; --c-rgb: 34, 125, 123;  --c-deep: #1A6563; }
html[data-accent="plum"]       { --c: #7A5488; --c-rgb: 122, 84, 136;  --c-deep: #62416E; }
html[data-accent="ochre"]      { --c: #B88022; --c-rgb: 184, 128, 34;  --c-deep: #99691A; }
html[data-accent="rose"]       { --c: #B7566B; --c-rgb: 183, 86, 107;  --c-deep: #984255; }
html[data-accent="espresso"]   { --c: #2C2622; --c-rgb: 44, 38, 34;    --c-deep: #1B1714; }

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 90% 50% at 50% -10%, rgba(var(--c-rgb), 0.08), transparent 65%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: var(--c); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
.hidden { display: none !important; }
.mut { color: var(--mut); }
.sm { font-size: 12.5px; }
.pad { padding: 16px; }
.grow { flex: 1; min-width: 0; }
.self-start { align-self: flex-start; }
.align-end { align-self: flex-end; }
.row-gap { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--fg);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:hover:not(:disabled) {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  transform: translateY(-0.5px);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-block { width: 100%; border-radius: 12px; padding: 11px 16px; }

.btn-primary {
  background: var(--c);
  border-color: var(--c);
  color: var(--on-accent);
  box-shadow: 0 4px 14px rgba(var(--c-rgb), 0.28);
}
.btn-primary:hover:not(:disabled) {
  background: var(--c-deep);
  border-color: var(--c-deep);
  box-shadow: 0 6px 18px rgba(var(--c-rgb), 0.34);
}
.btn-ghost {
  background: var(--panel);
  border-color: var(--edge);
  color: var(--soft);
}
.btn-ghost:hover:not(:disabled) { color: var(--fg); border-color: var(--line); background: #FCFBF9; }
.btn-danger {
  background: rgba(197, 70, 70, 0.08);
  border-color: rgba(197, 70, 70, 0.28);
  color: var(--danger);
  box-shadow: none;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(197, 70, 70, 0.14);
  border-color: rgba(197, 70, 70, 0.5);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--soft);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: border-color .15s, color .15s, background .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--fg); border-color: var(--line); background: var(--tile); }
.icon-btn.favorited {
  color: var(--c);
  border-color: rgba(var(--c-rgb), 0.45);
  background: rgba(var(--c-rgb), 0.11);
}
.icon-btn.favorited svg { fill: var(--c); }

/* Form fields */
.form-stack { display: flex; flex-direction: column; gap: 13px; }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field span { font-size: 12px; color: var(--soft); font-weight: 600; letter-spacing: 0.01em; }
input[type="text"], input[type="password"], input[type="search"], select {
  background: #FAF8F5;
  border: 1px solid var(--edge);
  border-radius: 11px;
  padding: 10px 13px;
  color: var(--fg);
  outline: none;
  min-width: 0;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input:focus, select:focus {
  background: var(--panel);
  border-color: var(--c);
  box-shadow: 0 0 0 3px rgba(var(--c-rgb), 0.14);
}
.form-error {
  padding: 10px 13px;
  border-radius: 11px;
  background: rgba(197, 70, 70, 0.08);
  border: 1px solid rgba(197, 70, 70, 0.28);
  color: #A63434;
  font-size: 13px;
  font-weight: 500;
}
.info-banner {
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(var(--c-rgb), 0.08);
  border: 1px solid rgba(var(--c-rgb), 0.24);
  color: var(--fg);
  font-size: 13px;
}

/* Auth Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background:
    radial-gradient(circle at 20% 20%, rgba(var(--c-rgb), 0.11), transparent 45%),
    radial-gradient(circle at 82% 80%, rgba(212, 180, 131, 0.14), transparent 45%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 20px;
  padding: 30px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.auth-brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.auth-brand p { margin: 4px 0 0; font-size: 13px; }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: rgba(var(--c-rgb), 0.11);
  border: 1px solid rgba(var(--c-rgb), 0.24);
  color: var(--c);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark.sm { width: 34px; height: 34px; border-radius: 10px; }
.brand-mark.sm svg { width: 18px; height: 18px; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--edge);
}
.topbar-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 11px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--fg);
}
.brand-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Segmented Floating Pill Navigation */
.nav-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg-warm);
  border: 1px solid var(--edge);
}
.nav-tab {
  padding: 6px 15px;
  border-radius: 999px;
  background: transparent;
  border: none;
  color: var(--mut);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.nav-tab:hover { color: var(--fg); }
.nav-tab.active {
  background: var(--panel);
  color: var(--c);
  box-shadow: var(--shadow-xs);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 245px;
}
.search-wrap input {
  width: 100%;
  padding: 8px 30px 8px 34px;
  font-size: 13px;
  border-radius: 999px;
  background: var(--bg);
}
.search-wrap input:focus { background: var(--panel); }
.search-ico {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--dim);
  pointer-events: none;
}
.icon-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--mut);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.user-chip:hover { border-color: rgba(var(--c-rgb), 0.5); box-shadow: var(--shadow-sm); }
.user-avatar {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: rgba(var(--c-rgb), 0.14);
  color: var(--c);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--soft); }

/* Main area */
.main-content {
  max-width: 1560px;
  margin: 0 auto;
  padding: 22px 22px 72px;
}

.setup-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px;
  margin-bottom: 22px;
  background: linear-gradient(135deg, #FFFFFF 0%, rgba(var(--c-rgb), 0.06) 100%);
  border: 1px solid rgba(var(--c-rgb), 0.25);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.setup-banner strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  display: block;
}
.setup-banner p { margin: 4px 0 0; }

.subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  min-height: 38px;
}
.subbar-left, .subbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.subbar-left strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.crumb-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--mut);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.crumb-btn:hover { background: var(--bg-warm); color: var(--fg); }
.crumb-btn.current {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--fg);
  cursor: default;
  padding-left: 4px;
}
.crumb-btn.current:hover { background: none; }
.crumb-sep { color: var(--dim); }

.pill-group {
  display: inline-flex;
  background: var(--bg-warm);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.pill {
  border: none;
  background: transparent;
  color: var(--mut);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.pill:hover { color: var(--fg); }
.pill.active {
  background: var(--panel);
  color: var(--c);
  box-shadow: var(--shadow-xs);
}

.section-heading {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mut);
  font-weight: 700;
  margin: 0 0 12px;
}

/* Folder Album Cards (Gallery Print Frames) */
.folders-section { margin-bottom: 30px; }
.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.folder-card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 8px 8px 0 8px;
}
.folder-card:hover {
  border-color: rgba(var(--c-rgb), 0.45);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.folder-cover {
  aspect-ratio: 4 / 3;
  background: var(--tile);
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}
.folder-cover.mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  background: var(--panel);
}
.folder-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.folder-card:hover .folder-cover img { transform: scale(1.03); }
.folder-cover-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  background: linear-gradient(135deg, var(--tile), var(--bg-warm));
}
.folder-cover-empty svg { width: 38px; height: 38px; }
.folder-info { padding: 12px 6px 13px; }
.folder-name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--mut);
}

/* Photo Grid & Timeline Months */
.month-group { margin-bottom: 30px; }
.month-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 0 11px;
  border-bottom: 1px solid var(--edge);
  margin-bottom: 14px;
}
.month-title {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--fg);
}
.month-count { font-size: 12.5px; color: var(--mut); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
}
.photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--tile);
  border: 1px solid rgba(31, 28, 25, 0.06);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  display: block;
  box-shadow: var(--shadow-xs);
  transition: transform .2s ease, box-shadow .2s ease;
}
.photo-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.photo-tile:hover img { transform: scale(1.04); }

.tile-video-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(20, 18, 16, 0.68);
  backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tile-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 24px 10px 8px;
  background: linear-gradient(transparent, rgba(20, 17, 15, 0.68));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  opacity: 0;
  transition: opacity .18s ease;
}
.photo-tile:hover .tile-overlay,
.photo-tile.has-badges .tile-overlay { opacity: 1; }
.tile-date {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #FFFFFF;
  font-weight: 600;
}
.tile-heart { color: #FF9A8B; }

.empty-state {
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--mut);
}
.empty-state strong {
  display: block;
  font-family: var(--serif);
  color: var(--fg);
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 6px;
}
.load-more-wrap { display: flex; justify-content: center; margin-top: 26px; }

/* Lightbox: Warm Dark Gallery Stage + Sunlit Crisp White Drawer */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #141210;
  display: flex;
  flex-direction: column;
}
.lb-topbar {
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(20, 18, 16, 0.92);
  backdrop-filter: blur(12px);
  color: #F6F3ED;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.lb-topbar .icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #F6F3ED;
}
.lb-topbar .icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #FFFFFF;
}
.lb-topbar .icon-btn.favorited {
  background: rgba(var(--c-rgb), 0.28);
  border-color: rgba(var(--c-rgb), 0.75);
  color: #FFB4A2;
}
.lb-topbar .icon-btn.favorited svg { fill: #FFB4A2; }
.lb-title-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-meta-top { min-width: 0; }
.lb-filename {
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-submeta { font-size: 12px; color: rgba(246, 243, 237, 0.68); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.lb-badge { font-size: 12px; font-weight: 600; }

.lb-body {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
}
.lb-stage {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #141210;
}
.lb-media-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.lb-media-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
  cursor: zoom-in;
  transition: transform .22s ease;
}
.lb-media-wrap img.zoomed {
  max-width: none;
  max-height: none;
  transform: scale(1.8);
  cursor: zoom-out;
}
.lb-media-wrap video {
  max-width: 100%;
  max-height: 100%;
  background: #000;
  border-radius: 6px;
  outline: none;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 18, 16, 0.65);
  backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.lb-nav:hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.4); }
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }

.lb-drawer {
  width: 350px;
  flex-shrink: 0;
  background: var(--panel);
  color: var(--fg);
  border-left: 1px solid var(--edge);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.lb-drawer-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--edge);
}
.drawer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mut);
  font-weight: 700;
  margin-bottom: 10px;
}
.detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  font-size: 13px;
}
.detail-list dt { color: var(--mut); }
.detail-list dd { margin: 0; color: var(--fg); word-break: break-word; font-weight: 500; }
.lb-fav-names { margin-top: 10px; font-size: 12.5px; }
.lb-danger-row { margin-top: 14px; }

.comments-section { flex: 1; display: flex; flex-direction: column; border-bottom: none; }
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  flex: 1;
}
.comment-item {
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px 12px;
}
.comment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}
.comment-author { font-weight: 700; color: var(--c); }
.comment-time { color: var(--dim); }
.comment-body { font-size: 13px; white-space: pre-wrap; word-break: break-word; color: var(--fg); }
.comment-del {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  font-size: 15px;
  padding: 0 2px;
}
.comment-del:hover { color: var(--danger); }
.comment-form { display: flex; gap: 7px; margin-top: auto; }
.comment-form input { flex: 1; padding: 8px 12px; font-size: 13px; border-radius: 999px; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(24, 20, 16, 0.42);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-sm { max-width: 430px; }
.modal-lg { max-width: 740px; }
.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--edge);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modal-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.modal-tabs {
  display: flex;
  gap: 6px;
  padding: 11px 22px;
  border-bottom: 1px solid var(--edge);
  background: var(--bg);
  overflow-x: auto;
}
.modal-tabs .nav-tab {
  background: transparent;
  border: 1px solid transparent;
}
.modal-tabs .nav-tab.active {
  background: var(--panel);
  border-color: var(--edge);
  color: var(--c);
  box-shadow: var(--shadow-xs);
}
.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--edge);
  background: #FCFBF9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modal-footer.flush { padding: 14px 0 0; margin-top: 8px; background: transparent; }

/* Upload modal */
.upload-dest-row { display: flex; gap: 10px; margin-bottom: 16px; }
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  background: var(--bg);
  padding: 32px 18px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  transition: border-color .15s, background .15s;
}
.dropzone svg { width: 30px; height: 30px; color: var(--c); }
.dropzone:hover, .dropzone.dragover {
  border-color: var(--c);
  background: rgba(var(--c-rgb), 0.07);
}
.upload-queue {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upload-row {
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px 12px;
}
.upload-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.upload-row-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.upload-bar {
  margin-top: 7px;
  height: 5px;
  background: var(--edge);
  border-radius: 99px;
  overflow: hidden;
}
.upload-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--c);
  transition: width .12s linear;
}
.upload-row.done .upload-bar-fill { background: var(--success); }
.upload-row.err .upload-bar-fill { background: var(--danger); }

/* Settings blocks */
.settings-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--edge);
}
.settings-block:first-child { padding-top: 0; }
.settings-block:last-child { border-bottom: none; padding-bottom: 0; }
.settings-block h3 {
  margin: 0 0 11px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
}

.accent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.accent-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: var(--bg);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color .15s, background .15s;
}
.accent-swatch:hover { border-color: var(--line); }
.accent-swatch.active {
  border-color: var(--c);
  background: rgba(var(--c-rgb), 0.1);
  color: var(--c);
}
.accent-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 13px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: 11px;
}
.copy-row code {
  flex: 1;
  font-size: 12px;
  color: var(--soft);
  word-break: break-all;
}

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid var(--edge);
  background: var(--bg);
  color: var(--mut);
}
.status-pill.ok {
  color: var(--success);
  border-color: rgba(59, 125, 90, 0.32);
  background: rgba(59, 125, 90, 0.1);
}

.drive-browser {
  margin: 10px 0 13px;
  border: 1px solid var(--edge);
  border-radius: 13px;
  background: var(--panel);
  overflow: hidden;
}
.drive-browser-bar {
  padding: 9px 12px;
  border-bottom: 1px solid var(--edge);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.drive-browser-list { max-height: 220px; overflow-y: auto; }
.drive-folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--edge);
}
.drive-folder-row:last-child { border-bottom: none; }
.drive-folder-open {
  background: none;
  border: none;
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-align: left;
  flex: 1;
  min-width: 0;
}
.drive-folder-open:hover { color: var(--c); }

.users-list { display: flex; flex-direction: column; gap: 9px; }
.user-row {
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.user-row-info strong { display: inline-flex; align-items: center; gap: 6px; }
.role-tag {
  font-size: 10.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(var(--c-rgb), 0.12);
  color: var(--c);
  font-weight: 700;
}
.role-tag.off { background: rgba(197, 70, 70, 0.12); color: var(--danger); }

/* Toasts */
#toast-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 4px solid var(--c);
  color: var(--fg);
  padding: 11px 15px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--success); }

/* Responsive */
@media (max-width: 900px) {
  .hide-md { display: none; }
  .search-wrap { width: 175px; }
  .lb-body { flex-direction: column; }
  .lb-drawer {
    width: 100%;
    max-height: 46vh;
    border-left: none;
    border-top: 1px solid var(--edge);
  }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .topbar-inner { padding: 9px 12px; gap: 8px; }
  .topbar-left { width: 100%; justify-content: space-between; }
  .topbar-right { width: 100%; }
  .main-content { padding: 16px 12px 64px; }
  .search-wrap { flex: 1; width: auto; }
  .folders-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .photo-tile { border-radius: 8px; }
  .grid-2 { grid-template-columns: 1fr; }
  .accent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lb-nav { width: 38px; height: 38px; font-size: 22px; }
}
