/* filepath: public/css/main.css */
/* ═══════════════════════════════════════
   CMMS - 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: #00b14f;
  --color-primary-dark: #008c3e;
  --color-primary-light: #ecfdf5;
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1a202c;
  --color-text-muted: #718096;
  --color-bg-muted: #f1f5f9;
  --color-success: #38a169;
  --color-warning: #d69e2e;
  --color-danger: #e53e3e;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --sidebar-w: 220px;
  --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;
}
input, select, textarea, button { font-family: inherit; }
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__avatar--img { object-fit: cover; border: 2px solid var(--color-border); background: none; }
.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__link.active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }
.sidebar__icon { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar__divider { height: 1px; background: var(--color-border); margin: 8px 0; }

.sidebar__section { padding: 4px 0; }
.sidebar__section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-text-muted); padding: 10px 14px 4px;
}
.sidebar__section .sidebar__link { padding: 7px 14px; font-size: 13px; }

/* ── Accordion group ── */
.sidebar__group { margin-bottom: 2px; }
.sidebar__group-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: transparent; border: none; cursor: pointer;
  color: var(--color-text); font-size: 14px; font-family: inherit; text-align: left;
  transition: background var(--transition);
}
.sidebar__group-btn:hover { background: var(--color-primary-light); color: var(--color-primary); }
.sidebar__group-btn--active { color: var(--color-primary); font-weight: 600; }
.sidebar__chevron { margin-left: auto; font-size: 10px; color: var(--color-text-muted); }
.sidebar__submenu { display: flex; flex-direction: column; padding: 2px 0 4px 8px; }
.sidebar__sublink {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 28px; border-radius: var(--radius-md);
  color: var(--color-text); font-size: 13px;
  transition: background var(--transition);
}
.sidebar__sublink:hover { background: var(--color-primary-light); color: var(--color-primary); }
.sidebar__sublink.active {
  background: var(--color-primary-light); color: var(--color-primary); font-weight: 600;
}
.sidebar__subicon { width: 16px; text-align: center; flex-shrink: 0; color: var(--color-text-muted); }
.sidebar__sublink.active .sidebar__subicon { color: var(--color-primary); }

.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; position: relative; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--color-text); }
.form-label .required { color: var(--color-danger); font-weight: 700; }
.form-error {
  display: block; font-size: 11.5px; color: var(--color-danger);
  margin-top: 3px; line-height: 1.3;
}
.form-group--error .form-input,
.form-group--error select.form-input,
.form-group--error textarea.form-input {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 2px rgba(229,62,62,0.12);
}
.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 color-mix(in srgb, var(--color-primary) 15%, transparent); }
.form-input[readonly] {
  background: #f1f5f9; color: #94a3b8; cursor: not-allowed;
  border-color: #e2e8f0; user-select: none;
}
.form-input[readonly]:focus { border-color: #e2e8f0; box-shadow: none; }
.form-input--sm { padding: 9px 12px; font-size: 13px; 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;
  border: 1px solid #e7edf5;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}
.data-table {
  width: 100%;
  min-width: 100%;
  font-size: 13px;
  border-collapse: separate;
  border-spacing: 0;
}
.data-table thead {
  background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
}
.data-table th, .data-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  white-space: nowrap;
}
.data-table th {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #7c8ba1;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding:10px 12px;
}
.data-table thead th:first-child {
  border-top-left-radius: 18px;
}
.data-table thead th:last-child {
  border-top-right-radius: 18px;
}
.data-table tbody tr:nth-child(even) {
  background: #fcfdff;
}
.data-table tbody tr:hover {
  background: #f4f8ff;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table td {
  color: #1f2937;
  font-size: 14px;
}

.datatable__table th {
  vertical-align: middle;
}
.datatable__th--sortable {
  padding: 0;
}
.datatable__th--sorted {
  background: linear-gradient(180deg, #eef4ff 0%, #e6eefc 100%);
}
.datatable__th--sortable.text-right .datatable__sort-btn {
  justify-content: flex-end;
}
.datatable__th--sortable.text-center .datatable__sort-btn {
  justify-content: center;
}
.datatable {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.datatable__sort-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: none;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  padding: 0px;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
  text-align: inherit;
}
.datatable__sort-label {
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.datatable__sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  min-width: 14px;
}
.datatable__sort-btn i {
  opacity: 0.45;
  transition: opacity var(--transition), transform var(--transition);
}
.datatable__sort-btn:hover {
  color: #334155;
  background: rgba(255,255,255,.6);
}
.datatable__sort-btn:hover i,
.datatable__sort-btn--asc i,
.datatable__sort-btn--desc i {
  opacity: 1;
}
.datatable__sort-btn--asc,
.datatable__sort-btn--desc {
  color: #1d4ed8;
}
.datatable__sort-btn--desc i {
  transform: translateY(-1px);
}
.datatable__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 4px;
  border-top: 1px solid #edf2f7;
  margin-top: -1px;
}
.datatable__summary {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}
.datatable__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.datatable__page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}
.datatable__page-size .form-input {
  min-width: 78px;
  border-radius: 999px;
  background: #fff;
  border-color: #d8e2ee;
}
.datatable__page-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.datatable__ellipsis {
  color: var(--color-text-muted);
  font-size: 12px;
  padding: 0 2px;
}

.crud-page__toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.crud-page__search {
  position: relative;
  min-width: 0;
}
.crud-page__search i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  font-size: 14px;
}
.crud-page__search .form-input {
  height: 48px;
  padding-left: 44px;
  padding-right: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border-color: #d8e2ee;
}
.crud-page__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.crud-page__actions .btn {
  min-width: 82px;
}
.crud-page__form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.crud-page__form-group--full {
  grid-column: 1 / -1;
}
.crud-page__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  font-size: 14px;
  color: var(--color-text);
}
.crud-page__setting-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.crud-page__setting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ── 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--default { background: #e2e8f0; color: #475569; }
.badge--info { background: #dbeafe; color: #1d4ed8; }
.badge--primary { 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 Layout (split: brand left + form right) ── */
.auth {
  display: flex;
  min-height: 100vh;
}

/* ── Left brand panel: bg image + strong primary overlay ── */
.auth__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 420px;
  min-width: 420px;
  color: #fff;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
  background: url('/img/auth-bg.jpg') center/cover no-repeat;
}
.auth__brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(0,177,79,0.88) 0%, rgba(0,80,36,0.92) 100%);
}
.auth__brand-content { position: relative; z-index: 1; text-align: center; }
.auth__brand-icon { font-size: 48px; margin-bottom: 20px; opacity: 0.9; }
.auth__brand-name { font-size: 36px; font-weight: 800; letter-spacing: 2px; margin: 0; }
.auth__brand-tagline { font-size: 14px; opacity: 0.7; margin: 10px 0 0; font-weight: 400; }
.auth__brand-copy { position: relative; z-index: 1; margin-top: auto; font-size: 12px; opacity: 0.4; }

/* ── Right form panel: bg image + frosted white overlay + glass card ── */
.auth__form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
  background: url('/img/auth-bg.jpg') center/cover no-repeat;
}
.auth__form-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(236,253,245,0.88) 100%);
  backdrop-filter: blur(2px);
}
.auth__lang { position: absolute; top: 20px; right: 24px; z-index: 2; }
.auth__form-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 8px 32px rgba(0,177,79,0.08), 0 2px 8px rgba(0,0,0,0.04);
}

.auth__header { margin-bottom: 28px; }
.auth__header-icon { font-size: 28px; color: var(--color-primary); margin-bottom: 12px; display: block; }
.auth__title { font-size: 24px; font-weight: 700; color: var(--color-text); margin: 0; }
.auth__subtitle { font-size: 14px; color: var(--color-text-muted); margin: 6px 0 0; }

/* Input with icon */
.auth__input-icon-wrap {
  position: relative;
}
.auth__input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--color-text-muted);
  pointer-events: none;
}
.auth__input-with-icon {
  padding-left: 40px !important;
}
.auth__pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 8px 10px;
  font-size: 14px;
}
.auth__pw-toggle:hover { color: var(--color-text); }

.auth__submit { margin-top: 20px; height: 44px; font-size: 15px; font-weight: 600; }

/* Links row */
.auth__links {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 13px;
}
.auth__links--center { justify-content: center; }
.auth__links a {
  color: var(--color-primary);
  text-decoration: none;
}
.auth__links a:hover { text-decoration: underline; }

/* Divider */
.auth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
}
.auth__divider::before,
.auth__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Quick login */
.auth__quick { display: flex; gap: 8px; }
.auth__quick-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid color-mix(in srgb, var(--q-color, #666) 25%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--q-color, #666) 6%, transparent);
  color: var(--q-color, #666);
  cursor: pointer;
  transition: all var(--transition);
}
.auth__quick-btn:hover {
  background: color-mix(in srgb, var(--q-color, #666) 14%, transparent);
  transform: translateY(-1px);
}

/* Checkbox */
.auth__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
}
.auth__checkbox input[type="checkbox"] { margin-top: 2px; }
.auth__checkbox a { color: var(--color-primary); }

/* OTP input */
.auth__otp-input {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 10px;
  font-family: monospace;
}

/* ── Responsive: stack on mobile ── */
@media (max-width: 860px) {
  .auth { flex-direction: column; }
  .auth__brand {
    width: 100%;
    min-width: unset;
    padding: 32px 24px;
    min-height: unset;
  }
  .auth__brand-icon { font-size: 32px; margin-bottom: 12px; }
  .auth__brand-name { font-size: 28px; }
  .auth__brand-tagline { font-size: 13px; }
  .auth__brand-copy { display: none; }
  .auth__form-panel { padding: 24px 16px; }
  .auth__form-wrap { padding: 24px 20px; border-radius: 12px; }
}

/* ── 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 color-mix(in srgb, var(--color-primary) 40%, transparent);
  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; }

/* -- Site Switcher (topbar) -- */
.topbar__site-switcher {
  display: flex; align-items: center; gap: 0;
  padding: 6px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: transparent;
  cursor: pointer; font-family: inherit; font-size: 13px;
  color: var(--color-text); transition: all .15s;
  max-width: 360px; overflow: hidden;
}
.topbar__site-switcher:hover { background: var(--color-bg-secondary); border-color: var(--color-primary-light); }
.topbar__tenant-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.topbar__site-divider { margin: 0 6px; color: var(--color-text-muted); font-weight: 300; }
.topbar__site-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; color: var(--color-text-muted); }
@media (max-width: 640px) {
  .topbar__tenant-name { display: none; }
  .topbar__site-divider { display: none; }
  .topbar__site-name { max-width: 120px; }
}

/* -- Site Switcher Modal -- */
.site-modal__list { max-height: min(400px, 60vh); overflow-y: auto; }
.site-modal__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 20px; border: none; border-bottom: 1px solid var(--color-border);
  cursor: pointer; text-align: left; font-family: inherit; font-size: 14px;
  background: transparent; transition: background .1s;
}
.site-modal__item:hover { background: var(--color-bg-secondary); }
.site-modal__item--active { background: rgba(37,99,235,0.06); font-weight: 700; }
.site-modal__item-icon { width: 20px; text-align: center; color: var(--color-text-muted); }
.site-modal__item--active .site-modal__item-icon { color: var(--color-primary); }

/* -- 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: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.datepicker__trigger--empty { color: #94a3b8; }
.datepicker__trigger-icon { color: var(--color-primary); 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: var(--color-primary); color: #fff; font-weight: 700;
}
.datepicker__day--today {
  background: var(--color-primary-light); color: var(--color-primary); font-weight: 700;
  outline: 1.5px solid var(--color-primary);
}
.datepicker__day:not(.datepicker__day--selected):not(:disabled):hover {
  background: var(--color-primary-light);
}
.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: var(--color-primary);
  cursor: pointer; font-weight: 600; font-family: inherit;
}
.datepicker__ok-btn {
  font-size: 12px; color: #fff; background: var(--color-primary);
  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,
.toast-host {
  position: fixed; top: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast-container__item,
.toast-host > .toast { 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; }

@media (max-width: 767px) {
  .crud-page__form-grid,
  .crud-page__setting-grid,
  .billing__grid {
    grid-template-columns: 1fr;
  }
  .datatable__footer,
  .crud-page__setting-head {
    align-items: flex-start;
  }
}

/* ═══════════════════════════
   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); }
}

/* ════════════════════════════════════════
   Auth v2 — Centered card, green theme
   ════════════════════════════════════════ */
.auth-v2 {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 64px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 50%, #ecfeff 100%);
}
.auth-v2__bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.auth-v2__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
}
.auth-v2__blob--1 {
  width: 480px; height: 480px;
  background: color-mix(in srgb, var(--color-primary) 35%, #fff);
  top: -160px; right: -120px; opacity: 0.55;
}
.auth-v2__blob--2 {
  width: 420px; height: 420px;
  background: color-mix(in srgb, var(--color-primary) 25%, #fff);
  bottom: -180px; left: -140px; opacity: 0.65;
}
.auth-v2__blob--3 {
  width: 260px; height: 260px;
  background: #b6ffd8;
  top: 40%; left: 35%; opacity: 0.25;
}
.auth-v2__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,177,79,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,177,79,0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 80% at 50% 40%, #000 0%, #000 50%, transparent 100%);
}
.auth-v2__lang {
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 5;
}
.auth-v2__copy {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--color-text-muted);
  letter-spacing: 0.3px;
  z-index: 1;
}
.auth-v2__card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow:
    0 24px 64px rgba(0, 100, 45, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.04);
}
.auth-v2__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 22px;
}
.auth-v2__logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 6px 16px rgba(0, 177, 79, 0.25);
}
.auth-v2__brand-text { display: flex; flex-direction: column; gap: 2px; }
.auth-v2__app-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--color-text);
  line-height: 1.1;
}
.auth-v2__tagline {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.3;
}
.auth-v2__header { margin-bottom: 20px; }
.auth-v2__header-icon {
  font-size: 18px;
  color: var(--color-primary);
  margin-bottom: 6px;
  display: block;
}
.auth-v2__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.3px;
}
.auth-v2__subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 4px 0 0;
}

.auth-v2__input-wrap {
  position: relative;
}
.auth-v2__input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 14px;
  pointer-events: none;
}
.auth-v2__input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-v2__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(0, 177, 79, 0.12);
}
.auth-v2__pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 14px;
}
.auth-v2__pw-toggle:hover { color: var(--color-primary); }

.auth-v2__row {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 16px;
}
.auth-v2__link {
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.auth-v2__link:hover { text-decoration: underline; }
.auth-v2__link--strong { font-weight: 700; }

.auth-v2__submit {
  height: 46px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
}

.auth-v2__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
}
.auth-v2__divider::before,
.auth-v2__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
}
.auth-v2__divider span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.auth-v2__oauth {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.oauth-btn:hover {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 4%, #fff);
}
.oauth-btn:active { transform: scale(0.99); }
.oauth-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-v2__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 16px;
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.5;
  cursor: pointer;
}
.auth-v2__checkbox input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.auth-v2__footer {
  text-align: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 480px) {
  .auth-v2 { padding: 16px 12px 56px; }
  .auth-v2__card { padding: 28px 22px 22px; border-radius: 16px; }
  .auth-v2__brand { gap: 10px; padding-bottom: 16px; margin-bottom: 18px; }
  .auth-v2__logo { width: 40px; height: 40px; }
  .auth-v2__app-name { font-size: 18px; }
  .auth-v2__title { font-size: 20px; }
  .auth-v2__lang { top: 14px; right: 14px; }
}

