@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Outfit:wght@400;600&display=swap');

/* ─── COLOR TOKENS ─── */

:root, [data-theme="dark"] {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #151d2e;
  --bg-card-hover: #1a2540;
  --border: #1e293b;
  --border-light: #2d3a52;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --glow-blue: rgba(59,130,246,0.15);
  --glow-green: rgba(16,185,129,0.15);
  --glow-amber: rgba(245,158,11,0.15);
  --nav-bg: rgba(10,14,23,0.85);
  --card-shadow: none;
}

[data-theme="light"] {
  --bg-primary: #f8f9fb;
  --bg-secondary: #eef0f4;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-blue: #2563eb;
  --accent-cyan: #0891b2;
  --accent-green: #059669;
  --accent-amber: #d97706;
  --accent-red: #dc2626;
  --accent-purple: #7c3aed;
  --nav-bg: rgba(255,255,255,0.88);
  --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

/* ─── RESET ─── */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── TYPOGRAPHY ─── */

h1.display {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.mono {
  font-family: 'DM Mono', monospace;
}

.label-text {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ─── SCROLLBAR ─── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ─── ANIMATIONS ─── */

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent-green); }
  50% { opacity: 0.5; box-shadow: 0 0 16px var(--accent-green); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -1%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

@keyframes float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ─── NAV ─── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 48px;
}

.nav-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 48px;
  gap: 2rem;
}

.nav-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.nav-brand {
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
  text-decoration: none;
}

.nav-brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s ease-in-out infinite;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-links a.active {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding-right: 0.5rem;
}

.nav-user-name {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.nav-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  border: none;
  background: none;
  cursor: pointer;
}

.nav-logout:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.08);
}

.nav-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  border: none;
  background: none;
  cursor: pointer;
}

.nav-theme-toggle:hover {
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
}

/* ─── THEME TOGGLE ─── */

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.theme-toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--border-light);
  position: relative;
  transition: background 0.3s;
}

[data-theme="light"] .theme-toggle-track {
  background: var(--accent-cyan);
}

.theme-toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(18px);
}

.theme-toggle-label {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ─── LAYOUT ─── */

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 2rem 2rem;
}

.page-header-with-logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
  mix-blend-mode: screen;
}

[data-theme="light"] .page-logo {
  mix-blend-mode: multiply;
}

.page-header-text {
  flex: 1;
}

.page-header {
  margin-bottom: 1.25rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.2rem;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
}

/* ─── GRID ─── */

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }

/* ─── STAT ROW ─── */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* ─── STAT CARD ─── */

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  transition: all 0.25s;
  box-shadow: var(--card-shadow);
}

.stat-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.stat-clickable {
  cursor: pointer;
}

.stat-clickable:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}

.stat-clickable.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan);
}

.stat-card .stat-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.stat-card .stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-family: 'DM Mono', monospace;
}

.stat-value.blue { color: var(--accent-blue); }
.stat-value.green { color: var(--accent-green); }
.stat-value.amber { color: var(--accent-amber); }
.stat-value.red { color: var(--accent-red); }
.stat-value.cyan { color: var(--accent-cyan); }
.stat-value.purple { color: var(--accent-purple); }

/* ─── GENERAL CARD ─── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  transition: all 0.25s;
  box-shadow: var(--card-shadow);
}

.card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

/* ─── ADMIN TABS ─── */

.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.admin-tabs .tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  text-decoration: none;
}

.admin-tabs .tab:hover {
  color: var(--text-primary);
}

.admin-tabs .tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

/* ─── DATA TABLE ─── */

/* ─── REPORT TABLE (unified style) ─── */
.data-table,
.detail-table,
.payment-history-table,
.promo-table,
.transfer-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}

.data-table th,
.detail-table th,
.payment-history-table th,
.promo-table th,
.transfer-history-table th {
  text-align: center;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-cyan);
  padding: 0.6rem 0.5rem 0.3rem;
  border-bottom: 2px solid var(--border);
}

.data-table th:first-child,
.detail-table th:first-child,
.payment-history-table th:first-child,
.promo-table th:first-child,
.transfer-history-table th:first-child {
  text-align: left;
}

.data-table td,
.detail-table td,
.payment-history-table td,
.promo-table td,
.transfer-history-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
}

.data-table td:first-child,
.detail-table td:first-child,
.payment-history-table td:first-child,
.promo-table td:first-child,
.transfer-history-table td:first-child {
  text-align: left;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
}

.data-table td.text,
.detail-table td.text {
  font-family: 'Outfit', sans-serif;
}

.data-table tr:hover td,
.detail-table tr:hover td,
.payment-history-table tr:hover td,
.promo-table tr:hover td,
.transfer-history-table tr:hover td {
  background: rgba(6, 182, 212, 0.03);
}

/* Total/summary row */
.data-table tr.total-row td,
.detail-table tr.total-row td,
.payment-history-table tr.total-row td {
  font-weight: 600;
  color: var(--accent-cyan);
  border-top: 2px solid var(--border);
  border-bottom: none;
}

/* Status colors in tables */
.paid, .status-paid { color: var(--accent-green) !important; }
.unpaid, .status-unpaid { color: var(--accent-amber) !important; }

/* ─── ACTION BUTTONS ─── */

.action-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.action-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.action-btn.danger {
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
}

.action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--accent-red);
}

.btn {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border: none;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover { background: #22d3ee; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* ─── ROLE PILL ─── */

.role-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-pill.super_admin {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
}

.role-pill.admin {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
}

.role-pill.viewer {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
}

/* ─── STATUS PILL ─── */

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-pill.active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

.status-pill.inactive {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
}

/* ─── MODAL ─── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeOverlay 0.2s ease forwards;
}

.modal-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.25s ease forwards;
}

.modal-panel h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.modal-panel p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ─── TOAST ─── */

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  max-width: 320px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-left: 3px solid var(--accent-green);
  color: var(--accent-green);
}

.toast.error {
  border-left: 3px solid var(--accent-red);
  color: var(--accent-red);
}

/* ─── LOADING STATE ─── */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  font-size: 0.9rem;
  gap: 1rem;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── ACCESS DENIED ─── */

.access-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  text-align: center;
  gap: 1rem;
}

.access-denied h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent-red);
}

.access-denied p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ─── ADD USER FORM ─── */

.add-user-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease forwards;
  overflow: hidden;
}

.add-user-form.hidden {
  display: none;
}

.add-user-form .form-group {
  margin-bottom: 1rem;
}

.add-user-form .form-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.add-user-form input,
.add-user-form select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  min-height: 48px;
}

.add-user-form input:focus,
.add-user-form select:focus {
  border-color: var(--accent-cyan);
}

/* ─── LOGIN PAGE ─── */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.login-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(6, 182, 212, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
  animation: drift 20s ease-in-out infinite;
}

.login-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.06) 1px, transparent 1px);
  background-size: 60px 60px;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 3rem 2.5rem;
  text-align: center;
  border-radius: 24px;
}

.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(6, 182, 212, 0.12);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.5) inset,
    0 30px 80px rgba(0, 0, 0, 0.08),
    0 0 120px rgba(6, 182, 212, 0.06);
  z-index: -1;
}

/* ─── LOGIN LOGO ─── */

.login-logo {
  margin: 0 auto 1.25rem;
  position: relative;
  width: 72px;
  height: 72px;
}

.login-logo .logo-ring {
  position: absolute;
  inset: -4px;
  border-radius: 20px;
  background: conic-gradient(from 180deg, var(--accent-cyan), var(--accent-purple), var(--accent-blue), var(--accent-cyan));
  opacity: 0.8;
  animation: spin-slow 8s linear infinite;
  filter: blur(1px);
}

.login-logo .logo-inner {
  position: relative;
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #0c4a6e 0%, #164e63 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.login-logo .logo-inner svg {
  width: 36px;
  height: 36px;
  stroke: #06b6d4;
  fill: none;
  stroke-width: 1.5;
}

/* ─── OAUTH BUTTONS ─── */

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
  min-height: 48px;
  letter-spacing: 0.01em;
}

.oauth-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s;
}

.oauth-btn:hover::after { opacity: 1; }
.oauth-btn:active { transform: scale(0.98); }

.oauth-btn-google {
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.oauth-btn-google:hover {
  box-shadow: 0 4px 24px rgba(66, 133, 244, 0.3);
  transform: translateY(-2px);
}

.oauth-btn-google::after {
  background: linear-gradient(135deg, rgba(66,133,244,0.05), rgba(234,67,53,0.05));
}

.oauth-btn-google svg { width: 20px; height: 20px; flex-shrink: 0; }

.oauth-btn-microsoft {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.1);
}

.oauth-btn-microsoft:hover {
  border-color: rgba(0, 120, 212, 0.4);
  box-shadow: 0 4px 24px rgba(0, 120, 212, 0.2);
  transform: translateY(-2px);
}

.oauth-btn-microsoft::after {
  background: linear-gradient(135deg, rgba(0,120,212,0.05), rgba(128,0,128,0.03));
}

.oauth-btn-microsoft svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── OR DIVIDER ─── */

.or-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0.5rem 0;
  color: #94a3b8;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
}

.or-divider::before, .or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
}

/* ─── ERROR MESSAGE ─── */

.error-message {
  margin-bottom: 1.5rem;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  color: #f87171;
  font-size: 0.85rem;
  display: none;
  backdrop-filter: blur(10px);
}

.error-message.visible { display: block; }

/* ─── FLOATING PARTICLES ─── */

.particle {
  position: fixed;
  width: 2px;
  height: 2px;
  background: rgba(6, 182, 212, 0.4);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
  animation: float linear infinite;
}

/* ─── FADE-IN UTILITY ─── */

.fade-in {
  animation: fadeIn 0.4s ease forwards;
  opacity: 0;
}

.fade-in:nth-child(1) { animation-delay: 0.05s; }
.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.15s; }
.fade-in:nth-child(4) { animation-delay: 0.2s; }
.fade-in:nth-child(5) { animation-delay: 0.25s; }

/* ─── SECTION ─── */

.section {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* ─── FORM ELEMENTS ─── */

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  min-height: 48px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-cyan);
}

/* ─── RESPONSIVE BREAKPOINTS ─── */

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .stat-row {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 1rem;
  }

  .nav {
    padding: 0 1rem;
  }

  .login-card {
    margin: 1rem;
    max-width: calc(100% - 2rem);
    padding: 2rem 1.5rem;
  }
}

/* ------------------------------------------------------------------ */
/* Payment card grid (Phase 2)                                        */
/* ------------------------------------------------------------------ */
.payment-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.payment-card-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--card-shadow);
  position: relative;
}

.payment-card-box:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.payment-card-box:focus {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Urgency left border */
.payment-card-box.urgent  { border-left: 4px solid var(--accent-red); }
.payment-card-box.warning { border-left: 4px solid var(--accent-amber); }
.payment-card-box.ok      { border-left: 4px solid var(--accent-green); }

.card-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.card-issuer {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.card-due {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.15rem;
}

.card-due .amount {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
}

.card-due .due-label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
}

.pill.personal { background: var(--accent-blue); color: #fff; }
.pill.business { background: var(--accent-purple); color: #fff; }
.pill.gift { background: var(--accent-green); color: #fff; }

.promo-badge {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--accent-amber);
  font-weight: 500;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.filter-bar .filter-btn {
  padding: 0.35rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.15s;
}

.filter-bar .filter-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.filter-bar .filter-btn.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
  font-weight: 600;
}

/* Detail view panel */
.detail-panel {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.detail-panel.visible { display: block; }

.detail-panel h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  cursor: pointer;
  margin-bottom: 1rem;
  border: none;
  background: none;
  padding: 0;
}

.detail-back:hover { text-decoration: underline; }

/* Payment history table */
.show-all-btn {
  margin-top: 0.75rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--accent-cyan);
  cursor: pointer;
  font-size: 0.85rem;
}

/* Progress bar for hotel nights */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent-cyan);
  transition: width 0.3s;
}

.nights-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Certificate list */
.cert-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
}

.cert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.cert-item .cert-expiry {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cert-item .cert-expiry.expiring-soon {
  color: var(--accent-red);
  font-weight: 600;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* Section divider within detail view */
.detail-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.detail-section h4 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

/* Inline add button */
.add-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  background: transparent;
  border: 1px solid var(--accent-cyan);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.add-inline-btn:hover {
  background: var(--accent-cyan);
  color: #fff;
}

/* ─── CARD RENEWAL BADGE ─── */
.card-renewal {
  display: inline-block;
  margin: 0.3rem 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-cyan);
  letter-spacing: 0.02em;
}

/* ─── BENEFIT ROWS ─── */
.benefit-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.benefit-row:last-child { border-bottom: none; }

.benefit-row-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.benefit-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.benefit-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.benefit-alert-badge {
  font-size: 0.7rem;
  color: var(--accent-cyan);
  margin-left: 0.25rem;
}

.benefit-amounts {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
}

.benefit-used { color: var(--text-muted); }

.benefit-remaining {
  color: var(--accent-cyan);
  font-weight: 600;
}

.benefit-remaining.exhausted {
  color: var(--text-muted);
  font-weight: normal;
}

.benefit-remaining.expiring-soon {
  color: var(--accent-red);
}

.benefit-credit {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.benefit-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  gap: 1rem;
}

.benefit-reset-info {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.benefit-progress {
  flex: 1;
  max-width: 120px;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.benefit-progress-bar {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 3px;
  transition: width 0.3s;
}

.benefit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ─── INLINE USE FORM ─── */
.inline-use-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border-radius: 6px;
  flex-wrap: wrap;
}
.inline-use-form input { flex: 1; min-width: 80px; }

/* ─── INLINE BENEFIT ADD/EDIT FORM ─── */
.inline-benefit-form {
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-top: 0.5rem;
}
.inline-benefit-form .form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.inline-benefit-form .form-row > * { flex: 1; min-width: 120px; }

/* ─── POINTS SECTION ─── */
.points-balance-display {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.25rem 0 0.5rem;
}
.points-balance-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
  font-weight: normal;
}

/* ─── TRANSFER HISTORY TABLE ─── */
/* ─── LOYALTY BALANCE IN CARD BOXES ─── */
.loyalty-balance {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-top: 0.25rem;
}

/* ─── SMALL BUTTONS ─── */
.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #fff;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.15s;
}
.btn-secondary:hover { border-color: var(--text-secondary); }

/* =========================================================================
   Dashboard — Phase 4
   ========================================================================= */

/* Two-column layout: deadlines left, benefits right */
.dashboard-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.25rem;
}

/* Deadline list items */
.deadline-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deadline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 8px 12px;
  gap: 8px;
}

.deadline-row.urgent  { border-left: 4px solid var(--accent-red); }
.deadline-row.warning { border-left: 4px solid var(--accent-amber); }
.deadline-row.ok      { border-left: 4px solid var(--accent-green); }

.deadline-info {
  flex: 1;
  min-width: 0;
}

.deadline-name {
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deadline-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.deadline-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Promo countdown badge — independent of urgency badge (D-07) */
.promo-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
}

.promo-badge.promo-warning { background: var(--accent-amber); }
.promo-badge.promo-urgent  { background: var(--accent-red); }

/* Days badge — DM Mono per UI-SPEC */
.days-badge {
  font-family: 'DM Mono', monospace;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 400;
  color: white;
  white-space: nowrap;
}

.days-badge.urgent  { background: var(--accent-red); }
.days-badge.warning { background: var(--accent-amber); }
.days-badge.ok      { background: var(--accent-green); }

/* Benefits-by-card grid */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.benefit-card {
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 10px 12px;
}

.benefit-card-name {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.benefit-card-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.benefit-card-unused {
  font-family: 'DM Mono', monospace;
  font-size: 0.95rem;
  color: var(--accent-green);
}

.benefit-card-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Calendar grid (D-12 through D-16) */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cal-month-label {
  font-weight: 600;
  font-size: 0.65rem;
}

.cal-nav-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.65rem;
  line-height: 1;
}

.cal-nav-btn:hover {
  background: var(--bg-card);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.cal-cell {
  position: relative;
  min-height: 24px;
  padding: 2px;
  border-radius: 3px;
  font-size: 0.6rem;
  cursor: default;
  text-align: center;
}

.cal-cell.has-events {
  cursor: pointer;
}

.cal-cell.has-events:hover {
  background: var(--bg-secondary);
}

.cal-cell.today {
  background: var(--bg-secondary);
  font-weight: 600;
}

.cal-cell.empty {
  min-height: 0;
}

.cal-dots {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 1px;
  flex-wrap: wrap;
}

.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  display: inline-block;
}

.cal-dot.payment       { background: var(--accent-red); }
.cal-dot.benefit-reset { background: var(--accent-red); }
.cal-dot.promo-expiry  { background: var(--accent-red); }

.cal-overflow {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Calendar event detail panel (D-15) */
.cal-detail-panel {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 8px;
  display: none;
}

.cal-detail-panel.visible {
  display: block;
}

.cal-detail-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.cal-detail-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.8rem;
}

/* Show more button (mobile, D-17) */
.show-more-btn {
  display: none;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.show-more-btn:hover {
  background: var(--bg-card);
}

/* Loading and empty states */
.dashboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  gap: 12px;
  color: var(--text-muted);
}

.dashboard-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.dashboard-empty h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.dashboard-empty p {
  font-size: 0.85rem;
}

.dashboard-error {
  text-align: center;
  padding: 32px 16px;
  color: var(--accent-red);
}

/* Benefits grid: single column when inside the 2-col layout */
.dashboard-top-row .benefits-grid {
  grid-template-columns: 1fr;
}

/* Mobile responsive (D-17, D-18, D-19) */
@media (max-width: 768px) {
  .dashboard-top-row {
    grid-template-columns: 1fr;
  }

  .benefits-grid {
    grid-template-columns: 1fr;
  }

  .cal-grid {
    min-width: 320px;
  }

  .cal-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .deadline-row {
    padding: 10px 12px;
  }

  .deadline-name {
    font-size: 0.85rem;
  }

  .show-more-btn {
    display: block;
  }

  .deadline-list .deadline-row:nth-child(n+8) {
    display: none;
  }

  .deadline-list.expanded .deadline-row:nth-child(n+8) {
    display: flex;
  }

  .deadline-list.expanded + .show-more-btn {
    display: none;
  }
}
