/* =============================================================== Álbum de Fotos */
:root {
  --bg: #f5f5f4;
  --bg-2: #ffffff;
  --bg-3: #efeeec;
  --fg: #1c1b1a;
  --fg-2: #57534e;
  --fg-3: #8a847e;
  --line: #e4e2df;
  --line-2: #d6d3cf;
  --acc: #e2456b;
  --acc-2: #ff8a5b;
  --acc-fg: #ffffff;
  --acc-soft: rgba(226, 69, 107, .10);
  --ok: #15803d;
  --warn: #b45309;
  --bad: #c0262d;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.22);
  --r: 14px;
  --r-sm: 9px;
  --header-h: 64px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tile: 200px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e0f12;
  --bg-2: #16181d;
  --bg-3: #1d2027;
  --fg: #ecebe9;
  --fg-2: #b4b0aa;
  --fg-3: #827d77;
  --line: #262a32;
  --line-2: #333844;
  --acc-soft: rgba(226, 69, 107, .16);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--fg-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--acc); animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: grid; place-items: center; padding: 80px 0; }

/* ----------------------------------------------------------------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg);
  font-weight: 560; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--bg-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--acc); outline-offset: 2px;
}
.btn.primary { background: linear-gradient(135deg, var(--acc-2), var(--acc)); border-color: transparent; color: var(--acc-fg); box-shadow: 0 4px 14px rgba(226,69,107,.28); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-3); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm);
  border: 0; background: transparent; cursor: pointer; color: var(--fg-2);
}
.icon-btn:hover { background: var(--bg-3); color: var(--fg); }
.icon-btn.active { background: var(--acc-soft); color: var(--acc); }

/* ---------------------------------------------------------------- campos */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.field .hint { font-size: 12px; color: var(--fg-3); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--bg-2); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); outline: none; }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.select.sm, .input.sm { height: 34px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--acc); }

/* --------------------------------------------------------------- cabeçalho */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; flex: none; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 8px; color: var(--fg-2); font-weight: 560; font-size: 14px; }
.nav a:hover { background: var(--bg-3); color: var(--fg); }
.nav a.active { color: var(--fg); background: var(--bg-3); }
.top-search { position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
.top-search .input { height: 40px; padding-left: 40px; border-radius: 20px; background: var(--bg-3); border-color: transparent; }
.top-search .input:focus { background: var(--bg-2); }
.top-search > svg { position: absolute; left: 14px; top: 11px; color: var(--fg-3); pointer-events: none; }
.top-search kbd { position: absolute; right: 12px; top: 10px; font: 600 11px var(--font); color: var(--fg-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; }
.top-right { display: flex; align-items: center; gap: 6px; flex: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--acc-2), var(--acc)); color: #fff; font-weight: 700; font-size: 13px;
  border: 0; cursor: pointer; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.suggest {
  position: fixed; z-index: 300; min-width: 220px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 6px; max-height: 420px; overflow: auto;
}
.suggest h6 { margin: 8px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); }
.suggest button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
}
.suggest button:hover, .suggest button.hl { background: var(--bg-3); }
.suggest button svg { color: var(--fg-3); }
.suggest .empty { padding: 10px; color: var(--fg-3); font-size: 13px; }

.menu {
  position: fixed; z-index: 80; min-width: 210px; padding: 6px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: pop .12s ease-out;
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; font-size: 14px; text-align: left;
}
.menu button:hover, .menu a:hover { background: var(--bg-3); }
.menu .danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu .head { padding: 8px 11px 10px; }
.menu .head b { display: block; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* --------------------------------------------------------------- layout */
main.view { max-width: 1480px; margin: 0 auto; padding: 26px 24px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 28px; font-weight: 750; }
.page-head .sub { color: var(--fg-3); margin-top: 4px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--bg-3); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--fg-2);
}
.seg button.on { background: var(--bg-2); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.icons button { padding: 0 9px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  padding: 70px 20px; border: 2px dashed var(--line-2); border-radius: 20px; color: var(--fg-2);
}
.empty-state .big-ic { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc); }
.empty-state .big-ic svg { width: 30px; height: 30px; }
.empty-state h3 { font-size: 19px; color: var(--fg); }
.empty-state p { margin: 0; max-width: 420px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 13px;
  background: var(--bg-3); color: var(--fg-2); font-size: 12.5px; font-weight: 560; white-space: nowrap;
  border: 1px solid transparent; cursor: default;
}
a.chip, button.chip { cursor: pointer; }
a.chip:hover, button.chip:hover { border-color: var(--line-2); color: var(--fg); }
.chip.on { background: var(--acc); color: #fff; }
.chip.acc { background: var(--acc-soft); color: var(--acc); }
.chip svg.i { width: 13px; height: 13px; }
.chip .n { opacity: .65; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 650; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px); }
.badge svg.i { width: 12px; height: 12px; }

/* --------------------------------------------------------------- álbuns */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.album-card { display: flex; flex-direction: column; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; transition: transform .18s, box-shadow .18s; }
.album-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.album-card .cover { position: relative; aspect-ratio: 4 / 3; background: var(--bg-3); overflow: hidden; }
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.album-card:hover .cover img { transform: scale(1.04); }
.album-card .cover .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg-3); }
.album-card .cover .ph svg { width: 42px; height: 42px; stroke-width: 1.4; }
.album-card .badges { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.album-card .count { position: absolute; right: 10px; bottom: 10px; }
.album-card .info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.album-card h3 { font-size: 16px; font-weight: 680; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--fg-3); font-size: 13px; }
.meta-line span, .meta-line a { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.meta-line svg.i { width: 14px; height: 14px; }
.meta-line a:hover { color: var(--acc); }
.album-card .matched { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }

.table-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow: auto; background: var(--bg-2); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); font-weight: 650; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg-3); }
.tbl tr.sel { background: var(--acc-soft); }
.tbl .thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--bg-3); }
.tbl .t-title { font-weight: 620; }
.tbl.static tbody tr { cursor: default; }

/* ------------------------------------------------------------- página álbum */
.album-hero { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: start; margin-bottom: 18px; }
.album-hero h1 { font-size: 30px; font-weight: 780; letter-spacing: -.02em; }
.album-hero .desc { color: var(--fg-2); margin: 8px 0 0; white-space: pre-line; max-width: 820px; }
.album-hero .meta-line { margin-top: 12px; font-size: 14px; }
.album-hero .people { margin-top: 12px; }
.album-hero .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-3); font-size: 13px; font-weight: 560; margin-bottom: 10px; }
.back-link:hover { color: var(--fg); }

.photo-toolbar {
  position: sticky; top: var(--header-h); z-index: 30; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; margin-bottom: 10px; background: var(--bg);
}
.photo-toolbar .range { display: flex; align-items: center; gap: 8px; color: var(--fg-3); }
.photo-toolbar input[type=range] { width: 110px; accent-color: var(--acc); }
.people-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }

/* grade */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--tile), calc(33.333% - 3px)), 1fr)); gap: 4px; }
.tile { position: relative; overflow: hidden; background: var(--bg-3); cursor: zoom-in; aspect-ratio: 1; border-radius: 4px; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s, opacity .3s; opacity: 0; }
.tile img.ld { opacity: 1; }
.tile:hover img { transform: scale(1.03); }
.tile .ov {
  position: absolute; inset: auto 0 0 0; padding: 22px 9px 7px; color: #fff; font-size: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.6)); opacity: 0; transition: opacity .2s; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile:hover .ov { opacity: 1; }
.tile .pin { position: absolute; top: 7px; right: 7px; }
.tile .selbox {
  position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9); background: rgba(0,0,0,.25); display: none; place-items: center; color: #fff;
}
.selecting .tile { cursor: pointer; }
.selecting .tile .selbox { display: grid; }
.tile.sel .selbox { background: var(--acc); border-color: var(--acc); }
.tile.sel img { transform: scale(.9); border-radius: 6px; }
.tile.sel { background: var(--acc-soft); }
.tile .selbox svg { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.tile.sel .selbox svg { opacity: 1; }

/* mosaico justificado */
.justified { display: flex; flex-direction: column; gap: 4px; }
.jrow { display: flex; gap: 4px; }
.jrow .tile { aspect-ratio: auto; flex: none; }

/* linha do tempo */
.tl-group { margin-bottom: 26px; }
.tl-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; position: sticky; top: calc(var(--header-h) + 56px); z-index: 5; background: var(--bg); padding: 6px 0; }
.tl-head h3 { font-size: 17px; font-weight: 700; }

/* barra de seleção */
.selbar {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; bottom: 22px; z-index: 50;
  display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 16px; flex-wrap: wrap; justify-content: center;
  background: var(--fg); color: var(--bg); border-radius: 16px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 24px);
  animation: up .2s ease-out;
}
.selbar .btn { background: transparent; color: var(--bg); border-color: transparent; }
.selbar .btn:hover { background: rgba(127,127,127,.25); }
.selbar .btn.danger { color: #ff8b8b; }
.selbar .count { font-weight: 700; margin-right: 6px; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

/* área de soltar */
.dropzone {
  position: fixed; inset: 0; z-index: 90; display: none; place-items: center;
  background: color-mix(in srgb, var(--acc) 22%, transparent); backdrop-filter: blur(3px);
}
.dropzone.on { display: grid; }
.dropzone > div { padding: 40px 60px; border-radius: 24px; border: 3px dashed #fff; color: #fff; font-size: 22px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 12px; background: rgba(0,0,0,.35); }
.dropzone svg.i { width: 46px; height: 46px; }
.empty-drop { cursor: pointer; transition: border-color .15s, background .15s; }
.empty-drop:hover { border-color: var(--acc); background: var(--acc-soft); }

/* ----------------------------------------------------------------- upload */
.uploader {
  position: fixed; right: 20px; bottom: 20px; z-index: 70; width: 380px; max-width: calc(100vw - 24px);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.uploader header { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.uploader header b { flex: 1; font-size: 14px; }
.uploader .total { height: 3px; background: var(--bg-3); }
.uploader .total i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--acc-2), var(--acc)); transition: width .2s; }
.uploader ul { list-style: none; margin: 0; padding: 4px 0; max-height: 300px; overflow: auto; }
.uploader.min ul, .uploader.min .total { display: none; }
.uploader li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 16px; font-size: 13px; }
.uploader li .nm { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.uploader li .st { color: var(--fg-3); font-size: 12px; }
.uploader li .st.ok { color: var(--ok); }
.uploader li .st.err { color: var(--bad); }
.uploader li .st.dup { color: var(--warn); }
.uploader li .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--bg-3); overflow: hidden; }
.uploader li .bar i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .15s; }
.uploader li.done .bar { display: none; }
.uploader li .msg { grid-column: 1 / -1; color: var(--bad); font-size: 12px; }

/* ----------------------------------------------------------------- modal */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(10,10,12,.55); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; animation: fade .15s;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--bg-2); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; overflow: hidden;
}
.modal.wide { max-width: 760px; }
.modal > header { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px 24px; }
.modal > header h2 { flex: 1; font-size: 19px; font-weight: 720; }
.modal > .body { padding: 6px 24px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg); }
.modal p { margin: 0; }
@keyframes fade { from { opacity: 0; } }

/* chip input */
.chip-input {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 5px 8px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-2); cursor: text;
}
.chip-input:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.chip-input input { flex: 1; min-width: 120px; border: 0; outline: 0; background: transparent; height: 28px; }
.chip-input .chip { background: var(--acc-soft); color: var(--acc); padding-right: 4px; }
.chip-input .chip button { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; padding: 0; }
.chip-input .chip button:hover { background: rgba(0,0,0,.1); }
.chip-input .chip svg.i { width: 12px; height: 12px; stroke-width: 2.5; }

.share-row { display: grid; grid-template-columns: 1fr 140px 38px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.share-row .who b { display: block; font-size: 14px; }
.share-row .who span { font-size: 12px; color: var(--fg-3); }
.link-box { display: flex; gap: 8px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--fg-2); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--bg-3); color: var(--fg-2); font-size: 13.5px; }

/* ----------------------------------------------------------------- toast */
.toasts { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; max-width: min(520px, calc(100vw - 30px));
  background: var(--fg); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 520; animation: pop .18s ease-out;
}
.toast.err { background: var(--bad); color: #fff; }
.toast.ok svg { color: #4ade80; }

/* ------------------------------------------------------------------ lightbox */
.lb { position: fixed; inset: 0; z-index: 150; display: flex; background: #08090b; color: #f2f2f2; animation: fade .15s; }
.lb-main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lb-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 4px; padding: 10px 12px;
  background: linear-gradient(rgba(0,0,0,.6), transparent); transition: opacity .25s;
}
.lb-top .ttl { flex: 1; min-width: 0; padding: 0 8px; }
.lb-top .ttl b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-top .ttl span { display: block; font-size: 12px; color: #a3a3a3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .icon-btn { color: #e5e5e5; }
.lb .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.lb .icon-btn.active { background: rgba(255,255,255,.18); color: #fff; }
.lb-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; cursor: zoom-in; user-select: none; }
.lb-stage.zoomed { cursor: grab; }
.lb-stage.zoomed.drag { cursor: grabbing; }
.lb-img {
  position: absolute; max-width: none; max-height: none; transform-origin: 0 0; will-change: transform;
  user-select: none; -webkit-user-drag: none; transition: opacity .2s; image-rendering: auto;
}
.lb-img.loading { opacity: .85; }
.lb-stage > .spinner { position: absolute; left: 50%; top: 50%; margin: -17px 0 0 -17px; border-color: rgba(255,255,255,.2); border-top-color: #fff; }
.lb-err { position: absolute; inset: auto 0 50% 0; transform: translateY(50%); display: flex; gap: 12px; align-items: center; justify-content: center; color: #ddd; font-size: 15px; z-index: 2; }
.lb-err .btn { background: #23252b; color: #eee; border-color: #33363e; }
.lb-zoom {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 2px; padding: 5px 8px; border-radius: 14px;
  background: rgba(22,23,27,.82); border: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0,0,0,.4); transition: opacity .25s;
}
.lb-zoom .icon-btn { width: 34px; height: 34px; }
.lb-zoom .icon-btn[disabled] { opacity: .35; pointer-events: none; }
.lb-zoom input[type=range] { width: 150px; accent-color: var(--acc); margin: 0 4px; cursor: pointer; }
.lb-zoom .zl { min-width: 50px; text-align: center; font: 600 13px var(--font); font-variant-numeric: tabular-nums; color: #eee; }
.lb-zoom .zhi { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #bbb; margin-right: 4px; }
.lb-zoom .zhi .spinner { border-color: rgba(255,255,255,.2); border-top-color: #fff; width: 14px; height: 14px; }
.lb-zoom .sep { width: 1px; height: 22px; background: rgba(255,255,255,.14); margin: 0 6px; }
.lb-zoom .zbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; border: 0;
  background: transparent; color: #e5e5e5; font: 600 13px var(--font); cursor: pointer;
}
.lb-zoom .zbtn:hover { background: rgba(255,255,255,.12); color: #fff; }
.lb-zoom .zbtn.on { background: rgba(255,255,255,.16); color: #fff; }
.lb-zoom .zbtn svg.i { width: 16px; height: 16px; }
.lb.idle .lb-zoom { opacity: 0; }
.lb-caption { bottom: 64px !important; }
.lb-nav {
  position: absolute; top: 50%; z-index: 2; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%;
  border: 0; display: grid; place-items: center; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; transition: background .15s, opacity .25s;
}
.lb-nav:hover { background: rgba(255,255,255,.2); }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }
.lb-nav svg.i { width: 26px; height: 26px; }
.lb.idle .lb-top, .lb.idle .lb-nav { opacity: 0; }
.lb-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 20px 12px; z-index: 2; text-align: center; background: linear-gradient(transparent, rgba(0,0,0,.65)); font-size: 15px; pointer-events: none; }
.lb-info { width: 360px; flex: none; background: #121317; border-left: 1px solid #23252b; overflow: auto; padding: 20px 22px 30px; display: none; }
.lb.show-info .lb-info { display: block; }
.lb-info h3 { font-size: 16px; margin-bottom: 14px; }
.lb-info dl { margin: 0; display: grid; grid-template-columns: 26px 1fr; gap: 12px 8px; font-size: 14px; }
.lb-info dt { color: #8a8a8a; padding-top: 2px; }
.lb-info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.lb-info dd small { display: block; color: #8a8a8a; font-size: 12px; }
.lb-info a { color: #ff9db3; }
.lb-info .chip { background: #23252b; color: #ddd; }
.lb-info form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid #23252b; }
.lb-info .input, .lb-info .textarea, .lb-info .chip-input { background: #1a1c21; border-color: #2c2f37; color: #eee; }
.lb-info .field > label { color: #a3a3a3; }
.suggest.dark { background: #1a1c21; border-color: #2c2f37; color: #eee; }
.suggest.dark button:hover, .suggest.dark button.hl { background: #2a2d35; }
.lb-info .chip-input .chip { background: rgba(226,69,107,.2); color: #ff9db3; }
.lb-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--acc); width: 0; z-index: 4; }
.lb-progress.run { animation: prog linear forwards; }
@keyframes prog { from { width: 0; } to { width: 100%; } }

/* ------------------------------------------------------------------- login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: linear-gradient(135deg, #ff8a5b, #e2456b 55%, #7c3aed); }
.auth-art .tiles { position: absolute; inset: -10%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; transform: rotate(-8deg); opacity: .3; }
.auth-art .tiles i { display: block; border-radius: 16px; background: rgba(255,255,255,.55); aspect-ratio: 3/4; }
.auth-art .tiles i:nth-child(3n) { aspect-ratio: 1; } .auth-art .tiles i:nth-child(4n) { aspect-ratio: 4/3; }
.auth-art .claim { position: absolute; left: 48px; bottom: 48px; right: 48px; color: #fff; }
.auth-art .claim h2 { font-size: 40px; font-weight: 800; letter-spacing: -.03em; max-width: 520px; }
.auth-art .claim p { font-size: 17px; opacity: .9; max-width: 460px; }
.auth-box { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-card .brand { font-size: 20px; margin-bottom: 18px; }
.auth-card h1 { font-size: 26px; font-weight: 760; }
.auth-card .err { padding: 10px 12px; border-radius: 10px; background: rgba(192,38,45,.1); color: var(--bad); font-size: 14px; }
.auth-card .alt { text-align: center; font-size: 14px; color: var(--fg-3); }
.auth-card .alt a { color: var(--acc); font-weight: 600; cursor: pointer; }

/* ----------------------------------------------------------------- busca */
.search-panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 26px; display: flex; flex-direction: column; gap: 14px; }
.search-main { position: relative; }
.search-main .input { height: 50px; font-size: 17px; padding-left: 48px; border-radius: 13px; }
.search-main > svg { position: absolute; left: 16px; top: 16px; color: var(--fg-3); width: 20px; height: 20px; }
.search-filters { display: grid; grid-template-columns: 1.2fr 1.2fr .9fr .9fr auto; gap: 12px; align-items: end; }
.search-filters .ac { position: relative; }
.result-head { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 14px; }
.result-head h2 { font-size: 20px; font-weight: 720; }
.interp { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--fg-3); }

/* ---------------------------------------------------------------- explorar */
.ex-section { margin-bottom: 40px; }
.ex-section > h2 { font-size: 20px; font-weight: 720; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 18px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 10px 4px; border-radius: 14px; }
.person:hover { background: var(--bg-2); }
.person .face { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 30px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--acc-2), var(--acc)); box-shadow: var(--shadow); }
.person .face img { width: 100%; height: 100%; object-fit: cover; }
.person b { font-size: 14px; } .person span { font-size: 12px; color: var(--fg-3); }
.places-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.place { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.place:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.place .pic { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; flex: none; background: var(--acc-soft); color: var(--acc); display: grid; place-items: center; }
.place .pic img { width: 100%; height: 100%; object-fit: cover; }
.place b { display: block; font-size: 14px; } .place span { font-size: 12px; color: var(--fg-3); }
.years { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.year { display: grid; grid-template-columns: 60px 1fr 150px; align-items: center; gap: 14px; padding: 6px 10px; border-radius: 10px; }
.year:hover { background: var(--bg-2); }
.year b { font-size: 16px; }
.year .bar { height: 10px; border-radius: 5px; background: var(--bg-3); overflow: hidden; }
.year .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc-2), var(--acc)); border-radius: 5px; }
.year span { font-size: 13px; color: var(--fg-3); text-align: right; }

/* ------------------------------------------------------------------ admin */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { padding: 16px 18px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.stat span { font-size: 12.5px; color: var(--fg-3); font-weight: 600; }
.stat b { display: block; font-size: 24px; font-weight: 760; margin-top: 4px; letter-spacing: -.02em; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 20px; font-size: 13.5px; padding: 16px 18px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 26px; }
.kv div span { color: var(--fg-3); }
.role { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 6px; background: var(--bg-3); }
.role.admin { background: var(--acc-soft); color: var(--acc); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.dot.off { background: var(--fg-3); }

.public-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--acc-soft); color: var(--fg-2); font-size: 14px; margin-bottom: 18px; }

/* --------------------------------------------------------------- responsivo */
@media (max-width: 1020px) {
  .search-filters { grid-template-columns: 1fr 1fr; }
  .search-filters .go { grid-column: 1 / -1; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 760px) {
  :root { --header-h: 108px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px 10px; }
  .top-search { order: 3; flex-basis: 100%; max-width: none; }
  .top-search kbd { display: none; }
  .nav a span, .hide-sm { display: none; }
  .brand span { display: none; }
  .top-right { margin-left: auto; }
  main.view { padding: 18px 14px 120px; }
  .page-head h1 { font-size: 23px; }
  .album-hero { grid-template-columns: 1fr; }
  .album-hero h1 { font-size: 24px; }
  .album-hero .actions { justify-content: flex-start; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .album-card .info { padding: 10px 12px 12px; }
  .album-card .people-row { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .lb-info { position: absolute; inset: auto 0 0 0; width: auto; max-height: 62vh; border-left: 0; border-top: 1px solid #23252b; z-index: 5; border-radius: 16px 16px 0 0; }
  .lb-nav { display: none; }
  .lb-zoom { bottom: 12px; padding: 4px 6px; }
  .lb-zoom input[type=range] { width: 80px; }
  .lb-zoom .zbtn span { display: none; }
  .lb.show-info .lb-zoom { display: none; }
  .photo-toolbar .range { display: none; }
  .uploader { right: 12px; bottom: 12px; }
  .share-row { grid-template-columns: 1fr 110px 38px; }
  .year { grid-template-columns: 50px 1fr 110px; }
  .tl-head { top: calc(var(--header-h) + 52px); }
}

/* ---------------------------------------------------- imagens com falha */
.img-fail { position: relative; background: var(--bg-3); }
.img-fail img { opacity: 0 !important; }
.img-retry {
  position: absolute; inset: 0; margin: auto; width: 40px; height: 40px; border-radius: 50%; z-index: 2;
  border: 0; display: grid; place-items: center; background: var(--bg-2); color: var(--fg-2); cursor: pointer; box-shadow: var(--shadow);
}
.img-retry:hover { color: var(--acc); }
.thumb-box { position: relative; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; background: var(--bg-3); }
.thumb-box .thumb { width: 52px; height: 52px; }
.thumb-box .img-retry { width: 28px; height: 28px; }
.thumb-box .img-retry svg.i { width: 14px; height: 14px; }
