:root {
  --bg: #0c0c0c;
  --panel: #161616;
  --ink: #ece7df;
  --muted: #8a8478;
  --line: #2a2a2a;
  --accent: #d4a574;
  --accent-ink: #1a1208;
  --danger: #c45c5c;
  --ready: #7d9a6e;
  --stored: #c4a15a;
  --failed: #c45c5c;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: Georgia, "Iowan Old Style", serif;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

.top-right { display: flex; gap: 0.75rem; align-items: center; }
.inline { display: inline; }

main { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }

h1, h2 {
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 500;
  margin: 0 0 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.15rem; }

.muted { color: var(--muted); }
.crumb { margin: 0 0 0.25rem; font-size: 0.9rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.narrow { max-width: 420px; margin: 3rem auto; }

.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.stack label { display: flex; flex-direction: column; gap: 0.35rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="file"] {
  background: #101010;
  color: var(--ink);
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}

input[readonly] { width: 100%; }

button, .button {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button:hover, .button:hover { filter: brightness(1.08); text-decoration: none; }

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid #3a3a3a;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.65rem 0.4rem; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.dim { opacity: 0.55; }

.share { display: flex; gap: 0.5rem; }

.flash.error { color: #f0c2c2; background: #2a1414; padding: 0.6rem 0.75rem; border-radius: 6px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
}

.client-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.card.picked { border-color: var(--accent); }

.thumb-wrap, .thumb-btn {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: #000;
  padding: 0;
  border: 0;
  cursor: zoom-in;
}

.thumb-wrap img, .thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ph {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.meta { padding: 0.65rem 0.75rem 0.8rem; font-size: 0.85rem; }
.meta .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiny { font-size: 0.8rem; }

.status-ready { color: var(--ready); }
.status-stored { color: var(--stored); }
.status-failed { color: var(--failed); }

.pick {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(12, 12, 12, 0.7);
  color: #6d675c;
  border: 1px solid #3a3a3a;
  padding: 0;
}

.pick.on { color: var(--accent); border-color: var(--accent); }

.count {
  background: #2a2218;
  color: var(--accent);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.pick-list { margin: 0; padding-left: 1.1rem; }

#upload-progress { font-size: 0.9rem; color: var(--muted); }
#upload-progress .bar {
  height: 4px;
  background: #2a2a2a;
  border-radius: 99px;
  overflow: hidden;
  margin: 0.35rem 0 0.75rem;
}
#upload-progress .bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
}

dialog {
  border: 1px solid var(--line);
  background: #000;
  color: var(--ink);
  max-width: min(96vw, 1100px);
  padding: 0.75rem;
}

dialog img { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto; }

code { font-size: 0.9em; color: #e6d3b4; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat {
  font-size: 1.8rem;
  margin: 0.35rem 0 0.5rem;
}
.compact { margin: 0; padding-left: 1.1rem; }
#g-signin { margin: 0.75rem 0 1rem; }
.top-right a { margin-right: 0.75rem; }


.preview-banner {
  background: #d4a574;
  color: #1a140c;
  text-align: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.92rem;
}

.choices {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  display: grid;
  gap: 0.6rem;
}

.stack label.choice,
label.choice {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.55rem;
}

.choice strong { font-weight: 650; white-space: nowrap; }
.choice .muted { white-space: nowrap; }
.toolbar-actions { display: flex; gap: 0.5rem; align-items: center; }

.film-hero {
  position: relative;
  background: #111;
  min-height: 48vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.film-hero img { max-width: 100%; max-height: 70vh; display: block; }
.film-hero .pick { position: absolute; top: 0.75rem; right: 0.75rem; }
.film-strip {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.75rem 0;
}
.film-thumb {
  border: 2px solid transparent;
  background: none;
  padding: 0;
  flex: 0 0 auto;
  width: 88px;
  cursor: pointer;
}
.film-thumb img { display: block; width: 88px; height: 66px; object-fit: cover; }
.film-thumb.current { border-color: var(--accent); }
.film-thumb.picked { outline: 1px solid var(--accent); }

.landing-card .land-list,
.land-list {
  display: grid;
  gap: 0.75rem;
  max-width: 520px;
  margin: 0 auto 2rem;
}
.land-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.75rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.land-card .thumb-wrap { width: 96px; height: 72px; }
.land-card .thumb-wrap img, .land-card .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.folio-hero {
  padding: 2.5rem 1rem 1rem;
  text-align: center;
}
.folio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.landing-folio .land-card {
  grid-template-columns: 1fr;
}
.landing-folio .land-card .thumb-wrap { width: 100%; height: 180px; }

.share-dialog {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 1rem 1.1rem;
  max-width: min(92vw, 560px);
  width: 560px;
}
.share-dialog::backdrop { background: rgba(0,0,0,0.55); }
.share-dialog h2 { margin-top: 0; }
.share-dialog .share { margin: 0.75rem 0; }

.home-hero {
  text-align: center;
  padding: 2.25rem 0.5rem 1.75rem;
  max-width: 38rem;
  margin: 0 auto;
}
.home-hero h1 { font-size: 2.05rem; line-height: 1.25; }
.lede { color: var(--muted); font-size: 1.08rem; margin: 0.75rem 0 0; }
.home-actions { margin: 1.4rem 0 0; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.home-grid .panel { margin-bottom: 0; }
.home-grid .panel p:last-child { margin-bottom: 0; }


.user-badge-wrap { position: relative; display: inline-flex; }
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.user-badge:hover { border-color: var(--accent); }
.user-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-badge .user-avatar,
.user-badge .user-avatar-initial {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #3a3228;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}
.user-badge .user-avatar { object-fit: cover; }
.user-badge .user-badge-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-badge .user-badge-caret { font-size: 10px; color: var(--muted); }

.user-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 260px;
  background: #f7f4ef;
  color: #1f1a14;
  border: 1px solid #e4ddd3;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0,0,0,.35);
  padding: 6px 0;
  z-index: 2000;
  font-size: 13px;
}
.user-menu[hidden] { display: none; }
.user-menu-section {
  padding: 8px 14px 4px 14px;
  color: #6b645a;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.user-menu-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  color: #1f1a14;
}
.user-menu-item:hover { background: #efe6d8; }
.user-menu-item.is-current { background: #f3eee6; }
.user-menu-item.is-danger { color: #b91c1c; }
.user-menu-item.is-danger:hover { background: #f8d7d7; }
.user-menu-item.is-danger .menu-icon { color: #b91c1c; }
.user-menu-item .menu-icon { color: #6b645a; }
.user-menu-item .menu-check { color: #8a5a2b; font-weight: 700; }
.user-menu-item .menu-role {
  color: #6b645a;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.user-menu-empty {
  padding: 6px 14px 10px 14px;
  color: #9a9286;
  font-style: italic;
  font-size: 12px;
}
.user-menu-divider {
  height: 1px;
  background: #e4ddd3;
  margin: 4px 0;
}
