:root {
  --bg: #f5f3ef;
  --panel: #ffffff;
  --ink: #1d1c1a;
  --muted: #77736b;
  --line: #e4e0d8;
  --soft: #efece6;
  --accent: #2f6bd8;
  --danger: #c23b2a;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 8px 12px; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 500;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--soft); }
a.btn { color: var(--ink); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #3a3835; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); }
.btn.danger-ghost:hover { background: #fdf0ee; border-color: #f0c9c2; }
.btn.ghost { background: transparent; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); font-size: 13px; }
.link-btn:hover { color: var(--ink); text-decoration: underline; }
.link-btn.strong { color: var(--accent); font-size: inherit; font-weight: 600; }

.brand-mark {
  display: inline-block; width: 22px; height: 22px; border-radius: 6px;
  background: conic-gradient(from 200deg, #f2a65a, #e0607e, #6d6cd8, #3fb3a8, #f2a65a);
}

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px; display: grid; gap: 12px; text-align: center;
  box-shadow: 0 10px 40px rgba(40, 30, 10, .06);
}
.login-card .brand-mark { width: 40px; height: 40px; border-radius: 11px; margin: 0 auto 4px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.login-card input, .field input {
  height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%;
}
.login-card input:focus, .field input:focus, .group-name:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.login-card .btn { height: 42px; }

/* layout */
.app { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
}
.side-head { padding: 20px 16px 12px; display: grid; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.group-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.group-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 0; border-radius: 9px;
  background: none; cursor: pointer; text-align: left;
}
.group-item:hover { background: var(--soft); }
.group-item.active { background: #e9eefb; }
.gi-cover { width: 44px; height: 44px; border-radius: 7px; background: var(--soft); overflow: hidden; flex: none; }
.gi-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gi-text { display: grid; min-width: 0; }
.gi-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-meta { color: var(--muted); font-size: 12px; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; }

.main { padding: 28px 40px 60px; min-width: 0; }
.empty-state { max-width: 420px; margin: 18vh auto 0; text-align: center; }
.empty-state h2 { margin: 0 0 8px; }
.empty-state p { margin: 0 0 20px; line-height: 1.5; }

.group-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.group-name {
  flex: 1; min-width: 0; font-size: 28px; font-weight: 700; letter-spacing: -.01em;
  border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 4px 8px; margin-left: -9px;
}
.group-name:hover { border-color: var(--line); }
.head-actions { display: flex; gap: 8px; }

/* share card */
.share-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px 20px;
  display: grid; margin-bottom: 20px;
}
.share-card.off .share-value { text-decoration: line-through; color: var(--muted); }
.share-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--soft); }
.share-row.foot { border-bottom: 0; justify-content: space-between; }
.label { width: 80px; flex: none; color: var(--muted); font-size: 13px; font-weight: 500; }
.share-value {
  flex: 1; min-width: 0; font: 500 14px ui-monospace, "SF Mono", Menlo, monospace; background: var(--soft);
  padding: 7px 10px; border-radius: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all;
}
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 38px; height: 22px; border-radius: 11px; background: #cfcac0; position: relative; transition: background .15s; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.switch input:checked + .track { background: #2e9e64; }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* uploads */
.drop {
  border: 1.5px dashed #cfc9bd; border-radius: 14px; padding: 22px; text-align: center; margin-bottom: 24px;
  background: rgba(255, 255, 255, .5); cursor: pointer;
}
.drop p { margin: 0 0 4px; pointer-events: none; }
.drop .link-btn { pointer-events: auto; }
.progress { max-width: 460px; margin: 14px auto 0; }
.bar { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-errors { list-style: none; padding: 0; margin: 10px 0 0; color: var(--danger); font-size: 13px; }
.drop-overlay {
  position: fixed; inset: 0; z-index: 30; background: rgba(47, 107, 216, .12); border: 3px dashed var(--accent);
  display: grid; place-items: center; pointer-events: none;
}
.drop-overlay div { background: var(--panel); padding: 16px 24px; border-radius: 12px; font-size: 18px; box-shadow: 0 8px 30px rgba(0, 0, 0, .12); }

/* grid */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; min-height: 30px; font-size: 14px; }
.toolbar-actions { display: flex; gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: zoom-in; background: var(--soft); }
.grid.selecting .tile { cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s; }
.tile.selected img { transform: scale(.9); border-radius: 6px; }
.tile.selected { background: #dde6f8; }
.check {
  position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid #fff; background: rgba(0, 0, 0, .25); opacity: 0; transition: opacity .12s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.tile:hover .check, .grid.selecting .check { opacity: 1; }
.tile.selected .check { background: var(--accent); }
.tile.selected .check::after {
  content: ""; position: absolute; left: 6px; top: 3px; width: 6px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(12, 11, 10, .94); display: grid; place-items: center; }
.lightbox img { max-width: calc(100vw - 160px); max-height: calc(100vh - 100px); object-fit: contain; }
.lb-close, .lb-nav { position: absolute; background: none; border: 0; color: #fff; cursor: pointer; opacity: .75; }
.lb-close:hover, .lb-nav:hover { opacity: 1; }
.lb-close { top: 12px; right: 20px; font-size: 36px; }
.lb-nav { top: 50%; transform: translateY(-50%); font-size: 56px; padding: 20px; }
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-bottom { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 18px; color: #cfcac2; font-size: 13px; }
.lb-type select { margin-left: 6px; height: 30px; border-radius: 7px; border: 0; padding: 0 8px; background: #2c2a27; color: #fff; }

/* dialog */
.dialog { border: 0; border-radius: 16px; padding: 28px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog::backdrop { background: rgba(20, 18, 15, .4); }
.dialog h2 { margin: 0 0 12px; font-size: 20px; }
.dialog p { line-height: 1.5; margin: 0 0 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--muted); }
.field input { color: var(--ink); font-size: 15px; font-weight: 400; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

/* side nav */
.side-nav { padding: 0 8px 6px; display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; width: 100%; height: 38px; padding: 0 12px;
  border: 0; border-radius: 9px; background: none; cursor: pointer; font-weight: 600; font-size: 14px;
}
.nav-item:hover { background: var(--soft); }
.nav-item.active { background: #e9eefb; }
.badge { min-width: 22px; height: 22px; border-radius: 11px; padding: 0 7px; background: #e5484d; color: #fff; font-size: 12px; line-height: 22px; text-align: center; }
.side-label { margin: 10px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* filters and bursts in a group */
.banner {
  display: block; margin-bottom: 16px; padding: 12px 16px; border-radius: 12px; background: #fff6dd; border: 1px solid #f1dfa6;
  color: #6a5212; text-decoration: none; font-size: 14px;
}
.banner:hover { background: #fff0c7; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { background: var(--soft); }
.chip img { width: 24px; height: 24px; border-radius: 50%; margin-left: -7px; object-fit: cover; }
.chip-n { color: var(--muted); font-weight: 500; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.on .chip-n { color: #bbb; }
.chip-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 2px 0 8px; }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; margin-right: 6px; }
.burst-badge {
  position: absolute; top: 8px; right: 8px; height: 22px; padding: 0 8px 0 23px; border-radius: 11px; color: #fff;
  font-size: 12px; font-weight: 700; line-height: 22px;
  background: rgba(0, 0, 0, .6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='7' y='3' width='14' height='14' rx='2' fill='none' stroke='white' stroke-width='2'/%3E%3Cpath d='M3 7v12a2 2 0 0 0 2 2h12' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 7px center / 13px no-repeat;
}

/* people, types */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.page-head h1 { margin: 0; font-size: 28px; }
.page-head + .muted, #peopleStatus { margin: 0 0 20px; }
.narrow { max-width: 620px; line-height: 1.5; }
.section-title { font-size: 17px; margin: 28px 0 12px; }
.ask-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.ask-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.ask-card p { margin: 0; }
.ask-faces { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.ask-faces img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--soft); }
.ask-faces img:first-child { grid-column: span 2; grid-row: span 2; }
.suggest { display: flex; align-items: center; gap: 10px; font-size: 14px; background: #eef3fd; border-radius: 9px; padding: 6px 6px 6px 12px; }
.suggest .btn { margin-left: auto; }
.ask-row { display: flex; gap: 8px; }
.ask-row input { flex: 1; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; }
.ask-row input:focus, .type-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ask-card .link-btn { justify-self: start; }
.named-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.person-card { display: grid; gap: 4px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.person-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; background: var(--soft); transition: transform .12s; }
.person-card:hover img { transform: scale(1.04); }
.pc-name { font-weight: 600; text-align: center; margin-top: 6px; }
.pc-meta { font-size: 12px; color: var(--muted); text-align: center; }
.skipped-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.skipped { display: grid; gap: 4px; justify-items: center; }
.skipped img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; opacity: .7; }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 16px; }
.face { position: relative; }
.face img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.face-x {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 18px; line-height: 1; opacity: 0; transition: opacity .12s;
}
.face:hover .face-x { opacity: 1; }
.type-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; max-width: 820px; }
.type-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 6px 0 14px; border-radius: 17px;
  background: var(--panel); border: 1px solid var(--line); font-size: 14px; font-weight: 500;
}
.type-chip button { border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--muted); width: 24px; height: 24px; border-radius: 50%; }
.type-chip button:hover { background: var(--soft); color: var(--danger); }
.type-form { display: flex; gap: 8px; max-width: 420px; }
.type-form input { flex: 1; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.type-actions { margin-top: 20px; }

/* still usable on a phone or narrow window */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .group-list { max-height: 220px; }
  .main { padding: 20px 16px 40px; }
  .group-head { flex-wrap: wrap; }
  .share-row { flex-wrap: wrap; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 4px; }
  .check { opacity: 1; }
  .lightbox img { max-width: 100vw; }
}
