:root {
  --bg: #0d0f14;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #1a2130 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 10%, #1c1830 0%, transparent 55%);
  --bg-2: #161a22;
  --bg-3: #1e2430;
  --bg-hover: #232a38;
  --line: #2a3140;
  --line-soft: #222836;
  --text: #e8ebf2;
  --muted: #8a92a6;
  --accent: #e6c15a;      /* gold */
  --accent-ink: #221a02;
  --accent-2: #6ea8fe;
  --green: #46d08a;
  --red: #f0736f;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 14px;
}

:root[data-theme="light"] {
  --bg: #f4f5f8;
  --bg-grad: radial-gradient(1100px 550px at 85% -10%, #fff6dd 0%, transparent 60%),
             radial-gradient(800px 460px at -10% 5%, #e7edff 0%, transparent 55%);
  --bg-2: #ffffff;
  --bg-3: #f0f2f6;
  --bg-hover: #e9ecf3;
  --line: #e0e3ea;
  --line-soft: #eceef3;
  --text: #1a1f2b;
  --muted: #6b7180;
  --accent: #c99b1f;
  --accent-ink: #fff8e6;
  --accent-2: #2f6bff;
  --green: #17a866;
  --red: #d93b3b;
  --shadow: 0 10px 30px rgba(30,40,80,.10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.no-scroll { overflow: hidden; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  font-size: 30px; color: var(--accent);
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 55%, transparent));
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: .2px; font-weight: 700; }
.tagline { margin: 0; font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 6px; align-items: center; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 13px;
  transition: .15s; font-weight: 500;
}
.tab:hover { color: var(--text); background: var(--bg-3); }
.tab.active {
  color: var(--accent-ink);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  font-weight: 700; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.icon-toggle {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 15px; margin-left: 4px;
}
.icon-toggle:hover { border-color: var(--accent-2); }

main { padding: 24px; max-width: 1180px; margin: 0 auto; }

.panel { display: none; }
.panel.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

h2 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-3); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ---------- Summary cards ---------- */
.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-2) 100%, white 2%), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 60%, transparent), transparent);
  opacity: .5;
}
.card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.card .value { font-size: 26px; font-weight: 750; margin-top: 8px; letter-spacing: -.4px; }
.card .sub { font-size: 12px; margin-top: 5px; color: var(--muted); }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ---------- Allocation bar ---------- */
.alloc {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.alloc-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.alloc-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--bg-3); }
.alloc-seg { height: 100%; transition: width .4s ease; }
.alloc-legend {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-top: 14px;
}
.alloc-metal {
  position: relative; background: var(--bg-3); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 12px 14px 12px 16px; overflow: hidden;
}
.alloc-metal::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--mc);
}
.am-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
}
.am-oz { font-size: 22px; font-weight: 750; letter-spacing: -.3px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.am-unit { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 5px; }
.am-val { font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.am-nospot { color: var(--muted); font-style: italic; opacity: .8; }

/* ---------- Section head / toolbar ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 14px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: 9px; font-size: 13px; min-width: 200px;
}
.mini {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 8px 10px; border-radius: 9px; font-size: 13px;
}
.search:focus, .mini:focus { outline: none; border-color: var(--accent-2); }

/* ---------- Buttons ---------- */
.btn {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 9px; cursor: pointer; font-size: 13px; transition: .15s; font-weight: 500;
}
.btn:hover { border-color: var(--accent-2); background: var(--bg-hover); }
.btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  color: var(--accent-ink); border-color: transparent; font-weight: 700;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.full { width: 100%; }

/* dropdown menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 42px; z-index: 30; min-width: 190px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column;
}
.menu button {
  background: transparent; border: none; color: var(--text); text-align: left;
  padding: 9px 11px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.menu button:hover { background: var(--bg-3); }
.menu button.danger { color: var(--red); }

/* ---------- Table ---------- */
.table-wrap { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.items-table { width: 100%; border-collapse: collapse; }
.items-table th, .items-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.items-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; background: color-mix(in srgb, var(--bg-3) 40%, transparent); }
.items-table th.sortable { cursor: pointer; user-select: none; transition: color .12s; white-space: nowrap; }
.items-table th.sortable:hover { color: var(--text); }
.items-table th.sortable::after { content: "↕"; margin-left: 5px; opacity: .35; font-size: 10px; }
.items-table th.sorted-asc { color: var(--accent); }
.items-table th.sorted-desc { color: var(--accent); }
.items-table th.sorted-asc::after { content: "▲"; opacity: 1; }
.items-table th.sorted-desc::after { content: "▼"; opacity: 1; }
.items-table tr:last-child td { border-bottom: none; }
.items-table tbody tr { transition: background .12s; }
.items-table tbody tr:hover { background: var(--bg-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; background: var(--bg-3); border: 1px solid var(--line); display: block; }
.thumb-wrap { position: relative; width: 42px; height: 42px; }
.photo-count {
  position: absolute; bottom: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--bg-2);
}
.metal-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.metal-Gold { background: rgba(230,193,90,.18); color: #e6c15a; }
.metal-Silver { background: rgba(200,205,220,.16); color: #cdd2e0; }
.metal-Platinum { background: rgba(150,200,230,.16); color: #a8cbe6; }
.metal-Copper { background: rgba(216,140,95,.18); color: #d98c5f; }
.metal-Other { background: rgba(140,150,170,.16); color: #9aa3b5; }
.sub-line { color: var(--muted); font-size: 11.5px; }
.name-row { display: flex; align-items: center; gap: 8px; }
.ebay-btn {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--bg-3); color: var(--muted);
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; cursor: pointer;
  opacity: .65; transition: .12s; white-space: nowrap;
}
tr:hover .ebay-btn { opacity: 1; }
.ebay-btn:hover { color: #fff; background: #0064d2; border-color: #0064d2; } /* eBay blue */
.lbl-row { display: flex; align-items: center; justify-content: space-between; }
#ebayModalBtn { opacity: 1; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 5px 7px; border-radius: 7px; }
.icon-btn:hover { color: var(--text); background: var(--bg-hover); }

.empty { padding: 54px 40px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 40px; color: var(--accent); opacity: .5; margin-bottom: 6px; }
.empty p { margin: 4px 0; }

/* ---------- Spot prices ---------- */
.spot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 18px; }
.spot-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.spot-card h3 { margin: 0 0 12px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.spot-input-row { display: flex; align-items: center; gap: 6px; }
.spot-input-row .pfx { color: var(--muted); }
.spot-card input { flex: 1; background: var(--bg-3); border: 1px solid var(--line); color: var(--text); padding: 10px 11px; border-radius: 8px; font-size: 16px; font-variant-numeric: tabular-nums; }
.spot-card .g-note { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Forms / settings ---------- */
.form-grid { display: grid; gap: 14px; max-width: 580px; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, textarea, select { background: var(--bg-3); border: 1px solid var(--line); color: var(--text); padding: 10px 12px; border-radius: 9px; font-size: 14px; font-family: inherit; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent); }
textarea { resize: vertical; }
.wrow { display: flex; gap: 8px; }
.wrow input { flex: 1; min-width: 0; }
.wrow select { flex: 0 0 96px; }
.model-row { display: flex; gap: 8px; }
.model-row select { flex: 1; }
.settings-actions { display: flex; align-items: center; gap: 10px; margin: 20px 0 6px; }
.conn-status { font-size: 13px; }
.callout { max-width: 620px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; line-height: 1.6; }

/* ---------- Presets ---------- */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.chip {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--muted);
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; cursor: pointer; transition: .12s;
}
.chip:hover { color: var(--text); border-color: var(--accent-2); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(3px); }
.modal-backdrop.open { display: flex; animation: fade .15s ease; }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; width: 800px; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-foot { border-bottom: none; border-top: 1px solid var(--line); gap: 10px; justify-content: flex-end; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { display: grid; grid-template-columns: 290px 1fr; gap: 22px; padding: 22px; overflow: auto; }
.drop-icon { font-size: 30px; }
.photo-area.drag { outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.photo-thumb { position: relative; aspect-ratio: 1; border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-3); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ph-del {
  position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.ph-del:hover { background: var(--red); }
.add-tile {
  aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 11px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); text-align: center; font-size: 12px; padding: 8px; transition: .15s;
}
.add-tile:hover { border-color: var(--accent); background: var(--bg-3); color: var(--text); }
.add-tile.empty { grid-column: 1 / -1; aspect-ratio: auto; min-height: 210px; }
.scan-col { display: flex; flex-direction: column; gap: 10px; }
.fields-col { display: flex; flex-direction: column; gap: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-note { background: color-mix(in srgb, var(--accent-2) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent-2) 32%, transparent); color: var(--accent-2); padding: 9px 12px; border-radius: 9px; font-size: 12px; margin: 0; }

/* ---------- Media library ---------- */
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-top: 16px;
}
.media-grid.select { margin-top: 0; }
.media-cell {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-3); box-shadow: var(--shadow);
}
.media-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-cell .used {
  position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 999px;
  background: rgba(0,0,0,.6); color: #fff; font-size: 10px; font-weight: 600;
}
.media-cell .del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.media-cell .del:hover { background: var(--red); }
.media-grid.select .media-cell { cursor: pointer; }
.media-grid.select .media-cell.sel { outline: 3px solid var(--accent); outline-offset: -1px; }
.media-grid.select .media-cell .check {
  position: absolute; bottom: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px;
  display: none; align-items: center; justify-content: center;
}
.media-grid.select .media-cell.sel .check { display: flex; }
.media-grid.select .media-cell .added-badge {
  position: absolute; top: 6px; left: 6px; padding: 3px 9px; border-radius: 999px;
  background: var(--green); color: #06231a; font-size: 10.5px; font-weight: 800;
  display: flex; align-items: center; gap: 3px; z-index: 1;
}
.media-grid.select .media-cell .used-badge {
  position: absolute; bottom: 6px; left: 6px; max-width: calc(100% - 40px);
  padding: 3px 9px; border-radius: 999px;
  background: rgba(0,0,0,.65); color: #f4d271; font-size: 10.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1;
}
.picker-body { display: block; }
.unused-toggle {
  flex-direction: row; align-items: center; gap: 8px; margin-left: auto; margin-right: 12px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; user-select: none;
}
.unused-toggle input { display: none; }
.unused-toggle .switch {
  position: relative; width: 40px; height: 23px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line);
  transition: background .18s ease, border-color .18s ease; flex: 0 0 auto;
}
.unused-toggle .switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: var(--muted);
  transition: transform .18s ease, background .18s ease;
}
.unused-toggle input:checked + .switch {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  border-color: transparent;
}
.unused-toggle input:checked + .switch::after { transform: translateX(17px); background: #fff; }
.unused-toggle:has(input:checked) { color: var(--text); }

/* ---------- eBay lookup modal ---------- */
#ebayModal { z-index: 150; } /* sits above the item modal */
.ebay-modal { width: 96vw; max-width: 96vw; height: 94vh; }
.ebay-web { flex: 1 1 auto; min-height: 0; background: #fff; position: relative; }
.ebay-web webview, .ebay-web iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
}
.ebay-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 30px;
}
.ebay-loading {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 12px; color: var(--muted); z-index: 2;
}
.ebay-head { gap: 12px; }
.ebay-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.ebay-search input { flex: 1; min-width: 0; }
.ebay-tag {
  flex: 0 0 auto; background: rgba(70,208,138,.16); color: var(--green);
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.ebay-suggest {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.ebay-foot { gap: 10px; flex-wrap: wrap; }
.ebay-val { flex-direction: column; gap: 4px; font-size: 12px; }
.ebay-val input { width: 240px; }
.grow { flex: 1; }

/* ---------- media selection / groups / analysis ---------- */
#mediaGrid .media-cell { cursor: pointer; }
#mediaGrid .media-cell.msel { outline: 3px solid var(--accent); outline-offset: -1px; }
.media-check {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-size: 19px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.4); z-index: 2;
}
.group-ring { position: absolute; inset: 0; border-radius: 12px; pointer-events: none; border: 3px solid transparent; }
.group-chip {
  position: absolute; top: 34px; left: 6px; padding: 2px 8px; border-radius: 999px;
  color: #10131a; font-size: 10px; font-weight: 800; z-index: 1;
}
.ana-strip {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  color: #fff; font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ana-strip .spark { color: #e6c15a; }

/* ---------- floating selection bar ---------- */
.sel-bar {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 16px 10px 20px; box-shadow: var(--shadow); z-index: 90;
  animation: fade .18s ease;
}
.sel-bar-count { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ---------- bulk analyze modal ---------- */
.bulk-modal { width: 520px; }
.bulk-body { display: flex; gap: 16px; padding: 22px; align-items: center; }
#bulkThumb { width: 110px; height: 110px; border-radius: 12px; object-fit: cover; background: var(--bg-3); border: 1px solid var(--line); }
.bulk-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
#bulkStatus { font-weight: 700; }
.bulk-bar { height: 10px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
#bulkFill {
  height: 100%; width: 0%; border-radius: 999px; transition: width .3s ease;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 80%, white), var(--accent));
}
#bulkDetail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Auth gate ---------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: var(--bg); background-image: var(--bg-grad); padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 28px 26px;
}
.auth-brand { justify-content: center; text-align: center; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.auth-brand .logo { margin: 0 auto 4px; }
.auth-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.btn.full { width: 100%; justify-content: center; }
.auth-status { min-height: 18px; margin: 10px 0 0; font-size: 13px; text-align: center; }
.auth-card .small { display: block; text-align: center; margin-top: 14px; }

/* ---------- Loading overlay ---------- */
.loading-overlay {
  position: fixed; inset: 0; z-index: 320; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: var(--bg); background-image: var(--bg-grad);
}
.loading-mark {
  font-size: 44px; color: var(--accent); animation: spin 1.1s linear infinite;
}
.loading-overlay p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 11px; box-shadow: var(--shadow); font-size: 13px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
