/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Egbin VendorPortal colour palette */
  --egbin-orange:   #e8651a;
  --egbin-orange-dk:#c5540f;
  --egbin-brown:    #3d2000;
  --sidebar-bg:     #1a1a1a;
  --sidebar-header: #111111;
  --sidebar-active: #3d2000;
  --sidebar-text:   #cccccc;
  --sidebar-muted:  #6b6b6b;

  /* Functional colours */
  --primary:        #e8651a;
  --primary-light:  #e8651a;
  --primary-mid:    #c5540f;
  --secondary:      #2e7d32;
  --danger:         #c62828;
  --warning:        #e65100;
  --info:           #0277bd;

  /* Greys */
  --gray-50:        #f5f5f5;
  --gray-100:       #f0f0f0;
  --gray-200:       #e0e0e0;
  --gray-300:       #cccccc;
  --gray-400:       #9e9e9e;
  --gray-500:       #757575;
  --gray-600:       #555555;
  --gray-700:       #424242;
  --gray-800:       #212121;

  --sidebar-w:      260px;
  --radius:         6px;
  --radius-lg:      10px;
  --shadow:         0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
}

a { color: var(--egbin-orange); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--egbin-orange-dk); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout       { display: flex; min-height: 100vh; }
.sidebar      { width: var(--sidebar-w); background: var(--sidebar-bg);
                color: white; display: flex; flex-direction: column;
                position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
                overflow-y: auto; }
.main-content { margin-left: var(--sidebar-w); flex: 1;
                padding: 28px 32px; min-height: 100vh; background: var(--gray-50); }

/* ── Sidebar logo / header ────────────────────────────────────────────────── */
.sidebar-logo {
  padding: 0;
  background: var(--sidebar-header);
  border-bottom: 2px solid var(--egbin-orange);
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 64px;
}
.sidebar-logo-img {
  height: 40px;
  padding: 12px 14px;
  display: block;
}
.sidebar-logo-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,0.15);
}
.sidebar-logo-text-wrap {
  padding: 8px 14px;
}
.sidebar-logo-text { font-weight: 700; font-size: 13px; color: white; line-height: 1.2; }
.sidebar-logo-sub  { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 2px; }

/* ── Sidebar user card ────────────────────────────────────────────────────── */
.sidebar-user      { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.sidebar-user-card { background: rgba(255,255,255,0.05); border-radius: var(--radius);
                     padding: 10px 12px; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: white; }
.sidebar-user-id   { font-size: 11px; color: var(--sidebar-muted); margin-top: 2px; }
.sidebar-method    { display: inline-block; margin-top: 6px; font-size: 10px;
                     color: var(--sidebar-muted); }

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */
.sidebar-section-label {
  padding: 14px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}
.sidebar-nav { flex: 1; padding: 6px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; margin: 1px 0;
  font-size: 13px; font-weight: 400;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border 0.15s;
  border-left: 3px solid transparent;
  border: none; background: none; cursor: pointer; width: 100%;
  border-left: 3px solid transparent;
}
.nav-item:hover  {
  background: rgba(232,101,26,0.1);
  color: white;
  text-decoration: none;
  border-left-color: rgba(232,101,26,0.4);
}
.nav-item.active {
  background: var(--sidebar-active);
  color: white;
  border-left: 3px solid var(--egbin-orange);
  font-weight: 500;
}
.nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sidebar-footer { padding: 10px 0; border-top: 1px solid rgba(255,255,255,0.07); }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #111111 0%, #2a1500 60%, #1a1a1a 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-box  { width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-img { height: 56px; margin-bottom: 12px; }
.auth-logo h1  { color: white; font-size: 20px; font-weight: 700; }
.auth-logo p   { color: rgba(255,255,255,0.55); font-size: 13px; margin-top: 4px; }
.auth-card     {
  background: white; border-radius: var(--radius-lg);
  padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  border-top: 3px solid var(--egbin-orange);
}
.auth-card h2 { font-size: 17px; font-weight: 600; margin-bottom: 20px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--gray-400); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--gray-200);
}

/* Microsoft SSO button */
.btn-microsoft {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  background: white; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
  color: var(--gray-800); text-decoration: none;
}
.btn-microsoft:hover { background: var(--gray-50); text-decoration: none; color: var(--gray-800); }
.btn-microsoft svg   { width: 20px; height: 20px; flex-shrink: 0; }

/* OTP digit inputs */
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 24px 0; }
.otp-digit  {
  width: 52px; height: 64px;
  border: 2px solid var(--gray-200); border-radius: var(--radius-lg);
  text-align: center; font-size: 26px; font-weight: 700;
  font-family: monospace; outline: none; transition: border 0.15s;
}
.otp-digit:focus { border-color: var(--egbin-orange); box-shadow: 0 0 0 3px rgba(232,101,26,0.15); }
.otp-digit.filled { border-color: var(--egbin-orange); }

/* ── Cards & containers ───────────────────────────────────────────────────── */
.card        {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-body   { padding: 20px 24px; }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--gray-200);
  font-weight: 600; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 3px solid var(--egbin-orange);
}
.page-header    { margin-bottom: 24px; }
.page-header h1 {
  font-size: 20px; font-weight: 700; color: var(--gray-800);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--egbin-orange);
  display: inline-block;
}
.page-header p  { color: var(--gray-500); font-size: 13px; margin-top: 6px; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-grid  {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card  {
  background: white; border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow);
  border-top: 3px solid var(--egbin-orange);
}
.stat-card.green  { border-top-color: var(--secondary); }
.stat-card.amber  { border-top-color: #f57c00; }
.stat-card.red    { border-top-color: var(--danger); }
.stat-card.blue   { border-top-color: var(--info); }
.stat-label { font-size: 11px; color: var(--gray-500); text-transform: uppercase;
              letter-spacing: 0.5px; font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; color: var(--gray-800); }
.stat-sub   { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table       { width: 100%; border-collapse: collapse; }
thead th    {
  background: var(--gray-50); color: var(--gray-600);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 10px 14px; text-align: left;
  border-bottom: 2px solid var(--egbin-orange);
}
tbody td    {
  padding: 12px 14px; border-bottom: 1px solid var(--gray-100);
  font-size: 13px; color: var(--gray-800); vertical-align: middle;
}
tbody tr:hover td { background: #fff8f5; }
tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.15s; white-space: nowrap; text-decoration: none;
}
.btn:hover       { text-decoration: none; filter: brightness(0.92); }
.btn:disabled    { opacity: 0.55; cursor: not-allowed; }
.btn-primary     { background: var(--egbin-orange); color: white; border-color: var(--egbin-orange); }
.btn-secondary   { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-success     { background: #2e7d32; color: white; border-color: #2e7d32; }
.btn-danger      { background: #c62828; color: white; border-color: #c62828; }
.btn-warning     { background: #e65100; color: white; border-color: #e65100; }
.btn-lg          { padding: 11px 22px; font-size: 14px; }
.btn-sm          { padding: 5px 10px; font-size: 12px; }
.btn-icon        {
  padding: 6px; border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: white; cursor: pointer; color: var(--gray-600);
  display: inline-flex; align-items: center;
}
.btn-icon:hover  { background: var(--gray-100); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group   { margin-bottom: 16px; }
label         {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--gray-600); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  font-size: 13px; color: var(--gray-800);
  outline: none; transition: border 0.15s; background: white;
}
.form-control:focus {
  border-color: var(--egbin-orange);
  box-shadow: 0 0 0 3px rgba(232,101,26,0.12);
}
.form-control:disabled { background: var(--gray-100); color: var(--gray-500); }
textarea.form-control  { resize: vertical; min-height: 80px; }
select.form-control    { appearance: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge          { display: inline-block; padding: 3px 9px; border-radius: 20px;
                  font-size: 11px; font-weight: 600; }
.badge-pending    { background: #fff3e0; color: #e65100; }
.badge-approved   { background: #e8f5e9; color: #2e7d32; }
.badge-rejected   { background: #ffebee; color: #c62828; }
.badge-cancelled  { background: var(--gray-100); color: var(--gray-600); }
.badge-waitlisted { background: #e3f2fd; color: #1565c0; }
.badge-checked_in { background: #e8f5e9; color: #1b5e20; }
.badge-no_show    { background: #ffebee; color: #b71c1c; }
.badge-scheduled  { background: #e3f2fd; color: #1565c0; }
.badge-boarding   { background: #e8f5e9; color: #1b5e20; }
.badge-departed   { background: var(--gray-100); color: var(--gray-600); }
.badge-staff      { background: #fff8f5; color: var(--egbin-orange); }
.badge-visitor    { background: #fff3e0; color: #e65100; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert         {
  padding: 11px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px; border: 1px solid transparent;
}
.alert-info    { background: #e3f2fd; color: #0c47a1; border-color: #bbdefb; }
.alert-success { background: #e8f5e9; color: #1b5e20; border-color: #c8e6c9; }
.alert-warning { background: #fff3e0; color: #bf360c; border-color: #ffe0b2; }
.alert-danger  { background: #ffebee; color: #b71c1c; border-color: #ffcdd2; }

/* Flask flash messages */
.flash-messages { margin-bottom: 16px; }
.flash-msg      {
  padding: 11px 14px; border-radius: var(--radius); font-size: 13px;
  margin-bottom: 8px; display: flex; align-items: center;
  gap: 8px; border: 1px solid transparent;
}
.flash-msg.success { background: #e8f5e9; color: #1b5e20; border-color: #c8e6c9; }
.flash-msg.info    { background: #e3f2fd; color: #0c47a1; border-color: #bbdefb; }
.flash-msg.warning { background: #fff3e0; color: #bf360c; border-color: #ffe0b2; }
.flash-msg.danger  { background: #ffebee; color: #b71c1c; border-color: #ffcdd2; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; display: flex; align-items: center;
  justify-content: center; padding: 20px;
}
.modal {
  background: white; border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  border-top: 3px solid var(--egbin-orange);
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body      { padding: 20px; }
.modal-footer    {
  padding: 14px 20px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tab-bar       {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}
.tab-btn       {
  padding: 10px 20px; border: none; background: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--gray-500);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s;
}
.tab-btn.active  { color: var(--egbin-orange); border-bottom-color: var(--egbin-orange); font-weight: 600; }
.tab-btn:hover   { color: var(--gray-800); }
.tab-pane        { display: none; }
.tab-pane.active { display: block; }

/* ── Step wizard ─────────────────────────────────────────────────────────── */
.steps      { display: flex; align-items: center; margin-bottom: 28px; }
.step       { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.step-num   {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.step.active .step-num { background: var(--egbin-orange); color: white; }
.step.done .step-num   { background: var(--secondary); color: white; }
.step-line       { flex: 1; height: 2px; background: var(--gray-200); margin: 0 12px; }
.step-line.done  { background: var(--secondary); }

/* ── Staff search dropdown ───────────────────────────────────────────────── */
.search-dropdown  { position: relative; }
.search-results   {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: white; border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  max-height: 220px; overflow-y: auto;
}
.search-result-item {
  padding: 10px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
}
.search-result-item:hover { background: #fff8f5; }
.search-result-item:last-child { border-bottom: none; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow-md); font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  min-width: 250px; max-width: 380px;
  animation: slideIn 0.2s ease;
}
.toast-success { background: #1b5e20; color: white; }
.toast-error   { background: #b71c1c; color: white; }
.toast-info    { background: var(--egbin-orange); color: white; }
.toast-warning { background: #e65100; color: white; }
@keyframes slideIn {
  from { opacity:0; transform: translateX(20px); }
  to   { opacity:1; transform: translateX(0); }
}

/* ── QR code display ─────────────────────────────────────────────────────── */
.qr-wrap    { text-align: center; padding: 20px; }
.qr-wrap img {
  border: 3px solid var(--egbin-orange);
  border-radius: var(--radius); padding: 8px;
}
.qr-ref     {
  font-family: monospace; font-size: 15px; font-weight: 700;
  color: var(--egbin-orange); letter-spacing: 2px; margin-top: 10px;
}

/* ── Misc utilities ──────────────────────────────────────────────────────── */
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.empty-state   { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.empty-state p { margin-top: 10px; font-size: 14px; }
.loading       { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner       {
  width: 32px; height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--egbin-orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
code { font-family: monospace; font-size: 12px; background: var(--gray-100);
       padding: 2px 6px; border-radius: 4px; color: var(--egbin-orange); }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination  {
  display: flex; align-items: center; gap: 6px;
  justify-content: center; margin-top: 20px;
}
.page-btn    {
  padding: 6px 12px; border: 1px solid var(--gray-200);
  border-radius: var(--radius); font-size: 12px;
  background: white; cursor: pointer;
}
.page-btn.active { background: var(--egbin-orange); color: white; border-color: var(--egbin-orange); }
.page-btn:hover:not(.active) { background: var(--gray-100); }

/* ── Role badges in sidebar ──────────────────────────────────────────────── */
.role-badge-admin       { background: #3d0014; color: #ff8a80; }
.role-badge-support     { background: #0d2137; color: #82b1ff; }
.role-badge-staff       { background: #1b3a1b; color: #69f0ae; }
.role-badge-coordinator { background: #3d1a00; color: #ffab40; }
.role-badge-audit       { background: #2d2d2d; color: #b0bec5; }
