/* ============================================================
   APEX ERP Finance Portal — Design System
   Inspired by FloQast enterprise SaaS language
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── 1. Design Tokens ──────────────────────────────────────── */
:root {
  /* Brand */
  --color-primary: #1FAC76;
  --color-primary-hover: #1C895F;
  --color-primary-active: #186749;
  --color-primary-disabled: rgba(28,137,95,0.3);

  /* Semantic */
  --color-success: #1FAC76;
  --color-success-bg: #ECFFF8;
  --color-info: #3D7BF7;
  --color-info-bg: #F0F5FF;
  --color-warning: #DB7712;
  --color-warning-bg: #FFF8EB;
  --color-danger: #D24747;
  --color-danger-bg: #FEF1F2;

  /* Neutral */
  --color-bg-page: #F8FAFC;
  --color-bg-subtle: #F1F3F9;
  --color-border: #E1E6EF;
  --color-border-input: #CBD2E1;
  --color-text-heading: #1B1F27;
  --color-text-body: #1D2433;
  --color-text-muted: #6B7280;
  --color-text-placeholder: #ADB2BB;

  /* Accent */
  --color-accent-purple: #8B54F7;

  /* Shape */
  --radius-card: 6px;
  --radius-input: 4px;

  /* Elevation */
  --shadow-card: 0 2px 4px rgba(0,0,0,.07);
  --overlay-modal: rgba(29,34,51,.65);
  --overlay-loading: rgba(255,255,255,.75);

  /* Typography */
  --font-family: "Inter", "Museo Sans", -apple-system, "Segoe UI", sans-serif;
  --font-size-body: 12px;
  --line-height-body: 18px;

  /* Sidebar */
  --sidebar-width: 224px;
  --topbar-height: 52px;
}

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

html { font-size: 14px; }

body {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--color-text-body);
  background: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

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

/* ── 4. Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.brand-logo {
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
}

.brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-heading);
  letter-spacing: -0.2px;
}

.brand-sub {
  font-size: 10px;
  color: var(--color-text-muted);
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-placeholder);
  padding: 12px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-body);
  border-radius: 0;
  transition: background 0.12s, color 0.12s;
  position: relative;
}

.nav-item:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text-heading);
}

.nav-item.active {
  background: var(--color-success-bg);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: currentColor;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-card);
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--color-text-muted);
}

.logout-btn {
  color: var(--color-text-muted);
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}

.logout-btn:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* ── 5. Topbar ─────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
}

.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.breadcrumb-sep {
  color: var(--color-text-placeholder);
  margin: 0 2px;
}

.breadcrumb-item a {
  color: var(--color-text-muted);
  transition: color 0.12s;
}

.breadcrumb-item a:hover {
  color: var(--color-primary);
}

.breadcrumb-item.active {
  color: var(--color-text-heading);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 6. Main Content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 24px;
}

/* ── 7. Messages / Toasts ──────────────────────────────────── */
.messages-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.alert-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
}

.alert-toast.success {
  background: var(--color-success-bg);
  border-color: #bbf0da;
  color: var(--color-success);
}

.alert-toast.error {
  background: var(--color-danger-bg);
  border-color: #f5c2c2;
  color: var(--color-danger);
}

.alert-toast.warning {
  background: var(--color-warning-bg);
  border-color: #fde5bc;
  color: var(--color-warning);
}

.alert-toast.info {
  background: var(--color-info-bg);
  border-color: #bfcffd;
  color: var(--color-info);
}

.alert-toast .alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-toast .alert-msg {
  flex: 1;
  line-height: 1.5;
}

.alert-close {
  cursor: pointer;
  opacity: 0.5;
  font-size: 14px;
  padding: 0 2px;
  transition: opacity 0.12s;
}

.alert-close:hover { opacity: 1; }

/* ── 8. Cards ──────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.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: 13px;
  font-weight: 600;
  color: var(--color-text-heading);
}

.card-body { padding: 16px; }

.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
}

/* ── 9. Page Header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-heading);
  letter-spacing: -0.3px;
  line-height: 1.25;
}

.page-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── 10. Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-card);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, #1FAC76 0%, #17875C 100%);
  border: 1px solid #1FAC76;
  color: #fff;
  box-shadow: 0 2px 4px rgba(31, 172, 118, 0.2);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #22C386 0%, #1FAC76 100%);
  border-color: #22C386;
  color: #fff;
  box-shadow: 0 4px 8px rgba(31, 172, 118, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  background: linear-gradient(135deg, #186749 0%, #14523A 100%);
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--color-primary-disabled);
  border-color: var(--color-primary-disabled);
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  border-color: var(--color-border-input);
  color: var(--color-text-body);
}

.btn-secondary:hover {
  background: var(--color-bg-subtle);
  border-color: var(--color-border-input);
  color: var(--color-text-heading);
}

.btn-danger {
  background: #fff;
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.btn-danger:hover {
  background: var(--color-danger-bg);
}

.btn-danger-solid {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}

.btn-danger-solid:hover {
  background: #b83a3a;
}

.btn-text {
  background: transparent;
  border-color: transparent;
  color: var(--color-primary);
  padding: 0 4px;
  height: auto;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

/* ── 11. Form Controls ─────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-body);
  margin-bottom: 5px;
}

.required,
.form-label .required {
  color: var(--color-danger, #EF4444) !important;
  font-weight: bold !important;
  margin-left: 2px;
}


.form-control,
.form-select {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--color-text-body);
  background: #fff;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-input);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

textarea.form-control {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.5;
}

.form-control::placeholder {
  color: var(--color-text-placeholder);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(31,172,118,.12);
}

.form-control.auto-field {
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  cursor: default;
}

.form-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.form-error {
  font-size: 11px;
  color: var(--color-danger);
  margin-top: 4px;
}

.form-group { margin-bottom: 16px; }

.form-row {
  display: grid;
  gap: 16px;
}
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* Checkbox */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.form-check-input {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.form-check-label {
  font-size: 12px;
  color: var(--color-text-body);
  cursor: pointer;
  line-height: 1.5;
}

/* ── 12. Tables ────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-body);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover { background: var(--color-bg-subtle); }

.data-table tbody tr.clickable { cursor: pointer; }

.td-primary {
  font-weight: 600;
  color: var(--color-text-heading);
}

.td-mono {
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: 12px;
}

.td-muted { color: var(--color-text-muted); }

.td-link {
  color: var(--color-primary);
  font-weight: 500;
}
.td-link:hover { text-decoration: underline; }

/* ── 13. Status Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

/* Semantic badge variants */
.badge-success, .badge-approved {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-info, .badge-pending, .badge-pending_l1,
.badge-pending_l2, .badge-pending_l3 {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-warning, .badge-on_hold, .badge-on-hold {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-danger, .badge-rejected {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-draft {
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
}

.badge-paid {
  background: var(--color-success-bg);
  color: var(--color-primary-active);
}

.badge-posted {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

/* ── 14. KPI Stats ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-heading);
  letter-spacing: -0.5px;
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

/* ── 15. Filter / Tab Bar ──────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.filter-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  border-radius: 99px;
  transition: all 0.12s;
  cursor: pointer;
}

.filter-tab:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text-heading);
}

.filter-tab.active {
  background: var(--color-success-bg);
  color: var(--color-primary);
  border-color: #bbf0da;
  font-weight: 600;
}

/* ── 16. Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-heading);
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

/* ── 17. Wizard ────────────────────────────────────────────── */
.wizard-container {
  max-width: 820px;
}

.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.wizard-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-right: 1px solid var(--color-border);
  transition: background 0.12s;
  position: relative;
}

.wizard-step:last-child { border-right: none; }

.wizard-step:hover { background: var(--color-bg-subtle); }

.wizard-step.active {
  background: var(--color-success-bg);
}

.wizard-step.completed {
  background: #fff;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: all 0.15s;
}

.wizard-step.active .step-num {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.wizard-step.completed .step-num {
  background: var(--color-success-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.step-info { min-width: 0; }

.step-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-heading);
  display: block;
}

.wizard-step:not(.active) .step-title { color: var(--color-text-muted); }
.wizard-step.active .step-title { color: var(--color-primary-active); }

.step-sub {
  font-size: 10px;
  color: var(--color-text-placeholder);
  display: block;
  margin-top: 1px;
}

.wizard-pane { display: none; }
.wizard-pane.active { display: block; }

.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 0;
  margin-top: 8px;
  border-top: 1px solid var(--color-border);
}

.wizard-progress {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Form Section */
.form-section {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 24px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-heading);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  width: 32px;
  height: 32px;
  background: var(--color-success-bg);
  border: 1px solid #bbf0da;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-icon svg {
  width: 16px !important;
  height: 16px !important;
  stroke: var(--color-primary);
  stroke-width: 2px;
}

/* Amount display */
.amount-summary {
  background: var(--color-success-bg);
  border: 1px solid #bbf0da;
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin-top: 12px;
}

.amount-summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.amount-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary-active);
  font-family: 'SFMono-Regular', 'Consolas', monospace;
}

.amount-words {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--color-border-input);
  border-radius: var(--radius-card);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--color-bg-subtle);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--color-primary);
  background: var(--color-success-bg);
}

.upload-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-heading);
  margin-bottom: 4px;
}

.upload-sub {
  font-size: 11px;
  color: var(--color-text-muted);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-text-body);
}

.file-remove {
  margin-left: auto;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
}

.file-remove:hover { opacity: 1; }

/* ── 18. Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-modal);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.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: 14px;
  font-weight: 700;
  color: var(--color-text-heading);
}

.modal-close {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}

.modal-close:hover {
  background: var(--color-bg-subtle);
}

.modal-body { padding: 20px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
}

/* ── 19. Detail Page ───────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.detail-field {
  margin-bottom: 14px;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.detail-value {
  font-size: 13px;
  color: var(--color-text-body);
  font-weight: 500;
}

.detail-value.mono {
  font-family: 'SFMono-Regular', 'Consolas', monospace;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 0;
  width: 1px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 16px;
}

.timeline-dot {
  position: absolute;
  left: -17px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--color-primary);
}

.timeline-dot.rejected { background: var(--color-danger); box-shadow: 0 0 0 1px var(--color-danger); }
.timeline-dot.pending  { background: var(--color-warning);   box-shadow: 0 0 0 1px var(--color-warning); }

.timeline-time {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.timeline-actor {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-heading);
}

.timeline-note {
  font-size: 12px;
  color: var(--color-text-body);
  margin-top: 2px;
  padding: 6px 10px;
  background: var(--color-bg-subtle);
  border-radius: 4px;
  border-left: 2px solid var(--color-border);
  margin-top: 6px;
}

/* ── 20. Approval Board ────────────────────────────────────── */
.approval-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}

.board-column {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.board-column-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}

.board-column-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-heading);
}

.board-count {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}

.board-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 12px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s;
}

.board-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.board-card-id {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  font-family: monospace;
  margin-bottom: 4px;
}

.board-card-vendor {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: 4px;
}

.board-card-amount {
  font-size: 11px;
  color: var(--color-text-muted);
  font-family: monospace;
}

.board-card-date {
  font-size: 10px;
  color: var(--color-text-placeholder);
  margin-top: 6px;
}

/* ── 21. Login ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: var(--color-bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 940px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  overflow: hidden;
  min-height: 580px;
}

.auth-panel-left {
  background: linear-gradient(135deg, #0F2E23 0%, #166547 40%, #1FAC76 100%);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  box-shadow: inset 0 0 100px rgba(0,0,0,0.15);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 48px;
}

.auth-brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.auth-headline {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
}

.auth-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}

.auth-feature-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  margin-top: 5px;
  flex-shrink: 0;
}

.auth-panel-right {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-heading);
  margin-bottom: 6px;
}

.auth-form-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}

.auth-form .form-group {
  margin-bottom: 14px;
}

.auth-form .btn-primary {
  width: 100%;
  margin-top: 8px;
  height: 40px;
  font-size: 13px;
  font-weight: 600;
}

.auth-hint {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
}

.auth-hint-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.auth-hint-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-body);
  margin-bottom: 4px;
}

.auth-hint-cred {
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: 11px;
  color: var(--color-text-muted);
}

@media (max-width: 700px) {
  .auth-container { grid-template-columns: 1fr; }
  .auth-panel-left { display: none; }
}

/* ── 22. Utilities ─────────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.text-heading { color: var(--color-text-heading); }
.font-mono { font-family: 'SFMono-Regular', 'Consolas', monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 16px 0;
}

/* Info box */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-card);
  font-size: 12px;
  line-height: 1.5;
}

.info-box.info {
  background: var(--color-info-bg);
  border: 1px solid #bfcffd;
  color: var(--color-info);
}

.info-box.warning {
  background: var(--color-warning-bg);
  border: 1px solid #fde5bc;
  color: var(--color-warning);
}

.info-box.success {
  background: var(--color-success-bg);
  border: 1px solid #bbf0da;
  color: var(--color-success);
}

/* ── 23. Responsive ────────────────────────────────────────── */
@media (max-width: 1100px) {
  .approval-board { grid-template-columns: repeat(2, 1fr) !important; }
  .detail-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column !important;
  }

  .sidebar {
    width: 100% !important;
    height: auto !important;
    position: relative !important;
    border-right: none !important;
    border-bottom: 1px solid var(--color-border) !important;
  }

  .sidebar-brand {
    padding: 10px 16px !important;
    height: auto !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-wrap: wrap !important;
    padding: 6px 12px !important;
    gap: 4px !important;
    border-top: 1px solid var(--color-border);
  }

  .nav-section-label {
    display: none !important;
  }

  .nav-item {
    padding: 6px 10px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
  }

  .sidebar-footer {
    padding: 8px 16px !important;
    border-top: 1px solid var(--color-border);
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .topbar {
    padding: 0 12px !important;
  }

  .main-content {
    padding: 12px !important;
  }

  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .page-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  .page-actions .btn {
    flex: 1 !important;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .form-row.cols-2, .form-row.cols-3 {
    grid-template-columns: 1fr !important;
  }

  .approval-board {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .data-table {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }

  .card-body {
    padding: 12px !important;
  }
}

/* ── Professional Dropdown Vector Search Bar ──────────────── */
.select-search-wrap {
  position: relative;
  width: 100%;
}
.select-search-input {
  padding-left: 28px !important;
  font-size: 12px !important;
  height: 32px !important;
  margin-bottom: 5px !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 6px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 8px center;
  background-size: 13px 13px;
  transition: all 0.15s ease;
}
.select-search-input:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(31, 172, 118, 0.12) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231FAC76' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
}

