:root {
  /* Bee Tracker: black and yellow */
  --bg: #0b0b0b;
  --surface: #151515;
  --surface-2: #202020;
  --border: #2c2c2c;
  --text: #f5f5f0;
  --muted: #a8a8a0;
  --accent: #ffc72c;
  --accent-ink: #111111;
  --accent-soft: rgba(255, 199, 44, 0.14);
  --ok: #7ed49b;
  --danger: #ff6b57;
  --danger-soft: rgba(255, 107, 87, 0.14);
  --radius: 12px;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: #000; border-bottom: 2px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -0.01em; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand .mark .icon { width: 16px; height: 16px; }
.spacer { flex: 1; }
.who { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-weight: 550; text-decoration: none; white-space: nowrap; color: inherit;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #111; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon-only { padding: 8px; min-width: 40px; }
.btn.big { min-height: 56px; font-size: 16px; border-radius: 14px; }

/* Forms */
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px;
}
textarea.input { min-height: 72px; resize: vertical; }
.input:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--danger); font-size: 14px; min-height: 1.2em; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px 24px; display: grid; gap: 16px; }
.login-card h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }

/* Uploader */
.up-main { max-width: 560px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; padding-bottom: 120px; }
.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick-row .btn { flex-direction: column; min-height: 104px; gap: 8px; font-size: 15px; }
.pick-row .btn .icon { width: 28px; height: 28px; }
.summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.summary .icon { color: var(--ok); }
.queue { display: grid; gap: 8px; }
.q-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px; }
.q-item img, .q-noimg { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.q-noimg { display: grid; place-items: center; color: var(--muted); }
.q-meta { min-width: 0; }
.q-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-status { font-size: 13px; color: var(--muted); }
.q-status.ok { color: var(--ok); }
.q-status.err { color: var(--danger); }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.sticky-actions .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.sticky-actions .btn { flex: 1; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; margin-bottom: 8px; }

/* Uploader tabs */
.up-tabs { display: flex; gap: 4px; max-width: 560px; margin: 0 auto; padding: 12px 16px 0; }
.up-tabs .tab { flex: 1; min-height: 40px; }
.mine-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }

/* Admin */
.tabs { display: flex; gap: 4px; }
.tab { padding: 8px 12px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-weight: 550; }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.admin-main { max-width: 1280px; margin: 0 auto; padding: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 12px; margin-bottom: 16px; }
.filters label.field { min-width: 150px; flex: 1 1 150px; }
.filters .count { margin-left: auto; align-self: center; color: var(--muted); font-size: 14px; }
.day { margin: 20px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.day h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { position: relative; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; aspect-ratio: 1; text-align: left; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 12px; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0));
  display: flex; justify-content: space-between; gap: 6px;
}
.tile .cap span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .note-dot { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 6px; background: rgba(0,0,0,0.55); color: #fff; display: grid; place-items: center; }
.tile .note-dot .icon { width: 14px; height: 14px; }
.tile .removed { position: absolute; top: 6px; left: 6px; padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: 650; background: var(--danger); color: #111; }
.lb-info .removed-note { color: #f2b8ad; margin-top: 2px; }
.tile .noprev { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 12px; }
.load-more { display: flex; justify-content: center; padding: 20px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: #0b0e12; color: #e6ebf0; display: grid; grid-template-rows: auto 1fr auto; }
.lb-top, .lb-bottom { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.lb-top .btn, .lb-bottom .btn { background: rgba(255,255,255,0.08); border-color: transparent; color: #e6ebf0; }
.lb-top .btn:hover, .lb-bottom .btn:hover { background: rgba(255,255,255,0.16); }
.lb-stage { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.5); border-color: transparent; color: #fff; }
.lb-nav:hover { background: rgba(0,0,0,0.75); }
.lb-nav:disabled { opacity: 0.25; }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-info { font-size: 14px; line-height: 1.4; min-width: 0; }
.lb-info .note { color: #c3ccd6; white-space: pre-wrap; margin-top: 2px; }

/* Users */
.users-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.users-head h2 { margin: 0; font-size: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.admin { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: var(--danger-soft); color: var(--danger); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions .btn { min-height: 34px; padding: 5px 10px; font-size: 13px; }

/* Dialog */
dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
dialog::backdrop { background: rgba(8, 11, 15, 0.55); }
.dlg { padding: 20px; display: grid; gap: 14px; }
.dlg h3 { margin: 0; font-size: 17px; }
.dlg .actions { display: flex; gap: 8px; justify-content: flex-end; }
.pw-row { display: flex; gap: 8px; }
.pw-row .input { flex: 1; }
.creds { background: var(--surface-2); border-radius: 10px; padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre-wrap; word-break: break-all; }

.account { max-width: 420px; padding: 20px; display: grid; gap: 14px; }
.account h2 { margin: 0; font-size: 18px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); max-width: calc(100vw - 32px); }

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .tile { border-radius: 4px; }
  .tile .cap { display: none; }
  .tabs .tab { padding: 8px 8px; }
  .hide-sm { display: none; }
  .filters .count { margin-left: 0; width: 100%; }
}
body.on-mine .sticky-actions { display: none; }
