:root {
  --ap: #1a3a52;
  --ap-hover: #142d41;
  --ag: #28a745;
  --gold: #ffd700;
  --sidebar-w: 220px;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: #f0f2f5;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #212529;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--ap);
  display: flex;
  flex-direction: column;
  z-index: 200;
  box-shadow: 2px 0 12px rgba(0,0,0,.18);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  text-decoration: none;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-brand-icon img { width: 28px; height: 28px; object-fit: cover; border-radius: 50%; }
.sidebar-brand-text { color: white; font-weight: 700; font-size: 13px; line-height: 1.25; }
.sidebar-brand-text small { display: block; font-weight: 400; opacity: .6; font-size: 11px; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-label {
  padding: 14px 18px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: rgba(255,255,255,.8) !important;
  text-decoration: none;
  border-radius: 0;
  transition: background .15s, color .15s;
  font-size: 13.5px;
}
.nav-link:hover { background: rgba(255,255,255,.1); color: white !important; }
.nav-link.active { background: rgba(255,255,255,.15); color: white !important; font-weight: 600; border-left: 3px solid var(--gold); }
.nav-link i { width: 18px; text-align: center; font-size: 13px; opacity: .8; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer .nav-link { border-radius: var(--radius); }

/* ── Main layout ──────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e9ecef;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-title { font-weight: 600; font-size: 16px; color: var(--ap); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 24px; flex: 1; }

/* ── Cards ────────────────────────────────── */
.card {
  background: white;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.card-header {
  background: none;
  border-bottom: 1px solid #f0f0f0;
  padding: 14px 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 20px; }

/* Stat cards */
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue  { background: #e8f0fe; color: var(--ap); }
.stat-icon.green { background: #e6f4ea; color: var(--ag); }
.stat-icon.gold  { background: #fef9e7; color: #b8860b; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1; color: var(--ap); }
.stat-label { font-size: 12px; color: #6c757d; margin-top: 3px; }

/* ── Tables ───────────────────────────────── */
.table { margin: 0; }
.table thead th {
  background: #f8f9fa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #6c757d;
  border-bottom: 1px solid #e9ecef;
  padding: 10px 16px;
}
.table td { padding: 12px 16px; vertical-align: middle; border-color: #f0f0f0; }
.table tbody tr:hover { background: #fafbfc; }

/* ── Buttons ──────────────────────────────── */
.btn-primary {
  background: var(--ap);
  border-color: var(--ap);
}
.btn-primary:hover { background: var(--ap-hover); border-color: var(--ap-hover); }
.btn-success { background: var(--ag); border-color: var(--ag); }

/* ── Badges ───────────────────────────────── */
.badge-method {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.badge-momo  { background: #fff3cd; color: #856404; }
.badge-orange{ background: #ffe5d0; color: #c0550a; }
.badge-card  { background: #cfe2ff; color: #084298; }
.badge-other { background: #e2e3e5; color: #495057; }

/* ── Upload zone ──────────────────────────── */
.upload-zone {
  border: 2px dashed #d0d7de;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--ag);
  background: #f0fff4;
}
.upload-zone i { font-size: 32px; color: #adb5bd; margin-bottom: 8px; }

/* Upload grid */
.uploads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; }
.upload-thumb {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.upload-thumb img { width: 100%; height: 110px; object-fit: cover; display: block; }
.upload-thumb-body { padding: 8px; }
.upload-thumb-name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-thumb-meta { font-size: 10px; color: #6c757d; }
.upload-thumb-actions { display: flex; gap: 4px; margin-top: 6px; }
.upload-thumb-actions .btn { font-size: 11px; padding: 2px 8px; flex: 1; }

/* ── Login page ───────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--ap);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  width: 60px; height: 60px;
  background: var(--ap);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  overflow: hidden;
}
.login-logo img { width: 44px; height: 44px; object-fit: cover; border-radius: 50%; }

/* ── Toast ────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-msg {
  background: #212529;
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  animation: toastIn .2s ease;
}
.toast-msg.success { background: var(--ag); }
.toast-msg.error   { background: #dc3545; }
@keyframes toastIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ── Misc ─────────────────────────────────── */
.page-title { font-size: 18px; font-weight: 700; color: var(--ap); margin: 0; }
.text-muted { color: #6c757d !important; }
.form-label { font-weight: 600; font-size: 13px; }

/* ── Responsive ───────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .main-wrap { margin-left: 0; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }
  .sidebar.open ~ .sidebar-overlay { display: block; }
}
