/* filepath: public/css/main.css */
/* ═══════════════════════════════════════
   ReceiptFlow - Mobile-first Responsive CSS
   ═══════════════════════════════════════ */

/* ── Fonts (same as HexSkill) ── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Noto+Sans+Thai:wght@300;400;500;600;700&family=Source+Code+Pro:wght@400;500;600&display=swap');

/* ── Design Tokens ── */
:root {
  --color-primary: #7c3aed;
  --color-primary-dark: #5b21b6;
  --color-primary-light: #f5f3ff;
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1a202c;
  --color-text-muted: #718096;
  --color-success: #38a169;
  --color-warning: #d69e2e;
  --color-danger: #e53e3e;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --sidebar-w: 200px;
  --sidebar-w-sm: 52px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }
img { max-width: 100%; height: auto; }
table { border-collapse: collapse; width: 100%; }

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.main-content__inner {
  flex: 1;
  padding: 16px;
  padding-bottom: 48px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.topbar__left { display: flex; align-items: center; gap: 10px; }
.topbar__hamburger {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: transparent;
  cursor: pointer; color: var(--color-text-muted);
}
.topbar__hamburger:hover { background: var(--color-bg); color: var(--color-text); }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.topbar__user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--color-border); border-radius: 999px;
  background: transparent; cursor: pointer; font-family: inherit;
  font-size: .82rem; color: var(--color-text); transition: background var(--transition);
}
.topbar__user-btn:hover { background: var(--color-bg); }
.topbar__avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; flex-shrink: 0;
}
.topbar__user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__dropdown-wrap { position: relative; }
.topbar__dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  min-width: 210px; z-index: 200; overflow: hidden;
}
.topbar__dropdown-header {
  padding: 12px 16px; border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}
.topbar__dropdown-name { font-weight: 700; font-size: .88rem; color: var(--color-text); }
.topbar__dropdown-email { font-size: .75rem; color: var(--color-text-muted); margin-top: 1px; }
.topbar__dropdown-role {
  display: inline-block; font-size: .68rem; font-weight: 600; text-transform: uppercase;
  padding: 1px 8px; border-radius: 999px; margin-top: 4px;
  background: var(--color-primary-light); color: var(--color-primary);
}
.topbar__dropdown-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px; border: none; border-bottom: 1px solid #f8fafc;
  background: transparent; cursor: pointer; font-family: inherit;
  font-size: .85rem; color: var(--color-text); text-decoration: none;
  transition: background var(--transition);
}
.topbar__dropdown-item:hover { background: var(--color-bg); }
.topbar__dropdown-item--danger { color: var(--color-danger); }
.topbar__dropdown-item--danger:hover { background: #fff5f5; }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: -260px;
  width: 260px;
  height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: left var(--transition);
  box-shadow: var(--shadow-lg);
}
.sidebar--open { left: 0; }

.sidebar__header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
}
.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--color-primary);
}
.sidebar__logo-icon { width: 28px; height: 28px; }

.sidebar__nav {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
  transition: background var(--transition);
}
.sidebar__link:hover { background: var(--color-primary-light); color: var(--color-primary); }
.sidebar__icon { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar__divider { height: 1px; background: var(--color-border); margin: 8px 0; }

.sidebar__footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
}
.sidebar__user-tenant {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  padding: 0 12px 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar__user-role {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 8px;
  margin: 0 12px 2px;
  border-radius: 999px;
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.sidebar__user-email {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  padding: 4px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar__link--logout { color: var(--color-danger); }
.sidebar__link--logout:hover { background: #fee2e2; }

/* Mobile hamburger */
.mobile-menu-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 101;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.mobile-menu-btn svg { width: 24px; height: 24px; }

/* ── Page Header ── */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-top: 48px; /* space for mobile hamburger */
}
.page-title { font-size: 22px; font-weight: 700; }
.page-header__actions { display: flex; gap: 8px; }

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}
.card__title { font-size: 16px; font-weight: 600; }
.card__body { padding: 16px; }
.card--narrow { max-width: 560px; }

/* ── Stat Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 16px;
  text-align: center;
  border-top: 3px solid var(--card-accent, var(--color-primary));
}
.stat-card__value { font-size: 28px; font-weight: 700; color: var(--card-accent, var(--color-primary)); }
.stat-card__label { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }
.stat-card__sub { font-size: 12px; color: var(--color-text-muted); opacity: 0.7; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn--outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn--outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: #c53030; color: #fff; }
.btn--success { background: var(--color-success); color: #fff; }
.btn--success:hover { background: #2f855a; color: #fff; }
.btn--sm { padding: 4px 10px; font-size: 12px; }
.btn--block { width: 100%; }
.btn-group { display: flex; gap: 8px; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--color-text); }
.form-input {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition);
}
select.form-input { font-family: inherit; }
textarea.form-input { font-family: inherit; resize: vertical; }
.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.form-input--sm { padding: 4px 8px; font-size: 12px; width: auto; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Filter ── */
.filter-form { }
.filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.filter-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── Tables ── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; font-size: 13px; }
.data-table thead { background: var(--color-bg); }
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table th { font-weight: 600; font-size: 12px; text-transform: uppercase; color: var(--color-text-muted); }
.data-table tbody tr:hover { background: var(--color-primary-light); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
}
.badge--queued { background: #e2e8f0; color: #4a5568; }
.badge--processing { background: #bee3f8; color: #2b6cb0; }
.badge--done { background: #c6f6d5; color: #276749; }
.badge--failed { background: #fed7d7; color: #9b2c2c; }
.badge--pending { background: #fefcbf; color: #975a16; }
.badge--confirmed { background: #c6f6d5; color: #276749; }
.badge--rejected { background: #fed7d7; color: #9b2c2c; }
.badge--success { background: #c6f6d5; color: #276749; }
.badge--danger { background: #fed7d7; color: #9b2c2c; }
.badge--warning { background: #fefcbf; color: #975a16; }
.badge--role { background: var(--color-primary-light); color: var(--color-primary); }
/* ── Badge OCR Status Animations ── */
.badge--queued { animation: fadeInOut 2s ease-in-out infinite; }
.badge--processing { animation: fadeInOut 1.2s ease-in-out infinite; }
.badge--done { animation: badgeIn 0.4s ease; }
.badge--failed { animation: badgeIn 0.4s ease; }

@keyframes fadeInOut {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes badgeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ── OCR Error Tooltip ── */
.ocr-error-tooltip {
  position: absolute;
  z-index: 50;
  background: #1a202c;
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  margin-top: 4px;
  box-shadow: var(--shadow-md);
}

.badge--free { background: #e2e8f0; color: #4a5568; }
.badge--pro { background: #bee3f8; color: #2b6cb0; }
.badge--enterprise { background: #e9d8fd; color: #6b46c1; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
}
.pagination__link {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text);
}
.pagination__link:hover { background: var(--color-primary-light); color: var(--color-primary); }
.pagination__link--active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.pagination__ellipsis { padding: 6px 4px; color: var(--color-text-muted); }

/* ── Flash Alert (inline page banners) ── */
.flash-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
  border-left-width: 4px;
  border-left-style: solid;
}
.flash-alert--success { background: #f0fdf4; color: #15803d; border-color: #22c55e; border: 1px solid #bbf7d0; border-left: 4px solid #22c55e; }
.flash-alert--error   { background: #fef2f2; color: #b91c1c; border-color: #f87171; border: 1px solid #fecaca; border-left: 4px solid #ef4444; }
.flash-alert--warning { background: #fffbeb; color: #92400e; border-color: #fbbf24; border: 1px solid #fde68a; border-left: 4px solid #f59e0b; }
.flash-alert--info    { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; border: 1px solid #bfdbfe; border-left: 4px solid #3b82f6; }
.flash-alert__close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0 4px;
}

/* ── Toast notifications (floating) ── */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px) scale(.97); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(.95); }
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 420px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  animation: toastIn .22s cubic-bezier(.21,1.02,.73,1) forwards;
  border-left: 4px solid transparent;
  backdrop-filter: blur(8px);
}
.toast--success { background: #f0fdf4; color: #15803d; border-left-color: #22c55e; }
.toast--error   { background: #fef2f2; color: #b91c1c; border-left-color: #ef4444; }
.toast--warning { background: #fffbeb; color: #92400e; border-left-color: #f59e0b; }
.toast--info    { background: #eff6ff; color: #1d4ed8; border-left-color: #3b82f6; }
.toast__icon {
  font-size: .95rem;
  flex-shrink: 0;
}
.toast--success .toast__icon { color: #22c55e; }
.toast--error   .toast__icon { color: #ef4444; }
.toast--warning .toast__icon { color: #f59e0b; }
.toast--info    .toast__icon { color: #3b82f6; }
.toast__msg { flex: 1; line-height: 1.45; }
.toast__close {
  background: none;
  border: none;
  cursor: pointer;
  color: currentColor;
  opacity: .45;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: .8rem;
  transition: opacity .15s;
  flex-shrink: 0;
}
.toast__close:hover { opacity: .85; }

/* ── Quota Banner ── */
.quota-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
}
.quota-banner--warning { background: #fefcbf; color: #975a16; border: 1px solid #fbd38d; }
.quota-banner--danger { background: #fed7d7; color: #9b2c2c; border: 1px solid #feb2b2; }
.quota-banner__link { font-weight: 600; text-decoration: underline; }

/* ── Progress Bar ── */
.progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar__fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}
.upload-zone--active { border-color: var(--color-primary); background: var(--color-primary-light); }
.upload-zone--has-files { border-style: solid; }
.upload-zone__placeholder { }
.upload-zone__icon { width: 48px; height: 48px; color: var(--color-text-muted); margin-bottom: 12px; }
.upload-zone__text { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.upload-zone__hint { font-size: 13px; color: var(--color-text-muted); margin-bottom: 16px; }
.upload-zone__input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.upload-zone__preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  text-align: left;
}
.preview-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}
.preview-item__img { width: 100%; height: 100px; object-fit: cover; }
.preview-item__info { padding: 8px; }
.preview-item__name { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-item__size { font-size: 11px; color: var(--color-text-muted); }
.preview-item__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.upload-info { margin-top: 12px; font-size: 13px; color: var(--color-text-muted); }

/* ── Detail Page ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.detail-grid > .card:first-child {
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.detail-grid > .card:first-child .card__body {
  flex: 1;
  display: flex;
  padding: 0;
}
.slip-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border: none;
  background: var(--color-bg);
}
.detail-list { }
.detail-list dt {
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-top: 12px;
}
.detail-list dd { font-size: 15px; font-weight: 500; }
.detail-amount { font-size: 22px; color: var(--color-primary); font-weight: 700; }

/* ── Error Page ── */
.error-page { text-align: center; padding: 80px 20px; }
.error-page__code { font-size: 72px; font-weight: 700; color: var(--color-primary); }
.error-page__title { font-size: 24px; margin: 8px 0; }
.error-page__message { color: var(--color-text-muted); margin-bottom: 24px; }

/* ── Auth Page ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 50%, #1a202c 100%);
  position: relative;
}
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}
.auth-card__header { text-align: center; margin-bottom: 24px; }
.auth-card__title { font-size: 28px; font-weight: 700; color: var(--color-primary); }
.auth-card__subtitle { font-size: 14px; color: var(--color-text-muted); margin-top: 4px; }
.auth-card__footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--color-text-muted); }

/* Quick Login */
.quick-login { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-border); }
.quick-login__title { font-size: 11px; text-transform: uppercase; color: var(--color-text-muted); text-align: center; margin-bottom: 8px; letter-spacing: 0.5px; }
.quick-login__list { display: flex; gap: 8px; }
.quick-login__btn {
  flex: 1; padding: 8px 4px; font-size: 12px; font-weight: 600; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition); background: var(--color-surface);
}
.quick-login__btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.quick-login__btn--sysadmin { color: #e53e3e; border-color: #fed7d7; }
.quick-login__btn--sysadmin:hover { background: #fff5f5; }
.quick-login__btn--admin { color: #7c3aed; border-color: #ddd6fe; }
.quick-login__btn--admin:hover { background: #f5f3ff; }
.quick-login__btn--user { color: #38a169; border-color: #c6f6d5; }
.quick-login__btn--user:hover { background: #f0fff4; }

/* ── Tab Clips ── */
.tab-clips {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tab-clip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.tab-clip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.tab-clip--active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.tab-clip--active:hover { background: var(--color-primary-dark); }
.tab-clip svg { flex-shrink: 0; }

/* ── Settings Table ── */
.settings-table td { vertical-align: middle; }
.settings-table td:first-child { white-space: nowrap; }
.settings-table .form-input { margin: 0; }

/* ── Key Hidden (mask text with dots) ── */
.key-hidden {
  -webkit-text-security: disc;
  color: var(--color-text-muted);
}

/* ── Bank Form Layout ── */
.bank-form-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1024px) { .bank-form-layout { grid-template-columns: 1fr 1fr; } }

/* ── Mode Selector ── */
.mode-selector { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .mode-selector { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.mode-option {
  display: block;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
}
.mode-option:hover { border-color: var(--color-primary); }
.mode-option--active { border-color: var(--color-primary); background: var(--color-primary-light); }
.mode-option__header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mode-option__desc { font-size: 13px; color: var(--color-text-muted); line-height: 1.5; margin: 0; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal--sm { max-width: 400px; }
.modal--lg { max-width: 720px; }
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.modal__title { font-size: 18px; font-weight: 600; }
.modal__close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0 4px;
}
.modal__body { padding: 20px; overflow-y: auto; flex: 1; }
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
}

/* ── Inline form ── */
.inline-form { display: flex; align-items: center; gap: 6px; }

/* ── WebSocket Toast ── */
.ws-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toastIn 0.3s ease;
  max-width: 360px;
}
.toast--success { background: #c6f6d5; color: #276749; border: 1px solid #9ae6b4; }
.toast--error { background: #fed7d7; color: #9b2c2c; border: 1px solid #feb2b2; }
.toast--info { background: #bee3f8; color: #2b6cb0; border: 1px solid #90cdf4; }
.ws-toast__content { flex: 1; }
.ws-toast__content strong { display: block; }
.ws-toast__content span { font-size: 12px; opacity: 0.8; }
.ws-toast__close { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: 0.6; padding: 0 4px; }
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Utility ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }

/* ── Mobile Bottom Nav ── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  font-size: 10px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.bottom-nav__item svg { width: 22px; height: 22px; }
.bottom-nav__item:hover,
.bottom-nav__item:active { color: var(--color-primary); }
.bottom-nav__item--upload {
  color: var(--color-surface);
  position: relative;
}
.bottom-nav__item--upload svg {
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  border-radius: 50%;
  padding: 4px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(124,58,237,0.4);
  margin-top: -10px;
}
.bottom-nav__item--upload span { color: var(--color-primary); font-weight: 600; }

/* ── Mobile Upload CTA ── */
.mobile-upload-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px;
  margin-bottom: 16px;
  background: var(--color-primary-light);
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-lg);
  color: var(--color-primary);
  text-decoration: none;
  text-align: center;
  transition: all var(--transition);
}
.mobile-upload-cta:hover { background: #d4e4fb; }
.mobile-upload-cta span { font-size: 16px; font-weight: 600; }
.mobile-upload-cta small { font-size: 12px; color: var(--color-text-muted); }

/* -- Topbar dropdown icons -- */
.topbar__dropdown-icon { width: 16px; color: var(--color-primary); }
.topbar__dropdown-icon--danger { width: 16px; }
.topbar__chevron { font-size: .7rem; color: #94a3b8; }

/* -- ProfileModal -- */
.profile-modal__form { display: flex; flex-direction: column; gap: 14px; }
.profile-modal__header { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.profile-modal__avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: #6366f1; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700;
}
.profile-modal__name { font-weight: 600; }
.profile-modal__role {
  font-size: .75rem; background: #e0e7ff; color: #4338ca;
  border-radius: var(--radius-sm); padding: 2px 8px;
}
.profile-modal__label {
  font-size: .82rem; color: var(--color-text-muted);
  display: block; margin-bottom: 4px;
}
.profile-modal__msg--success { color: #16a34a; font-size: .85rem; }
.profile-modal__msg--error { color: #dc2626; font-size: .85rem; }
.profile-modal__submit { align-self: flex-end; }

/* -- DatePicker -- */
.datepicker { position: relative; display: inline-block; }
.datepicker__trigger {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: #fff; cursor: pointer;
  font-size: 13.5px; color: var(--color-text);
  white-space: nowrap;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.datepicker__trigger--open {
  border-color: #1a6fcd;
  box-shadow: 0 0 0 3px rgba(26,111,205,0.15);
}
.datepicker__trigger--empty { color: #94a3b8; }
.datepicker__trigger-icon { color: #1a6fcd; font-size: 12px; }
.datepicker__label { min-width: 90px; }
.datepicker__label--time { min-width: 140px; }
.datepicker__clear {
  color: #94a3b8; font-size: 16px; line-height: 1;
  cursor: pointer; margin-left: 2px;
}
.datepicker__panel {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: 0 8px 28px rgba(0,0,0,0.13);
  z-index: 200; padding: 14px 12px; width: 256px;
}
.datepicker__nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 8px;
}
.datepicker__nav-btn {
  background: none; border: 1px solid var(--color-border); border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer; font-size: 16px;
  color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  line-height: 1; flex-shrink: 0;
}
.datepicker__selectors { display: flex; align-items: center; gap: 6px; }
.datepicker__month-select {
  border: none; font-weight: 700; font-size: 13.5px;
  color: var(--color-text); cursor: pointer;
  background: transparent; font-family: inherit;
}
.datepicker__year-input {
  width: 62px; border: none; font-weight: 700; font-size: 13.5px;
  color: var(--color-text); text-align: center;
  background: transparent; font-family: inherit; outline: none;
}
.datepicker__day-headers {
  display: grid; grid-template-columns: repeat(7,1fr);
  gap: 1px; margin-bottom: 4px;
}
.datepicker__day-header {
  text-align: center; font-size: 10.5px; font-weight: 600;
  color: #94a3b8; padding: 2px 0;
}
.datepicker__grid {
  display: grid; grid-template-columns: repeat(7,1fr); gap: 1px;
}
.datepicker__day {
  width: 100%; aspect-ratio: 1; border: none;
  border-radius: 7px; font-size: 12.5px; cursor: pointer;
  font-weight: 400; background: transparent; color: #1e293b;
  outline: none; transition: background .1s, color .1s;
  font-family: inherit;
}
.datepicker__day:disabled { cursor: not-allowed; color: #d1d5db; }
.datepicker__day--selected {
  background: #1a6fcd; color: #fff; font-weight: 700;
}
.datepicker__day--today {
  background: #e8f0fe; color: #0f4d9a; font-weight: 700;
  outline: 1.5px solid #1a6fcd;
}
.datepicker__day:not(.datepicker__day--selected):not(:disabled):hover {
  background: #e8f0fe;
}
.datepicker__time-section {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #f1f5f9;
}
.datepicker__time-label {
  font-size: 10.5px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.datepicker__time-label-icon { margin-right: 4px; }
.datepicker__time-row { display: flex; align-items: center; gap: 6px; }
.datepicker__time-input {
  width: 48px; padding: 5px 6px; border: 1.5px solid var(--color-border);
  border-radius: 6px; font-size: 14px; font-weight: 700;
  text-align: center; font-family: monospace;
  outline: none; color: var(--color-text); background: #fff;
}
.datepicker__time-colon { font-size: 18px; font-weight: 800; color: #334155; }
.datepicker__time-suffix { font-size: 12px; color: var(--color-text-muted); }
.datepicker__footer {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #f1f5f9;
  display: flex; justify-content: space-between; align-items: center;
}
.datepicker__today-btn {
  background: none; border: none; font-size: 12px; color: #1a6fcd;
  cursor: pointer; font-weight: 600; font-family: inherit;
}
.datepicker__ok-btn {
  font-size: 12px; color: #fff; background: #1a6fcd;
  border: none; border-radius: 6px; padding: 4px 12px;
  cursor: pointer; font-weight: 600; font-family: inherit;
}

/* -- VendorAutocomplete -- */
.vendor-ac { position: relative; flex: 1; min-width: 160px; max-width: 220px; }
.vendor-ac__input-wrap { position: relative; }
.vendor-ac__search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: 12px; pointer-events: none;
}
.vendor-ac__input { padding-left: 30px; }
.vendor-ac__input--has-value { padding-right: 28px; }
.vendor-ac__clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: 14px; line-height: 1; padding: 0;
}
.vendor-ac__list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--color-border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1); z-index: 200;
  margin: 0; padding: 4px 0; list-style: none;
  max-height: 240px; overflow-y: auto;
}
.vendor-ac__item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  background: transparent; color: #1e293b;
}
.vendor-ac__item--active {
  background: var(--color-primary-light); color: var(--color-primary);
}
.vendor-ac__item-icon {
  font-size: 11px; color: #94a3b8; flex-shrink: 0;
}
.vendor-ac__item--active .vendor-ac__item-icon { color: var(--color-primary); }
.vendor-ac__item-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vendor-ac__highlight { color: var(--color-primary); }

/* -- LangSwitcher -- */
.lang-switcher { position: relative; display: inline-block; }
.lang-switcher__btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--radius-md);
  border: 1.5px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: #fff; font-size: 13px; cursor: pointer;
  font-family: inherit; backdrop-filter: blur(8px);
}
.lang-switcher__code { font-weight: 600; }
.lang-switcher__chevron { font-size: 9px; opacity: 0.7; }
.lang-switcher__dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.13);
  z-index: 300; overflow: hidden; min-width: 140px;
}
.lang-switcher__option {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 14px; border: none;
  background: transparent; color: #1e293b; font-weight: 400;
  font-size: 13px; cursor: pointer; font-family: inherit;
  text-align: left;
}
.lang-switcher__option--active {
  background: var(--color-primary-light); color: var(--color-primary);
  font-weight: 700;
}
.lang-switcher__option:not(.lang-switcher__option--active):hover {
  background: #f8fafc;
}
.lang-switcher__flag { font-size: 16px; }

/* -- Spinner -- */
.spinner { color: var(--color-primary); }
.spinner--sm { font-size: 1rem; }
.spinner--md { font-size: 1.5rem; }
.spinner--lg { font-size: 2.5rem; }
.page-spinner {
  display: flex; align-items: center; justify-content: center; height: 60vh;
}

/* -- Pagination -- */
.pagination-bar {
  display: flex; justify-content: center; gap: 8px; margin-top: 20px;
}
.pagination-bar__btn { padding: 6px 12px; font-size: .8rem; }

/* -- Toast container -- */
.toast-container {
  position: fixed; top: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast-container__item { pointer-events: auto; }

/* -- RoleRoute -- */
.role-denied { padding: 32px; text-align: center; }
.role-denied__text { color: var(--color-text-muted); }

/* ── Drawer Overlay (mobile) ── */
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar--open ~ .drawer-backdrop { display: block; }

/* ═══════════════════════════
   Responsive: md (≥ 640px)
   ═══════════════════════════ */
@media (min-width: 640px) {
  .mobile-menu-btn { display: none; }
  .drawer-backdrop { display: none !important; }
  .mobile-upload-cta { display: none; }

  .sidebar {
    position: fixed;
    left: 0;
    width: var(--sidebar-w-sm);
    box-shadow: none;
    overflow: hidden;
    transition: width var(--transition);
  }
  .sidebar--open { left: 0; }
  .sidebar:hover { width: var(--sidebar-w); }
  .sidebar__logo-text,
  .sidebar__label,
  .sidebar__user-email { opacity: 0; transition: opacity var(--transition); white-space: nowrap; }
  .sidebar:hover .sidebar__logo-text,
  .sidebar:hover .sidebar__label,
  .sidebar:hover .sidebar__user-email { opacity: 1; }

  .topbar__hamburger { display: none; }
  .main-content { margin-left: var(--sidebar-w-sm); }
  .main-content__inner { padding: 24px; }

  .page-header { padding-top: 0; }

  .stat-grid { grid-template-columns: repeat(4, 1fr); }

  .filter-row { grid-template-columns: repeat(3, 1fr); }

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

/* ═══════════════════════════
   Responsive: lg (≥ 1024px)
   ═══════════════════════════ */
@media (min-width: 1024px) {
  .sidebar {
    width: var(--sidebar-w);
  }
  .sidebar__logo-text,
  .sidebar__label,
  .sidebar__user-email { opacity: 1; }

  .main-content { margin-left: var(--sidebar-w); }
  .main-content__inner { padding: 32px; }

  .filter-row { grid-template-columns: repeat(5, 1fr); }
}
