/* Reusable components. Class vocabulary is shared by ui.js and every screen. */

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface-soft); --btn-fg: var(--text); --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  font-weight: 700; font-size: 15px; letter-spacing: 0.01em; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-spring), background-color var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease), border-color var(--t-fast) var(--ease), opacity var(--t-fast);
  position: relative; overflow: hidden; isolation: isolate; user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }
.btn.primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); box-shadow: var(--sh-primary); }
.btn.ink { --btn-bg: var(--ink); --btn-fg: var(--on-ink); box-shadow: var(--sh-ink); }
.btn.outline { --btn-bg: transparent; --btn-bd: var(--divider-strong); }
.btn.ghost { --btn-bg: transparent; }
.btn.danger { --btn-bg: var(--error-50); --btn-fg: var(--error-600); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn.lg { height: 54px; padding: 0 28px; font-size: 16px; border-radius: var(--r-lg); }
.btn.block { width: 100%; }
@media (hover: hover) {
  .btn.primary:hover:not(:disabled) { box-shadow: 0 10px 28px rgba(186, 67, 41, 0.4); transform: translateY(-1px); }
  .btn.outline:hover:not(:disabled), .btn.ghost:hover:not(:disabled), .btn:not(.primary):not(.ink):hover:not(:disabled) { background: var(--surface-soft); }
  .btn.primary:hover:not(:disabled) { background: var(--primary-700); }
}
.btn .spin { animation: spin 800ms linear infinite; }
.btn.loading { pointer-events: none; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; position: relative;
  color: var(--text); background: transparent;
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-spring), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-soft); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.solid { background: var(--surface); box-shadow: var(--sh-sm); border: 1px solid var(--divider); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn .badge-dot {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--primary); color: var(--on-primary); font: 700 10px/16px var(--font-num); text-align: center;
  animation: pop var(--t-base) var(--ease-spring) both;
}

/* ---------- Chips / pills / tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--divider); color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--divider-strong); color: var(--text); }
.chip:active { transform: scale(0.95); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip.primary.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
/* Safari lets <button> flex items shrink below their text width, so the label spills out of the pill. */
.chip-row > *, .chip { flex: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; background: var(--surface-soft); color: var(--text-2); white-space: nowrap;
}
.pill.ok { background: var(--ok-50); color: var(--ok-500); }
.pill.warn { background: var(--warn-50); color: var(--warn-500); }
.pill.err { background: var(--error-50); color: var(--error-600); }
.pill.primary { background: var(--primary-50); color: var(--primary); }
.pill.lost { background: var(--lost-50); color: var(--lost-600); }
.pill.dim { background: transparent; border: 1px dashed var(--divider-strong); color: var(--text-3); }

.type-tag {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 800; letter-spacing: 0.02em;
}
.type-tag.lost { background: var(--ink); color: var(--on-ink); }
.type-tag.found { background: var(--primary); color: var(--on-primary); }
.type-tag.official { background: var(--ok-500); color: #fff; }
:root[data-theme='dark'] .type-tag.official { color: #10231a; }
.type-tag.sample { background: var(--surface-sunk); color: var(--text-2); border: 1px dashed var(--divider-strong); }

/* Freshness: dot + label. The level colour comes from campus.js (fresh / recent / stale / unknown). */
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.fresh::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); flex: none; }
.fresh.fresh-fresh { color: var(--fresh); }
.fresh.fresh-fresh::before { background: var(--fresh); animation: fresh-ping 2s ease-out infinite; }
.fresh.fresh-recent { color: var(--recent); }
.fresh.fresh-recent::before { background: var(--recent); }
.fresh.fresh-stale { color: var(--stale); }
.fresh.fresh-stale::before { background: var(--stale); }
.fresh.fresh-unknown::before { background: var(--unknown); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-lg);
  box-shadow: var(--sh-xs); overflow: hidden;
}
.card.pad { padding: 16px; }
.card.pad-lg { padding: 22px; }
.card.soft { background: var(--surface-soft); box-shadow: none; border-color: transparent; }
.card.flat { box-shadow: none; }
.card.clickable { cursor: pointer; }
.card h3 { font-size: 16px; font-weight: 800; }

/* Item card */
.item-card { display: flex; flex-direction: column; min-width: 0; text-align: left; cursor: pointer; }
.item-card .thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-soft); }
.item-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease); }
@media (hover: hover) { .item-card:hover .thumb img { transform: scale(1.06); } }
.item-card .thumb .tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 60px); }
.station-card { display: grid; gap: 10px; padding: 16px; color: inherit; }
.station-card h3 { font-size: 16px; }
.item-card .thumb .save {
  position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: grid; place-items: center; color: var(--text); transition: transform var(--t-fast) var(--ease-spring), color var(--t-fast);
}
.item-card .thumb .save:active { transform: scale(0.85); }
.item-card .thumb .save.on { color: var(--primary); }
.item-card .thumb .save.on .i { animation: pop var(--t-base) var(--ease-spring); }
.item-card .body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.item-card .title { font-weight: 800; font-size: 15px; line-height: 1.35; }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); }
.item-meta span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.item-card.row-card { flex-direction: row; }
.item-card.row-card .thumb { width: 104px; aspect-ratio: 1; flex: none; }
.item-card.row-card .body { flex: 1; min-width: 0; align-content: center; }

/* Category placeholder when an item has no photo */
.ph { width: 100%; height: 100%; display: grid; place-items: center; color: color-mix(in srgb, var(--ph, var(--primary)) 78%, var(--text)); background: linear-gradient(145deg, color-mix(in srgb, var(--ph, var(--primary)) 14%, var(--surface)), color-mix(in srgb, var(--ph, var(--primary)) 28%, var(--surface))); }
.ph .i { opacity: 0.9; }

/* ---------- Lists ---------- */
.list { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-lg); overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 10px 16px; text-align: left;
  border-bottom: 1px solid var(--divider); transition: background-color var(--t-fast) var(--ease);
}
.list-row:last-child { border-bottom: 0; }
button.list-row:hover, a.list-row:hover { background: var(--surface-soft); }
button.list-row:active, a.list-row:active { background: var(--surface-sunk); }
.list-row .lead { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.list-row .lead.ink { background: var(--surface-soft); color: var(--text); }
.list-row .lead.err { background: var(--error-50); color: var(--error-600); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-weight: 700; }
.list-row .s { font-size: 12px; color: var(--text-2); }
.list-row .trail { color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .err-text { font-size: 12px; color: var(--error-600); font-weight: 600; animation: shake-x 320ms; }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1.5px solid var(--divider); color: var(--text);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background-color var(--t-fast);
  appearance: none; -webkit-appearance: none;
}
.textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.55; }
.select { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2376716b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 9.500 7 7 7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--divider-strong); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); outline: none; }
.input.invalid, .textarea.invalid { border-color: var(--error-500); }
.input[type='date'] { min-width: 0; }

.search-bar {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1.5px solid var(--divider); box-shadow: var(--sh-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent), var(--sh-md); }
.search-bar input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; }
.search-bar .i { color: var(--text-3); }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: var(--r-md); background: var(--surface-soft); position: relative; gap: 2px; }
.seg button { position: relative; z-index: 1; height: 38px; padding: 0 16px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--text-2); transition: color var(--t-fast) var(--ease); white-space: nowrap; }
.seg button.active { color: var(--text); }
.seg .seg-thumb { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; border-radius: 11px; background: var(--surface); box-shadow: var(--sh-sm); transition: transform var(--t-base) var(--ease), width var(--t-base) var(--ease); }
.seg.block { display: grid; width: 100%; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--divider); overflow-x: auto; scrollbar-width: none; position: relative; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; height: 44px; padding: 0 16px; font-weight: 700; color: var(--text-3); white-space: nowrap; transition: color var(--t-fast); }
.tabs button.active { color: var(--primary); }
.tabs .tab-line { position: absolute; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); transition: transform var(--t-base) var(--ease), width var(--t-base) var(--ease); }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch .track { position: absolute; inset: 0; border-radius: 15px; background: var(--divider-strong); transition: background-color var(--t-base) var(--ease); }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: var(--sh-sm); transition: transform var(--t-base) var(--ease-spring); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; }

/* Selectable tiles (category / colour pickers) */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.tile {
  display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border-radius: var(--r-md);
  background: var(--surface); border: 1.5px solid var(--divider); font-size: 12px; font-weight: 700; color: var(--text-2);
  transition: all var(--t-fast) var(--ease);
}
.tile:hover { border-color: var(--divider-strong); transform: translateY(-1px); }
.tile:active { transform: scale(0.95); }
.tile.active { border-color: var(--primary); background: var(--primary-50); color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--divider-strong); box-shadow: inset 0 0 0 2px var(--surface); }

.thumb-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 96px)); gap: 10px; }
.thumb-strip .t { position: relative; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; animation: pop var(--t-base) var(--ease-spring); }
.thumb-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 1; border-radius: var(--r-md);
  border: 2px dashed var(--divider-strong); background: var(--surface-soft); color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: border-color var(--t-fast), background-color var(--t-fast), color var(--t-fast);
}
.thumb-add:hover { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.thumb-strip + .hint { display: block; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.thumb-strip .t img { width: 100%; height: 100%; object-fit: cover; }
.thumb-strip .t button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; display: grid; place-items: center; }

/* ---------- Overlay / sheet / dialog / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); animation: fade var(--t-base) var(--ease) both; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.overlay.closing { animation: fade var(--t-base) var(--ease) reverse both; }
.sheet {
  width: min(560px, 100%); max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--sh-lg);
  padding-bottom: var(--safe-b); animation: sheet-up var(--t-slow) var(--ease) both;
}
.overlay.closing .sheet { animation: sheet-up var(--t-base) var(--ease) reverse both; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--divider-strong); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 8px; gap: 10px; }
.sheet-head h3 { font-size: 18px; font-weight: 800; }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 20px 16px; display: flex; gap: 10px; border-top: 1px solid var(--divider); }
.sheet-foot .btn { flex: 1; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 720px) {
  .overlay { align-items: center; }
  .sheet { border-radius: var(--r-xl); max-height: 86dvh; animation-name: dialog-in; }
  .overlay.closing .sheet { animation-name: dialog-in; }
  .sheet .grab { display: none; }
  .sheet-head { padding-top: 22px; }
}
@keyframes dialog-in { from { transform: translateY(16px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet.wide { width: min(760px, 100%); }
.sheet.full { width: min(1000px, 100%); }

.toast-host { position: fixed; z-index: 500; left: 50%; bottom: calc(var(--nav-h) + 28px + var(--safe-b)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 28px)); pointer-events: none; }
@media (min-width: 1024px) { .toast-host { bottom: 28px; left: calc(50% + var(--rail-w) / 2); } }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--ink); color: var(--on-ink); box-shadow: var(--sh-lg); font-weight: 600; font-size: 14px; pointer-events: auto;
  animation: toast-in var(--t-base) var(--ease-spring) both;
}
.toast.out { animation: toast-out var(--t-base) var(--ease) both; }
.toast.ok .i { color: #5cc98a; }
.toast.err .i { color: #f08a92; }
.toast button.act { margin-left: auto; font-weight: 800; color: var(--primary-300); }
@keyframes toast-in { from { transform: translateY(16px) scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(8px) scale(0.96); opacity: 0; } }

/* ---------- Misc ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; color: #fff; background: linear-gradient(145deg, var(--av1, var(--primary-500)), var(--av2, var(--primary-700))); overflow: hidden; font-size: 16px; }
.avatar.lg { width: 76px; height: 76px; font-size: 30px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .art { width: 84px; height: 84px; border-radius: 28px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); animation: float-y 4s ease-in-out infinite; }
.empty h3 { font-size: 17px; font-weight: 800; color: var(--text); }
.empty p { max-width: 36ch; font-size: 14px; }

.notice { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-soft); font-size: 13px; line-height: 1.5; color: var(--text-2); align-items: flex-start; }
.notice > .i { margin-top: 2px; }
.notice.info { background: var(--primary-50); color: var(--text); }
.notice.info > .i { color: var(--primary); }
.notice.warn { background: var(--warn-50); color: var(--text); }
.notice.warn > .i { color: var(--warn-500); }
.notice.ok { background: var(--ok-50); }
.notice.ok > .i { color: var(--ok-500); }
.notice.err { background: var(--error-50); }
.notice.err > .i { color: var(--error-600); }
.notice b { color: var(--text); }

.divider { height: 1px; background: var(--divider); margin: 4px 0; border: 0; }
.kbd { font: 600 11px var(--font-num); padding: 2px 6px; border: 1px solid var(--divider-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--text-2); }
.progress { height: 8px; border-radius: 4px; background: var(--surface-sunk); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--primary-400), var(--primary-600)); transform-origin: left; animation: grow-w 900ms var(--ease) both; }
.dot-loader { display: inline-flex; gap: 4px; }
.dot-loader i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1s infinite; }
.dot-loader i:nth-child(2) { animation-delay: 0.15s; }
.dot-loader i:nth-child(3) { animation-delay: 0.3s; }

.stat { padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--divider); display: grid; gap: 4px; }
.stat .k { font-size: 12px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .v { font: 800 28px/1.1 var(--font-num); letter-spacing: -0.02em; }
.stat .d { font-size: 12px; font-weight: 700; }
.stat .d.up { color: var(--ok-500); }
.stat .d.down { color: var(--error-600); }

.tbl { font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--divider); white-space: nowrap; background: var(--surface-soft); position: sticky; top: 0; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color var(--t-fast); }
.tbl tbody tr:hover { background: var(--surface-soft); }
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--divider); background: var(--surface); }

.link { color: var(--primary); font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge-tile { display: grid; justify-items: center; gap: 6px; padding: 16px 10px; text-align: center; border-radius: var(--r-lg); border: 1px solid var(--divider); background: var(--surface); }
.badge-tile .art { width: 56px; height: 56px; border-radius: 20px; display: grid; place-items: center; background: var(--reward-100); color: var(--reward-500); }
.badge-tile.locked { opacity: 0.55; }
.badge-tile.locked .art { background: var(--surface-soft); color: var(--text-3); filter: grayscale(1); }
.badge-tile.earned .art { animation: pop var(--t-slow) var(--ease-spring); }
.badge-tile .n { font-weight: 800; font-size: 14px; }
.badge-tile .d { font-size: 12px; color: var(--text-2); }

/* Leaflet theming */
.leaflet-container { font-family: var(--font); background: var(--surface-sunk); border-radius: inherit; }
:root[data-theme='dark'] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9) saturate(0.7); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--text-2) !important; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--divider) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: var(--sh-lg); }
.leaflet-popup-content-wrapper { border-radius: var(--r-md); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; }

/* Campus outlines: pale fill with a dark-green edge, like the school's own map. */
.leaflet-container .campus-area { fill: #f2d96b; fill-opacity: 0.2; stroke: #2f6b3a; stroke-width: 2; stroke-opacity: 0.85; stroke-linejoin: round; }
:root[data-theme='dark'] .leaflet-container .campus-area { fill: #f2d96b; fill-opacity: 0.12; stroke: #8fd19e; }
.campus-label { pointer-events: none; }
.campus-label span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font: 700 12px/1 var(--font); color: #2f6b3a; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
:root[data-theme='dark'] .campus-label span { color: #b9e8c3; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.hide-area-labels .campus-label { display: none; }

.map-pin { background: none; border: 0; }
/* The teardrop is the rotated ::before so the icon, badges and drop-in animation stay upright and the tip points straight down. */
.map-pin .pin {
  position: relative; width: 38px; height: 38px; isolation: isolate; display: grid; place-items: center; color: #fff;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.3)); transform-origin: 50% 44px;
  animation: marker-drop 520ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 45ms);
  transition: scale var(--t-base) var(--ease-spring);
}
.map-pin .pin::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 50% 50% 4px 50%; transform: rotate(45deg);
  background: var(--pin, var(--primary)); border: 2.5px solid #fff;
}
.map-pin:hover .pin, .map-pin.sel .pin { scale: 1.18; }
.map-pin .pin.pin-has { --pin: var(--primary); }
.map-pin .pin.pin-empty { --pin: #6f6b66; }
.map-pin .pin.pin-unknown { --pin: #9a948d; }
.map-pin .pin.pin-stale::after { content: ''; position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--warn-500); border: 2px solid #fff; }
.map-pin .count { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ink); color: var(--on-ink); font: 800 11px/20px var(--font-num); text-align: center; border: 2px solid #fff; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2f6fed; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47, 111, 237, 0.25); animation: pulse-ring 2s infinite; }

/* ---------- Sign-in & staff ---------- */
.login-card { display: grid; gap: 14px; justify-items: center; text-align: center; max-width: 440px; margin: clamp(32px, 8vh, 88px) auto 32px; }
.login-card > * { margin: 0; }
.login-card .btn { width: 100%; max-width: 320px; }
/* Lifted off the page: a long soft drop shadow, a tighter one under it and a hairline highlight on the top edge. */
.login-card { box-shadow: 0 28px 56px -18px rgba(70, 40, 20, 0.24), 0 10px 22px -10px rgba(70, 40, 20, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9); }
:root[data-theme='dark'] .login-card { box-shadow: 0 28px 56px -18px rgba(0, 0, 0, 0.75), 0 10px 22px -10px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.login-card .btn.google { box-shadow: var(--sh-sm); }
.login-ico { box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--primary) 38%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent); }
.login-ico.ok { box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--ok-500) 38%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--ok-500) 14%, transparent); }
.login-ico.err { box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--error-600) 34%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--error-600) 14%, transparent); }
/* A page that is only a sign-in card puts it near the vertical middle (a little above, which reads as centred).
   The height is what is left under the phone top bar and above the bottom nav. */
.page:has(> .login-card) { min-height: calc(100dvh - 63px - var(--nav-h) - 32px - var(--safe-b)); display: grid; align-content: center; padding-bottom: 6vh; }
.page:has(> .login-card) > .login-card { margin: 0 auto; width: 100%; }
@media (min-width: 1024px) { .page:has(> .login-card) { min-height: calc(100dvh - 56px); } }
.login-ico { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.login-ico.ok { background: var(--ok-50); color: var(--ok-500); }
.login-ico.err { background: var(--error-50); color: var(--error-600); }
.btn.google { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--divider-strong); box-shadow: var(--sh-xs); gap: 10px; }
.btn.google:hover { background: var(--surface-soft); }
.g-logo { flex: none; }
.staff-row { align-items: flex-start; }
.staff-row .s { overflow-wrap: anywhere; }
.staff-row .btn { flex: none; }
