/*
  Design system extracted from docs/ui-design.html — keep this file and that
  sample in sync. Token names/classes are intentionally unchanged so new
  pages can be copy-adapted straight from the sample without translation.
*/
:root{
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --paper: #f8fafc;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #0f52ba; /* Vibrant Grid India Corporate Blue */
  --accent-soft: #eff6ff;
  --accent-ink: #ffffff;
  --brand-green: #10b981;
  --brass: #d97706;
  --brass-soft: #fef3c7;
  --ok: #10b981;
  --ok-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --info: #3b82f6;
  --info-soft: #eff6ff;
  --shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  --panel-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.04), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --font-ui: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
}
html[data-theme="dark"]{
  --ink: #f8fafc;
  --ink-soft: #94a3b8;
  --ink-faint: #64748b;
  --paper: #090d16;
  --surface: #111827;
  --surface-raised: #1f2937;
  --line: #1f2937;
  --line-strong: #374151;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-ink: #0f172a;
  --brand-green: #34d399;
  --brass: #fbbf24;
  --brass-soft: rgba(251, 191, 36, 0.12);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.12);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --panel-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.4), 0 4px 8px -2px rgba(0, 0, 0, 0.3);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

*{ box-sizing: border-box; }
body{
  margin: 0; font-family: var(--font-ui); font-size: 13.5px; color: var(--ink);
  background: var(--paper); line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.mono{ font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a{ color: inherit; text-decoration: none; }

/* ===== Shell ===== */
.shell{ display: flex; height: 100vh; overflow: hidden; }

/* ===== Sidebar ===== */
.sidebar{
  width: 230px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; transition: width .25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 1px 0 0 0 var(--line);
}
.sidebar.collapsed{ width: 68px; }
.sidebar.collapsed .navlabel, .sidebar.collapsed .brand-text, .sidebar.collapsed .navgroup-title{ display: none; }
.brand{ display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); height: 56px; }
.brand-mark{ width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.brand-mark img{ width: 100%; height: 100%; object-fit: contain; }
.brand-full{ height: 22px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.05)); }
.sidebar.collapsed .brand-full{ display: none; }
.sidebar.collapsed .brand{ justify-content: center; padding: 14px 0; }

.nav{ flex: 1; overflow-y: auto; padding: 12px 10px; }
.navgroup{ margin-bottom: 18px; }
.navgroup-title{ font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-faint); padding: 0 12px 6px; }
.navitem{
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 6px; cursor: pointer;
  color: var(--ink-soft); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); margin-bottom: 3px;
}
.navitem svg{ flex-shrink: 0; width: 18px; height: 18px; stroke: var(--ink-soft); transition: stroke 0.2s ease; }
.navitem:hover{ background: var(--paper); color: var(--ink); transform: translateX(2px); }
.navitem:hover svg{ stroke: var(--ink); }
.navitem.active{ background: var(--accent-soft); color: var(--accent); font-weight: 600; }
html[data-theme="dark"] .navitem.active{ color: var(--ink); background: var(--accent-soft); }
.navitem.active svg{ stroke: var(--accent); }
html[data-theme="dark"] .navitem.active svg{ stroke: var(--ink); }

.sidebar-foot{ border-top: 1px solid var(--line); padding: 8px; }
.collapse-btn{
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 6px;
  background: none; border: none; color: var(--ink-faint); font-size: 12px; cursor: pointer; font-family: var(--font-ui);
  transition: all 0.2s ease;
}
.collapse-btn:hover{ background: var(--paper); color: var(--ink-soft); }

/* ===== Main ===== */
.main{ flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar{
  height: 56px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px; gap: 16px;
}
.crumbs{ display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); white-space: nowrap;}
.crumbs b{ color: var(--ink); font-weight: 700; letter-spacing: -0.2px; }
.crumbs .sep{ color: var(--ink-faint); }

.topbar-right{ display: flex; align-items: center; gap: 12px; }
.fy-chip{
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; background: var(--ok-soft);
  color: var(--ok); font-size: 11px; font-weight: 700; font-family: var(--font-mono); white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.1);
  animation: softPulse 3s infinite ease-in-out;
}
@keyframes softPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}
.fy-chip .dot{ width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.search{
  display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 12px; width: 220px; color: var(--ink-faint);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.search:focus-within{ border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.12); width: 260px; }
.search input{ border: none; background: none; outline: none; font-size: 12.5px; color: var(--ink); width: 100%; font-family: var(--font-ui);}

.icon-btn{
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center; color: var(--ink-soft); cursor: pointer; position: relative;
  transition: all 0.2s ease;
}
.icon-btn:hover{ background: var(--paper); color: var(--ink); transform: translateY(-1px); }
.badge-dot{ position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.avatar{
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--accent) 0%, #3b82f6 100%);
  color: var(--accent-ink); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.theme-toggle{ display: flex; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 2px; gap: 2px; }
.theme-toggle button{
  border: none; background: none; width: 28px; height: 26px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-faint); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.theme-toggle button.on{ background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.content{ flex: 1; overflow-y: auto; padding: 20px 24px; }

.page-head{ display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-title{ font-size: 19px; font-weight: 800; letter-spacing: -0.3px; color: var(--ink); }
.page-sub{ font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }

.btn{
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-ui); font-size: 12.5px; font-weight: 600;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.btn:hover:not(.btn-primary):not(.btn-approve):not(.btn-reject):not(.btn-return){
  background: var(--paper); border-color: var(--line-strong); transform: translateY(-1px);
}
.btn-primary{
  background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
  border-color: var(--accent); color: var(--accent-ink);
}
.btn-primary:hover{
  filter: brightness(1.08); transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 82, 186, 0.2);
}
.btn-ghost{ border-color: transparent; background: none; box-shadow: none; }
.btn-ghost:hover{ background: var(--paper); }
.btn-sm{ padding: 6px 10px; font-size: 12px; }

/* ===== Flash messages ===== */
.flash{ padding: 10px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; margin-bottom: 16px; box-shadow: var(--shadow); }
.flash-success{ background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(16, 185, 129, 0.15); }
.flash-error{ background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.15); }

/* ===== Stat cards ===== */
.stat-row{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card{
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px;
  box-shadow: var(--shadow); transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; overflow: hidden;
}
.stat-card::after{
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: transparent;
  transition: background-color 0.25s ease;
}
.stat-card:hover{
  transform: translateY(-3px); box-shadow: var(--panel-shadow); border-color: var(--line-strong);
}
.stat-card:hover::after{
  background: linear-gradient(90deg, var(--accent) 0%, #3b82f6 100%);
}
.stat-label{ font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-faint); font-weight: 700; }
.stat-value{ font-family: var(--font-mono); font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -0.5px; color: var(--ink); }
.stat-foot{ font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.stat-foot.up{ color: var(--ok); font-weight: 600; }
.stat-foot.warn{ color: var(--brass); font-weight: 600; }
.stat-foot.down{ color: var(--danger); font-weight: 600; }

.grid-2{ display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }

.panel{
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow); transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.panel:hover{ box-shadow: var(--panel-shadow); }
.panel-head{ display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-title{ font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: -0.2px; }
.panel-link{ font-size: 12px; color: var(--accent); font-weight: 600; cursor: pointer; transition: color 0.15s ease; }
.panel-link:hover{ color: #3b82f6; text-decoration: underline; }
.panel-body{ padding: 6px 0; }
.empty-state{ padding: 32px 18px; text-align: center; color: var(--ink-faint); font-size: 13px; }

/* ===== Stamp badge (signature element) ===== */
.stamp{
  display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; padding: 3px 8px; border-radius: 4px; border: 1.2px solid currentColor;
  transform: rotate(-1.5deg); line-height: 1.4; transition: all 0.15s ease;
}
.stamp-flat{ transform: rotate(0); }
.stamp-posted, .stamp-approved, .stamp-active, .stamp-completed{ color: var(--ok); background: var(--ok-soft); border-color: rgba(16, 185, 129, 0.25); }
.stamp-pending{ color: var(--brass); background: var(--brass-soft); border-color: rgba(217, 119, 6, 0.25); }
.stamp-rejected, .stamp-inactive, .stamp-failed, .stamp-cancelled{ color: var(--danger); background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.25); }
.stamp-returned{ color: var(--info); background: var(--info-soft); border-color: rgba(59, 130, 246, 0.25); }
.stamp-draft{ color: var(--ink-faint); background: var(--paper); border-color: var(--line); }

/* ===== Tables ===== */
table{ width: 100%; border-collapse: collapse; }
thead th{
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-faint);
  font-weight: 700; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
tbody td{ padding: 11px 18px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; color: var(--ink-soft); transition: all 0.15s ease; }
tbody tr:last-child td{ border-bottom: none; }
tbody tr:hover td{ background: var(--paper); color: var(--ink); }
td.num{ font-family: var(--font-mono); text-align: right; }
td.muted{ color: var(--ink-faint); }
.row-link{ font-weight: 600; color: var(--ink); cursor: pointer; transition: color 0.15s ease; }
.row-link:hover{ color: var(--accent); }

/* ===== Row action icon buttons (Edit/Delete) ===== */
.row-actions{ display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn-sm{
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); cursor: pointer; padding: 0;
  transition: all 0.2s ease;
}
.icon-btn-sm:hover{ background: var(--paper); color: var(--ink); }
.icon-btn-sm.edit:hover{ color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.icon-btn-sm.delete:hover{ color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* ===== AlertifyJS delete-confirm theming (override default look) ===== */
.alertify .ajs-dialog{ border-radius: var(--radius-lg); box-shadow: var(--panel-shadow), 0 20px 25px -5px rgba(0,0,0,0.1); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.alertify .ajs-header{ background: var(--surface); color: var(--ink); font-family: var(--font-ui); font-weight: 700; font-size: 14.5px; border-bottom: 1px solid var(--line); padding: 14px 20px; }
.alertify .ajs-body{ background: var(--surface); color: var(--ink-soft); font-family: var(--font-ui); font-size: 13.5px; padding: 20px; }
.alertify .ajs-footer{ background: var(--paper); border-top: 1px solid var(--line); padding: 12px 20px; }
.alertify .ajs-footer .ajs-buttons.ajs-primary .ajs-button{
  font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; border-radius: 6px; padding: 8px 14px; margin-left: 8px; border: 1px solid var(--line-strong);
  transition: all 0.2s ease;
}
.alertify .ajs-footer .ajs-buttons.ajs-primary .ajs-button.ajs-ok{ background: var(--danger); border-color: var(--danger); color: #fff; }
.alertify .ajs-footer .ajs-buttons.ajs-primary .ajs-button.ajs-ok:hover{ filter: brightness(1.08); transform: translateY(-1px); }
.alertify .ajs-footer .ajs-buttons.ajs-primary .ajs-button.ajs-cancel{ background: var(--surface); color: var(--ink); }
.alertify .ajs-footer .ajs-buttons.ajs-primary .ajs-button.ajs-cancel:hover{ background: var(--paper); transform: translateY(-1px); }
.alertify-notifier .ajs-message.ajs-error{ background: var(--danger); color: #fff; border-radius: 6px; font-family: var(--font-ui); font-size: 13px; box-shadow: var(--shadow); }
.alertify-notifier .ajs-message.ajs-success{ background: var(--ok); color: #fff; border-radius: 6px; font-family: var(--font-ui); font-size: 13px; box-shadow: var(--shadow); }

/* ===== DataTables theming (match the app's panel/table look) ===== */
.dt-container{ font-family: var(--font-ui); color: var(--ink); }
.dt-container .dt-layout-row{ margin: 0 !important; padding: 12px 18px; font-size: 12.5px; color: var(--ink-soft); }
.dt-container .dt-layout-row:has(.dt-search,.dt-length){ border-bottom: 1px solid var(--line); background: var(--surface); }
.dt-container .dt-layout-row:has(.dt-paging){ border-top: 1px solid var(--line); background: var(--paper); }
.dt-container .dt-search .dt-input, .dt-container .dt-length .dt-input{
  height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; font-size: 12.5px; background: var(--paper); color: var(--ink); outline: none;
  transition: all 0.2s ease;
}
.dt-container .dt-search .dt-input:focus{ border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.12); }
.dt-container select.dt-input{ padding: 0 8px; }
.dt-container .dt-info{ font-size: 12px; color: var(--ink-faint); }
.dt-container .dt-paging .dt-paging-button{
  box-sizing: border-box; min-width: 28px; height: 28px; padding: 0 10px; margin-left: 4px; line-height: 26px;
  border-radius: 6px; border: 1px solid var(--line) !important; background: var(--surface) !important; color: var(--ink) !important; font-size: 12px;
  transition: all 0.2s ease;
}
.dt-container .dt-paging .dt-paging-button.current, .dt-container .dt-paging .dt-paging-button.current:hover{
  background: var(--accent-soft) !important; border-color: var(--accent-soft) !important; color: var(--accent) !important; font-weight: 600;
}
.dt-container .dt-paging .dt-paging-button:hover{ background: var(--paper) !important; border-color: var(--line-strong) !important; color: var(--ink) !important; }
.dt-container .dt-paging .dt-paging-button.disabled, .dt-container .dt-paging .dt-paging-button.disabled:hover{
  color: var(--ink-faint) !important; cursor: default; background: var(--surface) !important; opacity: 0.5;
}
.dt-container .dt-processing{ color: var(--ink-soft); font-size: 12.5px; }
table.dataTable thead th{ position: relative; }
table.dataTable thead th.dt-orderable-asc:hover, table.dataTable thead th.dt-orderable-desc:hover{ color: var(--ink); cursor: pointer; }

.activity-item{ display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); transition: background-color 0.15s ease; }
.activity-item:last-child{ border-bottom: none; }
.activity-item:hover{ background: var(--paper); }
.activity-dot{ width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--accent); }
.activity-text{ font-size: 13px; color: var(--ink-soft); }
.activity-text b{ color: var(--ink); }
.activity-time{ font-size: 11px; color: var(--ink-faint); font-family: var(--font-mono); margin-top: 3px; }

/* ===== Toolbar / filters ===== */
.toolbar{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.toolbar-left{ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip{
  font-size: 12px; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line); color: var(--ink-soft); cursor: pointer; font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); background: var(--surface);
}
.chip:hover{ border-color: var(--line-strong); color: var(--ink); }
.chip.active{ background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }

/* ===== Slide-over form ===== */
.overlay{ position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35); backdrop-filter: blur(4px); display: none; z-index: 50; }
.overlay.show{ display: block; }
.drawer{
  position: fixed; top: 0; right: 0; height: 100%; width: 640px; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(0,0,0,.08); transform: translateX(100%); transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1); z-index: 51;
  display: flex; flex-direction: column;
}
.drawer.show{ transform: translateX(0); }
.drawer form { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.drawer-head{ padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.drawer-title{ font-size: 14.5px; font-weight: 700; color: var(--ink); }
.drawer-body{
  flex: 1; overflow-y: auto; padding: 20px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px;
}
.drawer-body .field{ margin-bottom: 0; }
.drawer-body .field:has(textarea),
.drawer-body .field:has(select[multiple]),
.drawer-body .field-check{
  grid-column: span 2;
}
.drawer-foot{ padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; align-items: center; gap: 10px; background: var(--paper); flex-shrink: 0; z-index: 10; }

/* ===== Global Action Loader ===== */
#global-top-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent, #0f52ba) 0%, #3b82f6 50%, #10b981 100%);
  background-size: 200% 100%;
  z-index: 99999;
  display: none;
  animation: topLoaderBar 1.5s infinite linear;
}

@keyframes topLoaderBar {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

#global-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99990;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

#global-loader-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loader-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 22px 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner-ring {
  width: 36px;
  height: 36px;
  border: 3.5px solid var(--line, #e2e8f0);
  border-top-color: var(--accent, #0f52ba);
  border-radius: 50%;
  animation: spinRing 0.75s infinite linear;
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink, #1e293b);
  letter-spacing: -0.2px;
}

/* Button Loading Spinner */
.btn-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spinRing 0.6s infinite linear;
  margin-right: 6px;
  vertical-align: middle;
}

.field{ margin-bottom: 16px; }
.field label{ display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-faint); margin-bottom: 6px; }
.field input, .field select, .field textarea{
  width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; font-size: 13px;
  background: var(--paper); color: var(--ink); font-family: var(--font-ui); outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.field input:focus, .field select:focus, .field textarea:focus{ border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.12); }
.field textarea{ height: 70px; padding: 8px 12px; resize: vertical; }
.field-row{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-check{ display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.field-check input{ width: 16px; height: 16px; cursor: pointer; }
.helptext{ font-size: 11px; color: var(--ink-faint); margin-top: 4px; }

/* ===== Required-field indicator + formvalidation.io error state ===== */
.required-mark{ color: var(--danger); font-weight: 700; }
.form-group.has-error input, .form-group.has-error select, .form-group.has-error textarea{
  border-color: var(--danger); background: var(--danger-soft);
}
.form-group .help-block, .form-group .fv-help-block{
  font-size: 11px; color: var(--danger); margin-top: 4px; display: block; font-weight: 600;
}

/* ===== Voucher entry ===== */
.voucher-head{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.voucher-lines{ margin-bottom: 14px; }
.voucher-lines th, .voucher-lines td{ font-size: 12.5px; padding: 8px 10px; }
.voucher-lines input, .voucher-lines select{
  width: 100%; height: 32px; border: 1px solid transparent; border-radius: 6px; padding: 0 8px; font-size: 12.5px;
  background: transparent; color: var(--ink); font-family: var(--font-ui); transition: all 0.2s ease;
}
.voucher-lines input.mono{ font-family: var(--font-mono); text-align: right; }
.voucher-lines input:focus, .voucher-lines select:focus{ border-color: var(--line-strong); background: var(--paper); outline: none; }
.add-line{ padding: 8px 14px; font-size: 12px; color: var(--accent); font-weight: 700; cursor: pointer; border: none; background: none; transition: color 0.15s ease; }
.add-line:hover{ color: #3b82f6; text-decoration: underline; }
.remove-line{ color: var(--ink-faint); cursor: pointer; background: none; border: none; font-size: 16px; transition: color 0.15s ease; }
.remove-line:hover{ color: var(--danger); }
.totals-bar{ display: flex; align-items: center; justify-content: flex-end; gap: 24px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--paper); border-radius: 0 0 var(--radius) var(--radius); }
.totals-item{ font-size: 12px; color: var(--ink-soft); }
.totals-item b{ font-family: var(--font-mono); color: var(--ink); font-size: 14px; margin-left: 6px; }
.balance-flag{ font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.balance-flag.ok{ background: var(--ok-soft); color: var(--ok); }
.balance-flag.bad{ background: var(--danger-soft); color: var(--danger); }
.actions-row{ display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ===== Workflow ===== */
.wf-layout{ display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.wf-queue-item{ padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; display: block; transition: all 0.2s ease; }
.wf-queue-item:hover{ background: var(--paper); }
.wf-queue-item.selected{ background: var(--accent-soft); border-left: 3px solid var(--accent); padding-left: 15px; }
.wf-queue-title{ font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.wf-queue-meta{ font-size: 11.5px; color: var(--ink-soft); display: flex; justify-content: space-between; }
.wf-queue-meta span:last-child{ font-family: var(--font-mono); }

.wf-detail{ padding: 20px; }
.wf-detail-head{ display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.wf-detail-id{ font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); }
.wf-detail-title{ font-size: 17px; font-weight: 800; margin-top: 3px; color: var(--ink); letter-spacing: -0.3px; }
.wf-meta-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; padding: 14px; background: var(--paper); border-radius: 8px; border: 1px solid var(--line); }
.wf-meta-label{ font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-faint); font-weight: 700; }
.wf-meta-value{ font-size: 13px; font-weight: 700; margin-top: 4px; color: var(--ink); }

.timeline{ display: flex; align-items: flex-start; margin-bottom: 24px; padding: 6px 0; }
.tl-step{ flex: 1; text-align: center; position: relative; }
.tl-line{ position: absolute; top: 14px; left: -50%; width: 100%; height: 2px; background: var(--line-strong); z-index: 0; }
.tl-step:first-child .tl-line{ display: none; }
.tl-step.done .tl-line{ background: var(--ok); }
.tl-dot{ width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; position: relative; z-index: 1; font-size: 12px; font-weight: 700; transition: all 0.2s ease; }
.tl-step.done .tl-dot{ background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-step.current .tl-dot{ background: var(--brass-soft); border-color: var(--brass); color: var(--brass); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12); }
.tl-name{ font-size: 12px; font-weight: 600; color: var(--ink); }
.tl-sub{ font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

.remark-box{ background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 18px; transition: border-color 0.2s ease; }
.remark-box:focus-within{ border-color: var(--line-strong); }
.remark-box textarea{ width: 100%; border: none; background: none; resize: vertical; min-height: 50px; font-size: 13px; font-family: var(--font-ui); outline: none; color: var(--ink); }
.wf-actions{ display: flex; gap: 10px; }
.btn-approve{ background: linear-gradient(135deg, var(--ok) 0%, #059669 100%); border-color: var(--ok); color: #fff; }
.btn-approve:hover{ background: var(--ok); filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }
.btn-reject{ background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%); border-color: var(--danger); color: #fff; }
.btn-reject:hover{ background: var(--danger); filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2); }
.btn-return{ background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%); border-color: var(--info); color: #fff; }
.btn-return:hover{ background: var(--info); filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2); }

/* ===== Misc form pages (settings / year closing) ===== */
.form-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.section-title{ font-size: 14px; font-weight: 800; margin: 24px 0 12px; color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.section-title:first-child{ margin-top: 0; }
