@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --indigo:   #4f46e5;
  --indigo-d: #3730a3;
  --indigo-l: #eef2ff;
  --blue:     #2563eb;
  --blue-l:   #dbeafe;
  --amber:    #d97706;
  --amber-l:  #fef3c7;
  --purple:   #7c3aed;
  --purple-l: #ede9fe;
  --green:    #059669;
  --green-l:  #d1fae5;
  --red:      #dc2626;
  --red-l:    #fee2e2;
  --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;
  --white: #ffffff;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);
}

body {
  font-family: 'Inter', sans-serif;
  background: #f0f2f8;
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─────────────── AUTH ─────────────── */
.auth-body {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e40af 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-wrap { width: 100%; padding: 20px; display: flex; justify-content: center; }
.auth-card {
  background: var(--white);
  border-radius: 20px;
  padding: 44px 40px;
  width: 400px;
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 32px;
}
.brand-icon {
  width: 48px; height: 48px; background: var(--indigo);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.brand-name { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.brand-sub  { font-size: 12px; color: var(--gray-400); }
.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-desc  { color: var(--gray-400); margin-bottom: 28px; font-size: 13px; }
.auth-hint  { font-size: 12px; color: var(--gray-400); text-align: center; margin-top: 16px; line-height: 1.6; }
.auth-hint code { background: var(--gray-100); padding: 1px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; }

/* ─────────────── TOPNAV ─────────────── */
.topnav {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  height: 64px;
  display: flex; align-items: center;
  padding: 0 28px; gap: 8px;
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
.nav-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo {
  width: 38px; height: 38px; background: var(--indigo);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.brand-text .brand-name { font-size: 15px; font-weight: 700; color: var(--gray-900); display: block; }
.brand-text .brand-tag  { font-size: 11px; color: var(--gray-400); display: block; }
.nav-links { display: flex; gap: 2px; margin-left: 32px; flex: 1; }
.nav-link {
  height: 36px; padding: 0 14px;
  display: flex; align-items: center; gap: 6px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--gray-500); text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--gray-100); color: var(--gray-800); }
.nav-link.active { background: var(--indigo-l); color: var(--indigo); }
.nav-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-user  { display: flex; align-items: center; gap: 10px; }
.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--indigo); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.nav-avatar.admin-avatar { background: var(--amber); }
.nav-user-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.nav-user-role { font-size: 11px; color: var(--gray-400); }
.btn-logout {
  height: 34px; padding: 0 14px; font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  background: white; color: var(--gray-600);
  cursor: pointer; text-decoration: none; display: flex; align-items: center;
  transition: background .15s, border-color .15s;
}
.btn-logout:hover { background: var(--gray-50); border-color: var(--gray-300); }

/* ─────────────── PAGE ─────────────── */
.page-wrapper { max-width: 1160px; margin: 0 auto; padding: 28px 24px; }
.page-header  { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 12px; }
.page-title   { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.page-sub     { font-size: 13px; color: var(--gray-400); margin-top: 2px; }
.page-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.date-badge   { font-size: 13px; color: var(--gray-500); background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; padding: 6px 12px; }
.mt-20        { margin-top: 20px; }
.mt-12        { margin-top: 12px; }

/* ─────────────── STATS ─────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 14px;
  color: white; transition: transform .15s;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card.indigo { background: linear-gradient(135deg, #4f46e5, #3730a3); }
.stat-card.blue   { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.stat-card.amber  { background: linear-gradient(135deg, #d97706, #b45309); }
.stat-card.purple { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.stat-icon-wrap { font-size: 28px; opacity: .85; flex-shrink: 0; }
.stat-label { font-size: 12px; opacity: .8; font-weight: 500; margin-bottom: 2px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -1px; }

/* ─────────────── PANEL ─────────────── */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 18px;
}
.panel-icon  { font-size: 17px; }
.panel-title { font-size: 15px; font-weight: 700; color: var(--gray-900); flex: 1; }
.panel-link  { font-size: 13px; color: var(--indigo); text-decoration: none; font-weight: 500; }
.panel-link:hover { text-decoration: underline; }

/* ─────────────── DASHBOARD GRID ─────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.right-col { display: flex; flex-direction: column; gap: 16px; }

/* ─────────────── FORMS ─────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--gray-600);
  margin-bottom: 6px; letter-spacing: .3px;
}
input[type=text], input[type=password], input[type=email], input[type=date],
select, textarea {
  width: 100%; height: 42px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  padding: 0 13px; font-family: inherit; font-size: 14px;
  color: var(--gray-800); background: var(--white); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea { height: auto; padding: 10px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; cursor: pointer;
}
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.eye-btn {
  position: absolute; right: 0; top: 0; width: 42px; height: 42px;
  background: none; border: none; cursor: pointer; font-size: 14px; color: var(--gray-400);
}

/* ─────────────── VERIFY BOX ─────────────── */
.verify-box { }
.tx-input {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 13px !important;
  letter-spacing: .5px;
}
.verify-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.icon-btn {
  width: 42px; height: 42px; flex-shrink: 0;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  background: var(--white); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--gray-50); border-color: var(--gray-300); }

/* RESULT CARD */
.result-card {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1.5px solid;
  animation: slideDown .2s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.result-card.valid {
  background: var(--green-l); border-color: #6ee7b7; color: #065f46;
}
.result-card.used  {
  background: var(--red-l); border-color: #fca5a5; color: #991b1b;
}
.result-card .rc-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; margin-bottom: 8px;
}
.result-card .rc-icon { font-size: 18px; }
.result-card .rc-row {
  display: flex; gap: 6px; font-size: 13px; margin-bottom: 4px; align-items: flex-start;
}
.result-card .rc-key { font-weight: 600; min-width: 110px; opacity: .7; flex-shrink: 0; }
.result-card .rc-val { font-weight: 500; }
.result-card .rc-val.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* BUTTONS */
.btn-save {
  width: 100%; height: 46px;
  background: var(--indigo); color: white;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .1s, opacity .2s;
  margin-top: 4px;
}
.btn-save:hover:not(:disabled)  { background: var(--indigo-d); }
.btn-save:active:not(:disabled) { transform: scale(.98); }
.btn-save:disabled { opacity: .4; cursor: not-allowed; }
.btn-login { @extend .btn-save; } /* share style via override below */
.btn-login {
  width: 100%; height: 44px; background: var(--indigo); color: white;
  border: none; border-radius: var(--radius-sm); font-family: inherit;
  font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 6px;
  transition: background .15s;
}
.btn-login:hover { background: var(--indigo-d); }
.btn-export {
  height: 38px; padding: 0 16px; background: var(--indigo); color: white;
  border: none; border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; display: flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.btn-export:hover { background: var(--indigo-d); }
.btn-filter, .btn-clear {
  height: 40px; padding: 0 16px; border-radius: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  text-decoration: none; display: flex; align-items: center;
}
.btn-filter { background: var(--indigo); color: white; border: none; }
.btn-filter:hover { background: var(--indigo-d); }
.btn-clear  { background: white; color: var(--gray-600); border: 1.5px solid var(--gray-200); }
.btn-clear:hover { background: var(--gray-50); }
.btn-cam {
  width: 100%; height: 42px; background: var(--indigo); color: white;
  border: none; border-radius: var(--radius-sm); font-family: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer; display: flex;
  align-items: center; justify-content: center; gap: 8px;
  transition: background .15s;
}
.btn-cam:hover { background: var(--indigo-d); }

/* ─────────────── UPLOAD ─────────────── */
.upload-drop {
  border: 2px dashed var(--gray-200); border-radius: var(--radius-sm);
  padding: 22px; text-align: center; color: var(--gray-400);
  cursor: pointer; transition: all .2s;
}
.upload-drop:hover, .upload-drop.drag {
  border-color: var(--indigo); background: var(--indigo-l); color: var(--indigo);
}
.upload-drop strong { color: var(--gray-700); font-size: 13px; }
.upload-drop small  { font-size: 11px; display: block; margin-top: 4px; }

/* ─────────────── CAMERA ─────────────── */
.cam-preview {
  width: 100%; height: 150px; background: var(--gray-100);
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400); font-size: 13px; margin-bottom: 12px;
  overflow: hidden;
}
#cam-placeholder { text-align: center; }

/* ─────────────── CHART ─────────────── */
.chart-wrap { position: relative; height: 190px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--gray-500); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot  { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ─────────────── FILTERS ─────────────── */
.filters-bar {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center;
}
.filter-input, .filter-select {
  height: 40px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  padding: 0 13px; font-family: inherit; font-size: 13px; outline: none;
  background: white; color: var(--gray-800); transition: border-color .2s;
}
.filter-input:focus, .filter-select:focus { border-color: var(--indigo); }
.filter-input[name=q] { flex: 1; min-width: 180px; }

/* ─────────────── TABLE ─────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--gray-50); }
th {
  padding: 11px 14px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1.5px solid var(--gray-200); white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }
.empty-row { text-align: center; color: var(--gray-400); padding: 40px !important; }
.row-num   { color: var(--gray-300); font-size: 12px; }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--gray-600); }
.date-cell { color: var(--gray-400); font-size: 12px; white-space: nowrap; }
.note-text { color: var(--gray-400); font-size: 12px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.receipt-link { color: var(--blue); text-decoration: none; font-size: 12px; }
.receipt-link:hover { text-decoration: underline; }
.no-receipt { color: var(--gray-300); }
.btn-delete {
  background: none; border: none; cursor: pointer; color: var(--gray-400);
  font-size: 12px; padding: 4px 8px; border-radius: 6px;
  transition: color .15s, background .15s;
}
.btn-delete:hover { color: var(--red); background: var(--red-l); }

/* USER CELL */
.user-cell   { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--indigo); color: white; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-avatar.admin-avatar { background: var(--amber); }
.user-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.user-role { font-size: 11px; color: var(--gray-400); }

/* ─────────────── BADGES ─────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-blue   { background: var(--blue-l); color: #1d4ed8; }
.badge-amber  { background: var(--amber-l); color: #92400e; }
.badge-purple { background: var(--purple-l); color: #5b21b6; }
.badge-gray   { background: var(--gray-100); color: var(--gray-500); }
.badge-green  { background: var(--green-l); color: #065f46; }
.badge-red    { background: var(--red-l); color: #991b1b; }

/* ─────────────── ALERTS ─────────────── */
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; font-weight: 500; }
.alert-error   { background: var(--red-l); color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: var(--green-l); color: #065f46; border: 1px solid #6ee7b7; }

/* ─────────────── ADMIN PAGE ─────────────── */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.user-list  { display: flex; flex-direction: column; gap: 10px; }
.user-item  {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-100); background: var(--gray-50);
  transition: border-color .15s;
}
.user-item:hover { border-color: var(--gray-200); }
.user-info  { flex: 1; min-width: 0; }
.user-info-name { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.user-info-meta { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.user-info-date { font-size: 11px; color: var(--gray-300); margin-top: 2px; }
.user-actions   { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.role-tag { display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.role-tag.admin     { background: var(--amber-l); color: #92400e; }
.role-tag.secretary { background: var(--indigo-l); color: var(--indigo); }
.btn-sm {
  height: 30px; padding: 0 10px; border-radius: 6px; border: none;
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: opacity .15s;
}
.btn-sm:hover { opacity: .8; }
.btn-warn   { background: var(--amber-l); color: #92400e; }
.btn-ok     { background: var(--green-l); color: #065f46; }
.btn-danger { background: var(--red-l); color: #991b1b; }

/* ─────────────── PAGINATION ─────────────── */
.pagination { display: flex; gap: 6px; padding: 16px 0 4px; justify-content: center; flex-wrap: wrap; }
.page-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  text-decoration: none; color: var(--gray-600); border: 1.5px solid var(--gray-200);
  transition: all .15s;
}
.page-btn:hover { background: var(--indigo-l); color: var(--indigo); border-color: var(--indigo); }
.page-btn.active { background: var(--indigo); color: white; border-color: var(--indigo); }

/* ─────────────── TOAST ─────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 13px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: white;
  transform: translateY(70px); opacity: 0; pointer-events: none;
  transition: transform .3s, opacity .3s; z-index: 999;
  box-shadow: var(--shadow-lg);
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { background: var(--green); }
#toast.error   { background: var(--red); }
#toast.info    { background: var(--indigo); }

/* ─────────────── RESPONSIVE ─────────────── */
@media (max-width: 800px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid  { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .nav-user-info { display: none; }
  .page-wrapper { padding: 16px; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topnav { padding: 0 14px; }
}






/* FORCE MOBILE BOTTOM NAV */
.bottom-nav { display: none; }
.desktop-only { }

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .page-wrapper { padding-bottom: 90px !important; }
  .bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    height: 72px;
    background: rgba(4,8,15,0.97);
    border-top: 1px solid rgba(56,189,248,0.25);
    backdrop-filter: blur(24px);
    z-index: 9999;
    padding: 0 20px;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.7);
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    text-decoration: none; color: rgba(125,211,252,0.4);
    padding: 8px 0; transition: all 0.2s;
  }
  .bottom-nav-icon {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px; transition: all 0.25s;
  }
  .bottom-nav-label {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
  }
  .bottom-nav-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: transparent; position: absolute; bottom: 2px;
  }
  .bottom-nav-item.active { color: #38bdf8; }
  .bottom-nav-item.active .bottom-nav-icon {
    background: rgba(56,189,248,0.15);
    box-shadow: 0 0 16px rgba(56,189,248,0.25);
    transform: translateY(-5px) scale(1.1);
    color: #7dd3fc;
  }
  .bottom-nav-item.active .bottom-nav-label { color: #38bdf8; font-weight: 700; }
  .bottom-nav-item.active .bottom-nav-dot { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
  .nav-user-info { display: none !important; }
  .stats-grid { grid-template-columns: repeat(2,1fr) !important; }
  .dash-grid { grid-template-columns: 1fr !important; }
}