*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #0d0f12;
  --paper: #f3f7f3;
  --paper-strong: #ffffff;
  --accent: #1a6b4a;
  --accent-light: #e6f2ed;
  --accent-mid: #2d9e72;
  --gold: #c9a84c;
  --muted: #6b7280;
  --border: #ddd9d0;
  --sidebar-w: 300px;
  --sidebar-bg: #0d1a14;
  --hero-shadow: 0 28px 72px rgba(22, 70, 48, 0.12);
  --card-shadow: 0 16px 40px rgba(24, 61, 43, 0.08);
  --surface: rgba(255,255,255,0.84);
  --surface-strong: #ffffff;
  --surface-muted: #eef4ef;
  --success: #2f7a58;
  --ink-soft: #435046;
  --border-strong: rgba(32, 77, 56, 0.14);
}

html, body { height: 100vh; overflow: hidden; }

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  display: flex;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(45,158,114,0.11), transparent 28%),
    radial-gradient(circle at top right, rgba(201,168,76,0.10), transparent 24%),
    linear-gradient(180deg, #f7fbf8 0%, #eef5f0 100%);
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 36px 28px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: -80px; right: -60px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45,158,114,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.sidebar::after {
  content: '';
  position: absolute;
  bottom: 40px; left: -80px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,0.10) 0%, transparent 70%);
  pointer-events: none;
}

.brand {
  display: block;
  margin-bottom: 44px;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 220px;
}

.brand-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.nav-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  margin-bottom: 10px;
  padding-left: 4px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255,255,255,0.55);
  font-size: 0.88rem;
  font-weight: 400;
  transition: background 0.18s, color 0.18s;
}

.nav-item a:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.nav-item.active a {
  background: rgba(45,158,114,0.2);
  color: #fff;
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  opacity: 0.8;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-footer-text {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.25);
  line-height: 1.6;
}

.sidebar-footer-text strong {
  color: rgba(255,255,255,0.45);
  font-weight: 500;
}

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 48px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(16px);
  background: rgba(243,247,243,0.88);
}

.topbar-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.topbar-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid rgba(45,158,114,0.14);
  box-shadow: 0 8px 22px rgba(33,91,61,0.08);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-mid);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.content {
  flex: 1;
  padding: 40px 48px 56px;
  width: 100%;
  max-width: 1340px;
  margin: 0 auto;
}

/* ── FORM CARD ── */
.form-card {
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  animation: fadeUp 0.5s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-card-header {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.84) 0%, rgba(240,247,242,0.92) 100%);
}

.form-card-header .icon-box {
  width: 44px; height: 44px;
  background: var(--accent-light);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.form-card-header h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.22rem;
  color: var(--ink);
}

.form-card-header p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.form-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel-note {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

/* Settings block */
.batch-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 18px;
  background: var(--paper);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.batch-settings > div {
  flex: 1 1 180px;
}

.batch-settings > button {
  flex: 0 0 auto;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  display: block;
}

.select-wrap {
  position: relative;
}

.text-input {
  width: 100%;
  background: var(--paper-strong);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}

.text-input:focus {
  border-color: var(--accent-mid);
  background: #fff;
}

select {
  width: 100%;
  appearance: none;
  background: var(--paper-strong);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 40px 11px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s;
  outline: none;
}

select:focus {
  border-color: var(--accent-mid);
  background: #fff;
}

.select-arrow {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
}

/* Buttons */
.btn-batch-secondary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 12px 16px; background: #fff; color: var(--ink);
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.85rem;
  cursor: pointer; white-space: nowrap; transition: border-color 0.2s, background 0.2s;
  height: 43px;
}
.btn-batch-secondary:hover { border-color: var(--accent-mid); background: var(--accent-light); }

.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(26,107,74,0.25);
  height: 43px;
}

.btn-submit:hover {
  background: var(--accent-mid);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(26,107,74,0.3);
}

.btn-submit:active { transform: translateY(0); }

.btn-batch-excel {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; background: #0f766e; color: #fff;
  border: none; border-radius: 10px; font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(15,118,110,0.2); transition: background 0.2s;
  height: 43px;
}
.btn-batch-excel:hover { background: #0d9488; transform: translateY(-2px); }

.btn-batch-tally {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 20px; background: #1e40af; color: #fff;
  border: none; border-radius: 12px; font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
  box-shadow: 0 4px 16px rgba(30,64,175,0.25); transition: background 0.2s;
}
.btn-batch-tally:hover { background: #2563eb; transform: translateY(-2px); }

.btn-batch-xml {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 20px; background: #7c3aed; color: #fff;
  border: none; border-radius: 12px; font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
  box-shadow: 0 4px 16px rgba(124,58,237,0.2); transition: background 0.2s;
}
.btn-batch-xml:hover { background: #9333ea; transform: translateY(-2px); }

.btn-batch-secondary:disabled,
.btn-batch-excel:disabled,
.btn-batch-tally:disabled,
.btn-batch-xml:disabled,
.btn-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none !important;
}

/* Status Box */
.batch-status-box {
  padding: 14px 16px; border-radius: 12px; background: var(--accent-light);
  font-size: 0.85rem; color: var(--ink); border: 1px solid var(--border-strong);
  line-height: 1.5;
}
.batch-status-box.error { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.batch-status-box.ok    { background: #dcfce7; color: #166534; border-color: #86efac; }

/* Summary Chips */
.upload-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 768px) {
  .upload-summary {
    grid-template-columns: 1fr;
  }
}
.summary-chip {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-muted);
  border: 1px solid rgba(45,158,114,0.15);
}
.summary-chip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--ink);
}
.summary-chip span {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* Table Shell */
.table-shell {
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: auto;
  background: #fff;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  min-width: 1360px;
}
.history-table thead tr { background: var(--accent-light); }
.history-table th {
  padding: 11px 12px;
  text-align: left;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}
.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tbody tr:hover td { background: var(--accent-light); }

.amount-cell {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Card styling */
.section-card {
  padding: 24px;
  border-radius: 24px;
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--border-strong);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.08rem;
  color: var(--ink);
}

.section-card p {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.65;
}

.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.file-input-inline {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
}

.field-helper {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.batch-action-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
}

/* Footer strip */
.info-strip {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .info-strip {
    flex-direction: column;
  }
}

.info-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.84);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  flex: 1;
  box-shadow: var(--card-shadow);
}

.info-chip svg { color: var(--accent-mid); flex-shrink: 0; }

/* Responsive main */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 24px; }
  .topbar { padding: 16px 24px; }
}

/* ── SEARCH BAR & ACTION BAR ── */
.search-bar-container {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  align-items: center;
  background: var(--paper);
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.table-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.selected-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; background: #991b1b; color: #fff;
  border: none; border-radius: 10px; font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
  box-shadow: 0 4px 16px rgba(153, 27, 27, 0.2); transition: background 0.2s;
  height: 43px;
}
.btn-danger:hover { background: #b91c1c; transform: translateY(-2px); }
.btn-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none !important;
}

/* Row Selected Highlight */
.history-table tbody tr.row-selected td {
  background: #f0f7f3 !important;
  border-bottom-color: rgba(45,158,114,0.2);
}

/* ── MODAL POPUP WINDOWS ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(13, 26, 20, 0.5);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.2s ease both;
}

.modal-content {
  background: #ffffff;
  border-radius: 18px;
  width: 92%;
  max-width: 900px;
  max-height: 88vh;
  box-shadow: 0 24px 64px rgba(13, 26, 20, 0.25);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(240,247,242,0.95) 100%);
}

.modal-header h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  transition: color 0.15s;
}
.close-btn:hover { color: #b91c1c; }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.grid-col-span-2 {
  grid-column: span 2;
}

.grid-col-span-4 {
  grid-column: span 4;
}

.modal-entries-table-container {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  margin-top: 8px;
}

.modal-entries-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.modal-entries-table th {
  background: var(--accent-light);
  padding: 10px 12px;
  text-align: left;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  border-bottom: 1.5px solid var(--border);
}

.modal-entries-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.modal-entries-table tbody tr:last-child td {
  border-bottom: none;
}

.remove-entry-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.remove-entry-btn:hover { color: #b91c1c; }

.balance-tracker {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  margin-top: 12px;
  padding: 12px 18px;
  background: var(--paper);
  border-radius: 10px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
}

.balance-value {
  font-weight: 700;
}
.balance-value.balanced { color: var(--success); }
.balance-value.unbalanced { color: #b91c1c; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fbf9;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalScaleUp {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}


/* ── EXCEL BATCH IMPORT DASHBOARD & METRICS ── */
.import-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, 320px);
  gap: 12px;
  margin-bottom: 16px;
  max-width: 1316px; /* Exactly fits 4 cards (320px * 4 + 12px * 3) */
}

.import-card {
  background: var(--paper-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 4px solid var(--muted);
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 75px;
  width: 320px;
  box-sizing: border-box;
  min-width: 0; /* Enable ellipsis text truncation inside grid layout */
}

.import-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}

.import-card.accent {
  border-left-color: var(--accent);
}

.import-card.success {
  border-left-color: var(--success);
}

.import-card.warning {
  border-left-color: var(--gold);
}

.import-card.danger {
  border-left-color: #b91c1c;
}

.import-card span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.import-card strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.import-card .card-footer {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-entries-table tbody tr:hover {
  background-color: rgba(45, 158, 114, 0.02);
}

.status-pill.disconnected {
  background: #f1f3f5 !important;
  color: #868e96 !important;
  border-color: #dee2e6 !important;
  box-shadow: none !important;
}

.status-pill.disconnected .status-dot {
  background: #868e96 !important;
  animation: none !important;
}

/* Data Table - prevent cell text wrapping and support horizontal scrolling */
.data-table th,
.data-table td {
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--accent-light) !important;
  color: var(--accent) !important;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border) !important;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.data-table tbody tr:hover td {
  background: var(--accent-light);
}

.data-table tbody tr.row-selected td {
  background: #f0f7f3 !important;
  border-bottom-color: rgba(45,158,114,0.2);
}

/* ── SPLIT-SCREEN AUTHENTICATION GATE DESIGN ── */
body.auth-shell-locked #authGateOverlay {
  display: flex !important;
}

body.auth-shell-locked .sidebar,
body.auth-shell-locked .main {
  display: none !important;
}

.auth-gate-container {
  display: flex;
  background-color: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 880px;
  min-height: 580px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  animation: scaleUpAuth 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUpAuth {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.auth-gate-left {
  flex: 1;
  background: linear-gradient(135deg, #F0FDF4 0%, #ECFDF5 50%, #F0FDFA 100%);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
}

.auth-left-logo-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-logo-img {
  height: 44px;
  width: auto;
}

.auth-logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.auth-left-welcome h2 {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.2;
  text-align: left;
}

.auth-left-welcome p {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.6;
  text-align: left;
}

.auth-left-illustration {
  margin: 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.finance-svg {
  width: 100%;
  max-width: 280px;
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(26, 107, 74, 0.06));
}

.auth-left-marketing h3 {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.auth-left-marketing p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.4;
}

.auth-carousel-dots {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.auth-carousel-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #CBD5E1;
  transition: all 0.2s ease;
}

.auth-carousel-dots .dot.active {
  width: 18px;
  border-radius: 3px;
  background-color: var(--accent);
}

.auth-gate-right {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  background-color: #FFFFFF;
}

.auth-right-header {
  display: none;
  text-align: center;
  margin-bottom: 24px;
}

.auth-right-header .auth-gate-logo {
  height: 64px;
  width: auto;
  margin: 0 auto 12px;
}

.auth-right-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.auth-right-header p {
  font-size: 13.5px;
  color: var(--muted);
}

.auth-gate-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 24px;
}

.auth-gate-tabs .result-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  height: auto;
}

.auth-gate-tabs .result-tab:hover {
  color: var(--ink);
}

.auth-gate-tabs .result-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: none;
}

.auth-form-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-input-group label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-align: left;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  pointer-events: none;
}

.auth-input-icon svg {
  width: 18px;
  height: 18px;
}

.auth-input-wrapper input {
  width: 100%;
  height: 48px !important;
  padding: 10px 14px 10px 42px !important;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: #FFFFFF;
  color: var(--ink);
  outline: none;
  transition: all 0.15s ease;
}

.auth-input-wrapper input::placeholder {
  color: #94A3B8;
}

.auth-input-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 107, 74, 0.12);
}

.auth-password-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: color 0.15s ease;
}

.auth-password-toggle svg {
  width: 18px;
  height: 18px;
}

.auth-password-toggle:hover,
.auth-password-toggle.visible {
  color: var(--accent);
}

.auth-mobile-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.auth-country-select {
  height: 48px;
  min-width: 95px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: #FFFFFF;
  color: var(--ink);
  padding: 0 10px;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.auth-country-select:focus {
  border-color: var(--accent);
}

.auth-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  margin-top: 2px;
}

.auth-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin: 0;
  flex-direction: row;
}

.auth-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--accent);
}

.auth-checkbox-label span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
}

.auth-checkbox-label span a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-checkbox-label span a:hover {
  text-decoration: underline;
}

.auth-forgot-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-forgot-link:hover {
  color: var(--accent-mid);
  text-decoration: underline;
}

.auth-submit-btn {
  height: 52px !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  background-color: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  color: #FFFFFF !important;
  width: 100% !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 4px 12px rgba(26, 107, 74, 0.15);
  cursor: pointer;
}

.auth-submit-btn:hover {
  background-color: var(--accent-mid) !important;
  border-color: var(--accent-mid) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(26, 107, 74, 0.2);
}

.auth-submit-btn:active {
  transform: translateY(0);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #94A3B8;
  margin: 10px 0;
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.auth-divider span {
  padding: 0 10px;
}

.auth-footer-text {
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 4px;
}

.auth-footer-text a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-footer-text a:hover {
  color: var(--accent-mid);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .auth-gate-container {
    max-width: 440px;
    min-height: auto;
  }
  
  .auth-gate-left {
    display: none;
  }
  
  .auth-gate-right {
    padding: 32px 24px;
  }
  
  .auth-right-header {
    display: block;
  }
}

/* data-table styling for master page to prevent header overlapping and add proper padding */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.data-table th {
  padding: 12px 14px;
  text-align: left;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tbody tr:hover td {
  background: var(--accent-light);
}

.select-wrap .text-input {
  padding-right: 40px;
}

/* Column Header Filter Popover */
.col-filter-popover {
  position: absolute;
  z-index: 1200;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  width: 240px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  padding: 12px;
  font-family: 'DM Sans', sans-serif;
  box-sizing: border-box;
}

.col-filter-popover-search {
  width: 100%;
  padding: 8px 12px;
  font-size: 12.5px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 8px;
  margin-bottom: 10px;
  box-sizing: border-box;
  background: var(--bg-input, #f8fafc);
  color: var(--ink, #0f172a);
  outline: none;
}

.col-filter-popover-search:focus {
  border-color: var(--accent);
}

.col-filter-popover-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 12px;
  max-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.col-filter-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink, #0f172a);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.col-filter-popover-item:hover {
  background: var(--accent-light, #f1f5f9);
}

.col-filter-popover-item input[type="checkbox"] {
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.col-filter-popover-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.col-filter-popover-btn {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  border: none;
  font-family: inherit;
}

.col-filter-popover-btn-apply {
  background: var(--accent, #16a34a);
  color: #ffffff;
}

.col-filter-popover-btn-apply:hover {
  background: var(--accent-mid, #15803d);
}

.col-filter-popover-btn-clear {
  background: transparent;
  border: 1.5px solid var(--border, #e2e8f0);
  color: var(--muted, #64748b);
}

.col-filter-popover-btn-clear:hover {
  background: var(--accent-light, #f1f5f9);
}

.col-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.15s ease;
}

.col-filter-btn:hover {
  color: var(--accent) !important;
  transform: scale(1.1);
}

.col-filter-btn.active {
  color: var(--accent) !important;
}

/* ==========================================================================
   USER ACCESS & SECURITY CONTROL (TABLE & RULE ASSIGNMENT STYLES)
   ========================================================================== */

.nav-item-hidden {
  display: none !important;
}

.badge-role-admin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  text-transform: capitalize;
}

.badge-role-user {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  text-transform: capitalize;
}

.perm-menu-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.perm-menu-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  border: 1.5px solid transparent;
  background: transparent;
  font-family: inherit;
}

.perm-menu-pill.active {
  background: rgba(45, 158, 114, 0.12);
  color: #0d6e46;
  border-color: #2d9e72;
  font-weight: 600;
}

.perm-menu-pill.inactive {
  background: var(--paper-strong, #f8f9fa);
  color: #64748b;
  border-color: var(--border, #e2e8f0);
}

.perm-menu-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.user-rule-tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 28px;
}

.user-rule-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.22);
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.user-rule-tag-remove {
  cursor: pointer;
  color: #ef4444;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transition: background 0.15s;
}

.user-rule-tag-remove:hover {
  background: rgba(239, 68, 68, 0.15);
}

.btn-assign-rules {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  color: var(--accent, #16a34a);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-assign-rules:hover {
  background: rgba(45, 158, 114, 0.08);
  border-color: var(--accent, #16a34a);
}

.rule-assign-popover {
  position: absolute;
  z-index: 1050;
  background: #ffffff;
  border: 1.5px solid var(--border, #e2e8f0);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  width: 320px;
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 10px;
  font-family: 'DM Sans', sans-serif;
  box-sizing: border-box;
}

.rule-assign-search {
  height: 32px;
  font-size: 12px;
  padding: 0 10px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  background: #f8fafc;
}

.rule-assign-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.rule-assign-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink, #1e293b);
  cursor: pointer;
  transition: background 0.12s;
}

.rule-assign-item:hover {
  background: #f1f5f9;
}

.rule-assign-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent, #16a34a);
  cursor: pointer;
}

.btn-save-row {
  height: 32px;
  padding: 0 16px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  background: var(--accent, #16a34a);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-save-row:hover {
  background: var(--accent-mid, #15803d);
}

.btn-save-row.saved {
  background: #16a34a !important;
  color: #ffffff !important;
}

