/* Sevio Snap web app. Same tokens as the extension (extension/ui/base.css). */
@font-face {
  font-family: Inter;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --blue: #1657FE;
  --blue-dark: #0E3FC4;
  --tint: #E9F0FF;
  --tint-2: #F2F6FF;
  --text: #0B1220;
  --muted: #4A5362;
  --page: #F4F6FA;
  --surface: #FFFFFF;
  --line: #E3E7EF;
  --line-strong: #D5DAE3;
  --chip: #F0F2F6;
  --thumb: #E9ECF2;
  --danger: #B3261E;
  --danger-tint: #FCEEEE;
  --ok: #1E6B3A;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
main:focus, h1:focus, h2:focus, p:focus { outline: none; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); }

.visually-hidden, .offscreen {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }
.center { text-align: center; }
.grow { flex-grow: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-10 { display: flex; flex-direction: column; gap: 10px; }
.stack-14 { display: flex; flex-direction: column; gap: 14px; }
.boot { padding: 48px 24px; text-align: center; }
.ok-text { color: var(--ok); font-weight: 500; }
.ok-text:empty { display: none; }

/* ---- controls ---- */
.btn {
  height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text);
}
.btn:hover:not(:disabled) { background: var(--page); color: var(--text); }
.btn.primary { border-color: transparent; background: var(--blue); color: #FFFFFF; }
.btn.primary:hover:not(:disabled) { background: var(--blue-dark); color: #FFFFFF; }
.btn.danger { border-color: transparent; background: var(--danger); color: #FFFFFF; }
.btn.danger:hover:not(:disabled) { background: #8F1E18; color: #FFFFFF; }
.btn.danger-outline { color: var(--danger); }
.btn.danger-outline:hover:not(:disabled) { background: var(--danger-tint); color: var(--danger); }
.btn.text { border-color: transparent; background: transparent; color: var(--blue); padding: 0 12px; font-size: 13px; }
.btn.text:hover:not(:disabled) { background: var(--tint); color: var(--blue-dark); }
.btn.text.danger-text { color: var(--danger); }
.btn.text.danger-text:hover:not(:disabled) { background: var(--danger-tint); color: var(--danger); }
.btn.tall { height: 48px; border-radius: 12px; font-size: 15px; width: 100%; }
.btn.compact { padding: 0 12px; font-size: 13px; }
.btn.small-btn { height: 44px; margin-right: -6px; }
.link-btn { display: inline-flex; }

.field {
  height: 44px; width: 100%; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); font-size: 14px; color: var(--text);
}
.field.tall { height: 48px; border-radius: 12px; padding: 0 14px; }
.field.compact { width: auto; padding: 0 10px; font-size: 13px; }
.field.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.field::placeholder { color: #7A8291; }
.label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.check { width: 18px; height: 18px; margin: 0; }
.check-row { min-height: 44px; display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; cursor: pointer; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 500; line-height: 1.45; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--blue); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo.big { width: 48px; height: 48px; border-radius: 14px; }
.tag {
  display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px;
  background: var(--tint); color: var(--blue-dark);
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag.muted-tag { background: var(--chip); color: var(--muted); margin-top: 0; }

.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover:not(:disabled) { background: var(--chip); color: var(--text); }
.icon-btn.blue { color: var(--blue); }
.icon-btn.blue:hover:not(:disabled) { background: var(--tint); color: var(--blue-dark); }

/* ---- top bar ---- */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a {
  padding: 12px 14px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none;
  white-space: nowrap;
}
.nav a:hover { background: var(--page); color: var(--text); }
.nav a.active { background: var(--tint); color: var(--blue-dark); }
.topbar-spacer { flex-grow: 1; }
.topbar-search:empty { display: none; }
.topbar-search { flex: 1 1 220px; max-width: 320px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; display: flex; color: var(--muted); pointer-events: none; }
.search-field { padding-left: 38px; }
.topbar-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.badge-admin { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; background: var(--text); color: #FFFFFF; }
.user-email { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.topbar-user .btn.text { margin-right: -12px; }

/* ---- page ---- */
main { flex-grow: 1; display: flex; flex-direction: column; }
.page {
  padding: 32px 24px 48px; max-width: 1240px; width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 24px;
}
.page.narrow { max-width: 560px; gap: 16px; padding-top: 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.page-head.column { flex-direction: column; align-items: stretch; gap: 6px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.page-intro { font-size: 13px; margin-top: -12px; }
.page-sub { font-size: 13px; }
.summary { font-size: 13px; margin-top: -12px; }
.summary:empty { display: none; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text);
}
.chip:hover { background: var(--page); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #FFFFFF; }
.select-pill { width: auto; border-radius: 999px; font-size: 13px; font-weight: 600; padding: 0 14px; }
.more-row { display: flex; justify-content: center; }
.more-row:has(> [hidden]:only-child) { display: none; }

.empty {
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 14px; padding: 40px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
}
.empty h2 { font-size: 18px; font-weight: 700; }
.empty .btn { margin-top: 6px; }
.state-area:empty { display: none; }

/* ---- library grid ---- */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px;
}
.grid:empty { display: none; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; min-width: 0;
}
.thumb-link { display: block; height: 150px; background: var(--thumb); overflow: hidden; }
.thumb-link:focus-visible { outline-offset: -3px; }
.thumb { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.thumb.broken { visibility: hidden; }
.card-body { padding: 12px 6px 10px 14px; display: flex; flex-direction: column; gap: 8px; flex-grow: 1; }
.card-row { display: flex; align-items: center; }
.when { display: block; font-size: 14px; font-weight: 600; }
.card-meta { font-size: 12px; color: var(--muted); margin-top: -8px; padding-right: 8px; }
.source { padding-right: 8px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.source-title, .source-url {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.source-title { font-size: 13px; font-weight: 500; }
.source-url { font-size: 12px; color: var(--muted); text-decoration: none; }
a.source-url:hover { text-decoration: underline; color: var(--blue-dark); }
.expiry-row {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); margin: auto 0 -10px -14px; padding: 0 6px 0 14px; min-height: 44px;
}
.expiry-row .expiry-text { flex-grow: 1; }
.expiry-row.soon { color: #8A4B00; }
.confirm { display: flex; flex-direction: column; gap: 10px; padding: 2px 8px 2px 0; }
.confirm-text { font-size: 13px; font-weight: 600; line-height: 1.45; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.skeleton .thumb-ph {
  height: 150px; background: var(--thumb); padding: 16px; display: flex; flex-direction: column; gap: 10px; justify-content: flex-end;
}
.skeleton .thumb-ph span { height: 8px; border-radius: 4px; background: var(--line-strong); width: 85%; }
.skeleton .thumb-ph span:first-child { width: 60%; background: #C9D0DC; }
.skeleton .thumb-ph span:last-child { width: 40%; }
.skeleton .card-body { padding: 16px 14px 18px; gap: 10px; }
.ph-line { height: 10px; border-radius: 5px; background: var(--chip); }
.ph-line.w60 { width: 60%; }
.ph-line.w40 { width: 40%; }
.skeleton, .skeleton-row { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .skeleton, .skeleton-row { animation: none; } }

/* ---- admin: stats, filters, tables ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-of { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); white-space: nowrap; }
.stat-bar {
  appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px; margin-top: 4px;
  border: 0; border-radius: 3px; background: var(--line); overflow: hidden;
}
.stat-bar::-webkit-progress-bar { background: var(--line); border-radius: 3px; }
.stat-bar::-webkit-progress-value { background: var(--blue); border-radius: 3px; }
.stat-bar::-moz-progress-bar { background: var(--blue); border-radius: 3px; }
.stat-note { font-size: 12px; color: var(--muted); }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filter { flex: 1 1 150px; min-width: 0; }
.filter.wide { flex: 2 1 260px; }
.filter-action { flex: 0 0 auto; }
.filter .label { width: 100%; }
.filter > label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }

.table-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
#admin-captures-table { min-width: 860px; }
#members-table { min-width: 680px; }
.table th {
  text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; padding: 14px 8px;
}
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table td { padding: 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.table .col-check { width: 28px; padding-right: 8px; }
.table .col-actions { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.capture-cell { display: flex; align-items: center; gap: 12px; }
.mini-thumb-link { display: block; flex-shrink: 0; border-radius: 6px; }
.mini-thumb {
  display: block; width: 56px; height: 40px; border-radius: 6px; background: var(--line); border: 1px solid var(--line-strong);
  object-fit: cover; object-position: top center; flex-shrink: 0;
}
.cell-strong { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); }
.cell-person { font-weight: 500; white-space: nowrap; }
.page-cell { max-width: 280px; }
.cell-title, .cell-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-title { font-size: 13px; }
.cell-url { font-size: 12px; color: var(--muted); display: block; text-decoration: none; }
a.cell-url:hover { text-decoration: underline; color: var(--blue-dark); }
.skeleton-row td { padding: 20px 16px; }
.person-cell { padding-top: 10px; padding-bottom: 10px; }
tr.is-removed td { color: var(--muted); }

/* ---- admin: access ---- */
.access-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.access-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.access-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.panel-title { font-size: 16px; font-weight: 700; }
.pending-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pending-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px 6px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
}
.pending-row .grow { flex: 1 1 200px; padding: 6px 0; }
.pending-actions { display: flex; gap: 4px; margin-left: auto; }
.notice {
  background: var(--tint-2); border: 1px solid var(--tint); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; line-height: 1.45; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
}
.notice .btn.text { margin-left: -12px; }
.save-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---- sign in ---- */
.signin-wrap { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.signin-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 40px 28px 28px; display: flex; flex-direction: column; gap: 24px;
}
.intro { display: flex; flex-direction: column; gap: 16px; }
.intro h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.intro p { line-height: 1.5; }
.divider { display: flex; align-items: center; gap: 12px; }
.divider span { flex-grow: 1; height: 1px; background: var(--line); }
.divider em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--muted); }
.signin-card .form-error {
  background: var(--danger-tint); border-radius: 10px; padding: 10px 12px;
}

/* ---- dialogs ---- */
.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(11, 18, 32, 0.24);
}
.dialog::backdrop { background: rgba(11, 18, 32, 0.45); }
.dialog-small { width: min(440px, calc(100vw - 32px)); }
.dialog-body { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.remove-dialog .dialog-body { gap: 20px; }
.dialog-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.dialog-desc { font-size: 14px; line-height: 1.5; color: var(--muted); margin-top: -8px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.remove-form { display: flex; flex-direction: column; gap: 24px; }
.choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.legend { padding: 0; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.choice {
  padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface);
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer; min-height: 44px;
}
.choice.big { padding: 14px; }
.choice input { width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; }
.choice:has(input:checked) { border: 2px solid var(--blue); background: var(--tint-2); padding: 11px 13px; }
.choice.big:has(input:checked) { padding: 13px; }
.choice:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.choice input:focus-visible { outline: none; }
.choice.disabled { cursor: not-allowed; opacity: 0.6; }
.choice-text { display: flex; flex-direction: column; gap: 4px; }
.choice-title { font-size: 14px; font-weight: 600; }
.choice-note { font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 12px;
  background: var(--text); color: #FFFFFF; font-size: 14px; font-weight: 500; line-height: 1.45;
  box-shadow: 0 12px 32px rgba(11, 18, 32, 0.25);
}
.toast.is-error { background: var(--danger); }

/* ---- narrow screens ---- */
@media (max-width: 720px) {
  .topbar { padding: 8px 16px; }
  .topbar-spacer { display: none; }
  .brand { flex-grow: 1; }
  .topbar-user { order: 2; }
  .nav { order: 3; width: 100%; }
  .topbar-search { order: 4; flex-basis: 100%; max-width: none; }
  .user-email { max-width: 140px; }
  .page { padding: 24px 16px 40px; gap: 20px; }
  .page-title { font-size: 24px; }
  .page-intro, .summary { margin-top: -8px; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .dialog-body { padding: 22px 18px; }
  .dialog-title { font-size: 20px; }
  .signin-card { padding: 32px 20px 24px; border: 0; background: transparent; }
  .signin-wrap { align-items: flex-start; padding: 16px; background: var(--surface); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
}
.capture-cell .cell-strong, .capture-cell .cell-sub { white-space: nowrap; }
@media (max-width: 420px) {
  .user-email { display: none; }
}
