﻿/* =============================================
   PPK-Canteen Design System v2
   Clean, modern, accessible
   ============================================= */

/* — Design Tokens — */
:root {
  /* Core palette */
  --primary: #10B981;
  --primary-hover: #059669;
  --primary-soft: #ECFDF5;
  --primary-muted: rgba(16,185,129,.12);

  /* Neutrals */
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Semantic */
  --danger: #EF4444;  --danger-soft: #FEF2F2;  --danger-border: #FECACA;
  --warning: #F59E0B; --warning-soft: #FFFBEB;  --warning-border: #FDE68A;
  --success: #22C55E; --success-soft: #F0FDF4;  --success-border: #BBF7D0;
  --info: #3B82F6;    --info-soft: #EFF6FF;     --info-border: #BFDBFE;

  /* Surfaces */
  --bg: #F9FAFB;
  --bg-card: #FFFFFF;
  --bg-sidebar: #111827;
  --bg-topbar: #111827;

  /* Text */
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --text-on-dark: #F9FAFB;

  /* Borders & Shadows */
  --border: #E5E7EB;
  --border-focus: var(--primary);
  --ring: rgba(16,185,129,.25);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.06);

  /* Radii */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-w: 256px;
  --topbar-h: 56px;

  /* Type */
  --font: 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --leading: 1.6;
  --transition: .18s ease;
}

/* — Reset — */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary-hover); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
::selection { background: var(--primary-muted); }

/* ═══════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; }

/* — Sidebar — */
.sidebar {
  width: var(--sidebar-w); background: var(--bg-sidebar);
  color: var(--text-on-dark); position: fixed;
  top: 0; left: 0; bottom: 0; z-index: 100;
  display: flex; flex-direction: column;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.sidebar-header {
  padding: 24px 20px 20px; text-align: center;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-header h2 {
  font-size: .95rem; font-weight: 500;
  color: rgba(255,255,255,.9); margin-top: 2px;
  letter-spacing: -.01em;
}
.sidebar-header small { color: rgba(255,255,255,.4); font-size: .72rem; font-weight: 300; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent; }
.sidebar-nav a, .sidebar-nav button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 20px;
  color: rgba(255,255,255,.55); background: none; border: none;
  cursor: pointer; font-size: .88rem; text-align: left;
  transition: all var(--transition); text-decoration: none;
  border-left: 3px solid transparent;
  font-weight: 400;
}
.sidebar-nav a:hover, .sidebar-nav button:hover {
  color: rgba(255,255,255,.95);
  background: rgba(255,255,255,.05);
}
.sidebar-nav a.active {
  color: var(--primary);
  background: rgba(16,185,129,.08);
  border-left-color: var(--primary);
  font-weight: 500;
}
.sidebar-section {
  padding: 20px 20px 6px; font-size: .68rem;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(255,255,255,.25); font-weight: 500;
}
.sidebar-section:first-child { padding-top: 12px; }

.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.15);
}
.sidebar-footer .user-info { font-size: .85rem; font-weight: 400; color: rgba(255,255,255,.85); }
.sidebar-footer .user-role { font-size: .7rem; color: var(--primary); font-weight: 500; letter-spacing: .3px; }

/* — Topbar (mobile) — */
.topbar {
  display: none; height: var(--topbar-h);
  background: var(--bg-topbar); color: var(--text-on-dark);
  position: fixed; top: 0; left: 0; right: 0; z-index: 101;
  padding: 0 12px; align-items: center; gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.topbar-title { font-size: .92rem; flex: 1; font-weight: 500; letter-spacing: -.01em; }
.hamburger { background: none; border: none; color: var(--text-on-dark); font-size: 1.4rem; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); transition: background var(--transition); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.hamburger:hover { background: rgba(255,255,255,.1); }
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; backdrop-filter: blur(2px); }

/* — Main Content — */
.main-content { flex: 1; margin-left: var(--sidebar-w); padding: 28px 32px; min-height: 100vh; }
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.page-header h1 {
  font-size: 1.4rem; font-weight: 600;
  color: var(--gray-800); letter-spacing: -.02em;
}

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--gray-100);
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--gray-800); }
.card-header h3 { font-size: .95rem; font-weight: 600; color: var(--gray-700); }

/* — Stats — */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.stat-card.danger::before { background: var(--danger); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before { background: var(--info); }
.stat-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: .78rem; color: var(--text-secondary); margin-top: 4px; font-weight: 400; }

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 18px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; font-weight: 500; font-size: .88rem;
  transition: all var(--transition); white-space: nowrap;
  line-height: 1.4; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: .9; box-shadow: var(--shadow-sm); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { opacity: .9; box-shadow: var(--shadow-sm); }
.btn-info { background: var(--info); color: #fff; border-color: var(--info); }
.btn-outline {
  background: transparent; border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-sm { padding: 5px 12px; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); background: none; border: none; cursor: pointer; color: var(--text-secondary); }
.btn-icon:hover { background: var(--gray-100); color: var(--text); }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: .82rem; font-weight: 500;
  margin-bottom: 6px; color: var(--gray-700);
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-size: .92rem; line-height: 1.5;
}
.form-input::placeholder { color: var(--gray-400); }
.form-input:hover, .form-select:hover { border-color: var(--gray-400); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--ring);
}
.form-input.error { border-color: var(--danger); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.form-hint { font-size: .75rem; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* — Bare inputs in modals (without .form-input class) get styled too — */
.modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.btn):not(.pw-toggle),
.modal select,
.modal textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-size: .92rem; line-height: 1.5;
}
.modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.btn):not(.pw-toggle):focus,
.modal select:focus,
.modal textarea:focus {
  outline: none; border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--ring);
}
.modal label {
  display: block; font-size: .82rem; font-weight: 500;
  margin-bottom: 6px; color: var(--gray-700);
}
.modal .form-group label { margin-bottom: 6px; }

/* ═══════════════════════════════════════
   TABLES
   ═══════════════════════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead { background: var(--gray-50); }
th {
  padding: 10px 14px; text-align: left; font-weight: 600;
  color: var(--gray-500); font-size: .76rem;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
td {
  padding: 11px 14px; border-bottom: 1px solid var(--gray-100);
  vertical-align: middle; color: var(--gray-700);
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--gray-50); }
td.right, th.right { text-align: right; }
.table-empty { text-align: center; padding: 48px 20px; color: var(--text-secondary); font-size: .92rem; }

/* ═══════════════════════════════════════
   BADGES
   ═══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: var(--radius-full);
  font-size: .74rem; font-weight: 500; letter-spacing: .01em;
  border: 1px solid transparent;
}
.badge-success { background: var(--success-soft); color: #15803D; border-color: var(--success-border); }
.badge-danger { background: var(--danger-soft); color: #B91C1C; border-color: var(--danger-border); }
.badge-warning { background: var(--warning-soft); color: #92400E; border-color: var(--warning-border); }
.badge-info { background: var(--info-soft); color: #1D4ED8; border-color: var(--info-border); }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-200); }

/* ═══════════════════════════════════════
   MODAL
   ═══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  z-index: 200; display: flex;
  align-items: center; justify-content: center;
  padding: 16px; animation: fadeIn .2s;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 540px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-xl);
  animation: modalIn .25s cubic-bezier(.16,1,.3,1);
}
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px 0;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 600; color: var(--gray-800); }
.modal-close {
  background: none; border: none; font-size: 1.3rem;
  cursor: pointer; color: var(--gray-400); padding: 4px 6px;
  border-radius: var(--radius-sm); transition: all var(--transition);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 16px 24px 24px; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 0 24px 20px;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalIn { from { transform: translateY(12px) scale(.97); opacity: 0 } to { transform: none; opacity: 1 } }

/* ═══════════════════════════════════════
   TOAST
   ═══════════════════════════════════════ */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px; border-radius: var(--radius);
  font-size: .88rem; box-shadow: var(--shadow-lg);
  animation: toastIn .35s cubic-bezier(.16,1,.3,1);
  min-width: 260px; display: flex; align-items: center; gap: 8px;
  pointer-events: auto; border: 1px solid transparent;
  transition: all .3s ease;
}
.toast-success { background: #fff; color: #15803D; border-color: var(--success-border); }
.toast-error { background: #fff; color: #B91C1C; border-color: var(--danger-border); }
.toast-warning { background: #fff; color: #92400E; border-color: var(--warning-border); }
.toast-info { background: #fff; color: #1D4ED8; border-color: var(--info-border); }
@keyframes toastIn { from { transform: translateX(100%) scale(.9); opacity: 0 } to { transform: none; opacity: 1 } }

/* ═══════════════════════════════════════
   TABS
   ═══════════════════════════════════════ */
.tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px; overflow-x: auto;
}
.tab {
  padding: 10px 18px; cursor: pointer; font-size: .88rem;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
  transition: all var(--transition); background: none;
  border-top: none; border-left: none; border-right: none;
  font-weight: 400;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ═══════════════════════════════════════
   CAMERA / UPLOAD / LOADING
   ═══════════════════════════════════════ */
.camera-container { position: relative; width: 100%; max-width: 480px; margin: 0 auto; background: #000; border-radius: var(--radius); overflow: hidden; }
.camera-container video { width: 100%; display: block; }
.camera-container canvas { display: none; }
.camera-preview img { width: 100%; border-radius: var(--radius); border: 2px solid var(--primary); }
.camera-actions { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }

.upload-zone {
  border: 2px dashed var(--gray-300); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: all var(--transition); color: var(--text-secondary);
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-hover); }
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-preview { margin-top: 12px; }
.upload-preview img { max-height: 200px; margin: 0 auto; border-radius: var(--radius-sm); }

.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px; color: var(--text-secondary); gap: 10px;
  font-size: .9rem;
}
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ═══════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════ */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px;
  background: var(--bg-sidebar);
}
.login-card {
  background: var(--bg-card); border-radius: var(--radius-xl);
  padding: 40px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-xl);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 1.3rem; color: var(--gray-800); margin-top: 12px; }
.login-logo p { font-size: .85rem; color: var(--text-secondary); }

/* ═══════════════════════════════════════
   SEARCH / FILTER
   ═══════════════════════════════════════ */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search-input { flex: 1; min-width: 200px; }

/* ═══════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .6; }

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar { display: flex; }
  .overlay.show { display: block; }
  .main-content {
    margin-left: 0;
    padding: calc(var(--topbar-h) + 16px) 16px 24px;
  }
  .page-header h1 { font-size: 1.15rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .btn-group { width: 100%; }
  .btn-group .btn { flex: 1; justify-content: center; }
  .modal { margin: 8px; border-radius: var(--radius-lg); }
  td, th { padding: 8px 10px; font-size: .82rem; }
  .main-content { padding: calc(var(--topbar-h) + 12px) 12px 20px; }
  .card { padding: 16px; border-radius: var(--radius); }
}

/* ═══════════════════════════════════════
   PRINT
   ═══════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .overlay, .toast-container, .btn, .filter-bar, .tabs { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-light { color: var(--text-secondary); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.right { text-align: right; }

/* ═══════════════════════════════════════
   HERO PAYMENT CARD
   ═══════════════════════════════════════ */
.hero-payment {
  background: linear-gradient(135deg, #065F46 0%, #059669 50%, #34D399 100%);
  border-radius: 18px; padding: 1.5rem; margin-bottom: 1rem;
  color: #fff; position: relative; overflow: hidden;
  animation: fadeIn .4s ease-out;
}
.hero-payment::before {
  content: ''; position: absolute; top: -30%; right: -20%;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.hero-greeting { font-size: 0.88rem; opacity: 0.85; margin-bottom: 0.2rem; }
.hero-stall { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.4rem; }
.hero-divider { border: none; border-top: 1px solid rgba(255,255,255,0.2); margin: 0.8rem 0; }
.hero-label { font-size: 0.82rem; opacity: 0.8; margin-bottom: 0.15rem; }
.hero-amount { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.hero-amount.zero { opacity: 0.7; font-size: 1.3rem; }
.hero-period { font-size: 0.8rem; opacity: 0.7; margin-top: 0.15rem; }
.hero-row { display: flex; gap: 1rem; margin-top: 0.3rem; }
.hero-col { flex: 1; }
.hero-breakdown { margin: 6px 0 2px; padding: 6px 0 0; border-top: 1px dashed rgba(255,255,255,0.25); }
.hb-item { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; padding: 2px 0; color: rgba(255,255,255,0.85); }
.hb-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.hb-dot.rent { background: #A7F3D0; }
.hb-dot.water { background: #93C5FD; }
.hb-dot.electric { background: #FCD34D; }
.hb-dot.common { background: #C4B5FD; }
.hb-label { flex: 1; }
.hb-val { font-weight: 600; }
.hero-status {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.7rem; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; margin-top: 0.5rem;
}
.hero-status.pending { background: rgba(251,191,36,0.2); color: #FCD34D; }
.hero-status.paid { background: rgba(16,185,129,0.2); color: #6EE7B7; }
.hero-status.overdue { background: rgba(239,68,68,0.2); color: #FCA5A5; }
.hero-status.rejected { background: rgba(239,68,68,0.25); color: #FCA5A5; }

/* Hero CTA Button */
.hero-cta {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.9rem;
  background: rgba(255,255,255,0.95); color: #065F46;
  border: none; border-radius: 14px;
  font-family: var(--font); font-size: 1.1rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s; margin-top: 1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.hero-cta:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.hero-cta:active { transform: scale(0.98); }
.hero-cta.reviewing { background: rgba(251,191,36,0.2); color: #F59E0B; cursor: default; }
.hero-cta.success { background: rgba(16,185,129,0.2); color: #10B981; cursor: default; }
.hero-cta.rejected-cta { background: #FEE2E2; color: #DC2626; }

/* Due date warning */
.hero-due-warning {
  background: #fef9c3; border: 1px solid #facc15; border-radius: 8px;
  padding: 8px 12px; margin: 8px 0 4px; text-align: center;
  font-size: 14px; color: #92400e; font-weight: bold;
}
.hero-due-warning.urgent { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.hero-due-warning.soon { background: #ffedd5; border-color: #f97316; color: #9a3412; }

/* Reject banner */
.hero-reject-banner {
  background: rgba(220,38,38,0.18); border: 1px solid rgba(239,68,68,0.4);
  border-radius: 10px; padding: .65rem .9rem; margin-top: .75rem;
  font-size: .88rem; color: #FCA5A5; line-height: 1.5;
}
.hero-reject-banner strong { color: #fff; }
.hero-cancel-btn {
  background: transparent; border: 1px solid rgba(239,68,68,0.45);
  color: #FCA5A5; border-radius: 8px; padding: .42rem .9rem;
  font-size: .82rem; cursor: pointer; margin-top: .55rem;
  width: 100%; transition: background .2s; font-family: var(--font);
}
.hero-cancel-btn:hover { background: rgba(220,38,38,0.15); }

/* ═══════════════════════════════════════
   OUTSTANDING BANNER
   ═══════════════════════════════════════ */
.outstanding-banner {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border: 1.5px solid #F59E0B; border-radius: 14px;
  padding: 1rem 1.2rem; margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.8rem;
  animation: fadeIn .4s ease-out;
}
.outstanding-banner .ob-icon { font-size: 1.8rem; }
.outstanding-banner .ob-info { flex: 1; }
.outstanding-banner .ob-label { font-size: 0.82rem; color: #92400E; }
.outstanding-banner .ob-amount { font-size: 1.3rem; font-weight: 700; color: #B45309; }
.outstanding-banner .ob-btn {
  background: #B45309; color: #fff; border: none; border-radius: 10px;
  padding: 0.55rem 1rem; font-family: var(--font);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.outstanding-banner .ob-btn:hover { background: #92400E; }

/* ═══════════════════════════════════════
   QUICK ACTIONS
   ═══════════════════════════════════════ */
.quick-actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem;
  margin-bottom: 1rem;
}
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0.8rem 0.3rem; background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px; cursor: pointer; font-family: inherit;
  transition: all 0.2s; text-decoration: none; color: inherit;
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--success-border); }
.quick-action:active { transform: scale(0.97); }
.quick-action .qa-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.quick-action .qa-label {
  font-size: 0.75rem; font-weight: 500; color: var(--text-secondary);
  text-align: center; line-height: 1.3;
}

/* ═══════════════════════════════════════
   HUB GRID (Admin Dashboard)
   ═══════════════════════════════════════ */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem; margin-bottom: 1.25rem;
}
.hub-section {
  grid-column: 1 / -1;
  font-size: 0.78rem; font-weight: 700; color: var(--text-tertiary);
  letter-spacing: 0.03em; padding: 0.4rem 0; margin-top: 0.3rem;
  border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 0.4rem;
}
.hub-section:first-child { border-top: none; margin-top: 0; }
.hub-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 1rem 0.5rem; border-radius: var(--radius-lg);
  background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; font-family: inherit;
  transition: all 0.2s; text-decoration: none; color: inherit; position: relative;
}
.hub-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--success-border); }
.hub-item:active { transform: scale(0.97); }
.hub-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  background: var(--gray-50); transition: background 0.2s;
}
.hub-item:hover .hub-icon { background: var(--primary-soft); }
.hub-label {
  font-size: 0.78rem; font-weight: 500; color: var(--text-secondary);
  text-align: center; line-height: 1.3;
}
.hub-badge {
  position: absolute; top: 6px; right: 6px;
  background: var(--danger); color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  padding: 0 5px; line-height: 18px; text-align: center;
  font-family: system-ui, sans-serif;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

/* ═══════════════════════════════════════
   ADMIN STATS BAR
   ═══════════════════════════════════════ */
.admin-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .6rem; margin-bottom: 1.25rem;
}
.admin-stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  text-align: center; cursor: pointer; transition: all .2s;
}
.admin-stat:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.admin-stat-icon { font-size: 1.5rem; margin-bottom: .3rem; }
.admin-stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.admin-stat-value.danger { color: var(--danger); }
.admin-stat-value.ok { color: var(--success); }
.admin-stat-label { font-size: .72rem; color: var(--text-secondary); margin-top: .2rem; }

/* ═══════════════════════════════════════
   PPK ALERT/CONFIRM MODAL (beautiful)
   ═══════════════════════════════════════ */
#ppk-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 99999; opacity: 0; transition: opacity .22s ease;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 16px;
}
#ppk-overlay.ppk-show { opacity: 1; }
#ppk-box {
  background: #fff; border-radius: 20px;
  padding: 36px 32px 28px; max-width: 440px; width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.12);
  transform: scale(.88) translateY(-24px);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  text-align: center;
}
#ppk-overlay.ppk-show #ppk-box { transform: scale(1) translateY(0); }
#ppk-icon-wrap {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; font-size: 34px;
}
#ppk-icon-wrap.ppk-type-confirm { background: #eff6ff; }
#ppk-icon-wrap.ppk-type-danger { background: #fef2f2; }
#ppk-icon-wrap.ppk-type-success { background: #f0fdf4; }
#ppk-icon-wrap.ppk-type-error { background: #fef2f2; }
#ppk-icon-wrap.ppk-type-info { background: #f0f9ff; }
#ppk-icon-wrap.ppk-type-warning { background: #fffbeb; }
#ppk-title { font-size: 19px; font-weight: 700; color: #0f172a; margin-bottom: 10px; line-height: 1.35; }
#ppk-msg { font-size: 15px; color: #475569; white-space: pre-line; line-height: 1.75; margin-bottom: 28px; }
#ppk-btns { display: flex; gap: 10px; justify-content: center; }
.ppk-btn {
  flex: 1; max-width: 160px; padding: 11px 20px; border-radius: 12px;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
  border: none; transition: all .15s; letter-spacing: .01em;
}
.ppk-btn-cancel { background: #f1f5f9; color: #64748b; border: 2px solid #e2e8f0; }
.ppk-btn-cancel:hover { background: #e2e8f0; color: #334155; }
.ppk-btn-ok { background: var(--primary); color: #fff; }
.ppk-btn-ok:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,.35); }
.ppk-btn-ok:active { transform: translateY(0); }
.ppk-btn-ok.ppk-danger { background: #ef4444; }
.ppk-btn-ok.ppk-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,.35); }
.ppk-btn-ok.ppk-success { background: #22c55e; }
.ppk-btn-ok.ppk-success:hover { background: #16a34a; box-shadow: 0 4px 12px rgba(34,197,94,.35); }
.ppk-btn-ok.ppk-warning { background: #f59e0b; }
.ppk-btn-ok.ppk-warning:hover { background: #d97706; }

/* ═══════════════════════════════════════
   NAVBAR ENHANCEMENTS
   ═══════════════════════════════════════ */
/* Avatar section */
.sidebar-user-block {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 20px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #065F46, #10B981);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; border: 2px solid rgba(16,185,129,.5);
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--primary); margin-top: 1px; }

/* Nav link description */
.sidebar-nav a .nav-desc {
  display: block; font-size: 10.5px; font-weight: 400;
  color: rgba(255,255,255,.25); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .13s;
}
.sidebar-nav a:hover .nav-desc { color: rgba(255,255,255,.4); }
.sidebar-nav a.active .nav-desc { color: rgba(16,185,129,.55); }

/* Nav badge */
.nav-badge {
  position: absolute; top: 6px; right: 8px;
  background: var(--danger); color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  padding: 0 5px; line-height: 18px; text-align: center;
  font-family: system-ui, sans-serif;
}

/* Sidebar link relative for badge */
.sidebar-nav a { position: relative; }

/* Close button in sidebar */
.sidebar-close-btn {
  display: none; background: rgba(255,255,255,.06); border: none;
  color: rgba(255,255,255,.5); font-size: 17px;
  width: 36px; height: 36px; border-radius: 6px;
  cursor: pointer; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .14s, color .14s;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
@media (max-width: 1024px) { .sidebar-close-btn { display: flex; } }

/* Hamburger animation */
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text-on-dark); border-radius: 2px;
  transition: transform .22s ease, opacity .18s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Footer in sidebar */
.sidebar-bottom {
  flex-shrink: 0; border-top: 1px solid rgba(255,255,255,.06);
  padding: 13px 20px; display: flex; align-items: center; justify-content: center;
}
.sidebar-bottom .nav-logout {
  font-size: 12px; color: #F87171; text-decoration: none;
  font-weight: 600; padding: 6px 14px; border-radius: 6px;
  border: 1px solid rgba(248,113,113,.4); transition: background .13s, color .13s;
  white-space: nowrap; background: none; cursor: pointer; font-family: var(--font);
}
.sidebar-bottom .nav-logout:hover { background: #F87171; color: #fff; }

/* ═══════════════════════════════════════
   ADMIN ROLE SWITCHER
   ═══════════════════════════════════════ */
.role-switcher {
  padding: 8px 20px 12px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.role-switcher-label {
  display: block; font-size: 11px; color: rgba(255,255,255,.5);
  margin-bottom: 5px; font-weight: 500;
}
.role-switcher-select {
  width: 100%; padding: 7px 10px; border-radius: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: #fff; font-family: var(--font); font-size: 13px;
  cursor: pointer; outline: none; transition: border-color .2s;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.role-switcher-select:focus { border-color: var(--primary); }
.role-switcher-select option { background: #1F2937; color: #fff; }

/* View-as banner (sticky below topbar) */
.view-as-banner {
  position: sticky; top: 56px; z-index: 999;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff; text-align: center; padding: 6px 16px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  animation: fadeIn .3s ease-out;
  transition: background .2s;
}
.view-as-banner:hover { background: linear-gradient(135deg, #D97706, #B45309); }
.view-as-banner strong { font-weight: 700; }

@media (max-width: 480px) {
  .hero-payment { padding: 1.2rem; border-radius: 16px; }
  .hero-payment .hero-amount { font-size: 1.7rem; }
  .hero-cta { font-size: 1rem; padding: 0.8rem; }
  .outstanding-banner { flex-wrap: wrap; }
  .outstanding-banner .ob-btn { width: 100%; text-align: center; margin-top: 0.3rem; }
  .quick-actions { grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
  .quick-action .qa-icon { width: 40px; height: 40px; font-size: 1.2rem; }
  .quick-action .qa-label { font-size: 0.7rem; }
  .quick-action { padding: 0.65rem 0.2rem; }
}
@media (max-width: 350px) {
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
}