@font-face {
  font-family: "LGEI Headline";
  src: url("/fonts/LGEIHeadline-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LGEI Headline";
  src: url("/fonts/LGEIHeadline-Semibold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LGEI Headline";
  src: url("/fonts/LGEIHeadline-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f8f7f5;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --accent: #fd312e;
  --accent-wash: rgba(253, 49, 46, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font-head: "LGEI Headline", "Microsoft JhengHei UI", "PingFang SC", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ─── Shared card ─────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ─── Header (mirrors the main app's AppHeader) ──────────────────────── */

.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header .brand img {
  height: 20px;
  width: auto;
  display: block;
}

.app-header .brand .divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.app-header .brand .title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

/* ─── Login page ──────────────────────────────────────────────────────── */

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
}

.login-shell img.logo {
  height: 28px;
  width: auto;
}

.login-card {
  width: 320px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card h1 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-align: center;
}

.login-card p.hint {
  margin: -8px 0 0;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

.field {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
}

.field:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.btn-primary {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-primary:hover {
  opacity: 0.9;
}

.error-banner {
  background: rgba(253, 49, 46, 0.08);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
}

/* ─── Dashboard shell ─────────────────────────────────────────────────── */

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

.page h1 {
  margin: 0 0 4px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
}

.page .lede {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--text-faint);
}

/* ─── Filter pills ────────────────────────────────────────────────────── */

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.filters button {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filters button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filters button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* ─── Stat cards ──────────────────────────────────────────────────────── */

.stat-row {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 20px 24px;
  min-width: 160px;
}

.stat-card .num {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 32px;
  color: var(--accent);
  line-height: 1.1;
}

.stat-card .label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-faint);
}

/* ─── Sections / tables ───────────────────────────────────────────────── */

section {
  margin-bottom: 24px;
}

section h2 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin: 0 0 10px;
}

.table-card {
  padding: 4px 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  font-weight: 600;
  color: var(--text-faint);
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--accent-wash);
}

#recent td:last-child {
  padding: 6px 20px 6px 8px;
}

.thumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.thumb {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  flex: none;
}

.thumb-more {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

/* ─── Thumbnail modal ─────────────────────────────────────────────────── */

.thumb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.thumb-modal {
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px 24px;
}

.thumb-modal .modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.thumb-modal .modal-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  text-transform: capitalize;
}

.thumb-modal .modal-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-faint);
}

.thumb-modal .modal-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
}

.thumb-modal .modal-close:hover {
  color: var(--accent);
}

.thumb-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.thumb-modal-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
