:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, monospace;

  /* Corporate Vinaseed Color Palette */
  --header-bg-start: #0F2E20;
  --header-bg-end: #1E4D36;
  --primary-green: #059669;
  --primary-dark: #064E3B;
  --primary-light: #D1FAE5;
  
  /* Matrix Column Header Colors */
  --th-unit-bg: #143827;
  --th-sl-bg: #1A4531;
  --th-tp-bg: #78350F;
  --th-kcl-bg: #7F1D1D;
  
  /* Matrix Body Colors */
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-zebra-odd: #F8FAFC;
  --bg-hover-row: #E6F4EA;
  --border-color: #CBD5E1;
  --border-dark: #64748B;
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  /* Cell Value Highlights */
  --tp-bg: #FFFBEB;
  --tp-text: #92400E;
  
  --kcl-bg: #FEF2F2;
  --kcl-text: #B91C1C;
  
  --section-bg: #27543C;
  --grandtotal-bg: #0F2E20;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.4;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* APP HEADER */
.app-header {
  background: linear-gradient(135deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
  color: #FFFFFF;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 100;
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: #FFFFFF;
  border-radius: 8px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.app-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
}

.header-branding h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.header-branding .subtitle {
  font-size: 11px;
  opacity: 0.95;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-realtime-clock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #FDE68A;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

/* KPI SUMMARY BAR */
.kpi-bar {
  display: flex;
  gap: 10px;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  min-width: 125px;
  transition: transform 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.16);
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

.kpi-value {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-top: 2px;
}

.total-sl .kpi-value { color: #A7F3D0; }
.total-tp .kpi-value { color: #FDE68A; }
.total-kcl .kpi-value { color: #FECDD3; }
.units-count .kpi-value { color: #E0E7FF; }

/* TOOLBAR SECTION */
.toolbar-section {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  z-index: 90;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.control-group label {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

select, input[type="text"] {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-main);
  outline: none;
  background: #FFFFFF;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

select:focus, input[type="text"]:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.search-group {
  position: relative;
}

.search-group input {
  width: 230px;
  padding-right: 24px;
}

#btnClearSearch {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
}

#btnClearSearch:hover {
  color: var(--text-primary);
}

/* BUTTONS & BADGES */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-main);
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary-green);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  box-shadow: 0 2px 5px rgba(6, 78, 59, 0.3);
}

.btn-outline {
  background-color: #FFFFFF;
  border-color: var(--border-color);
  color: #334155;
}

.btn-outline:hover {
  background-color: #F1F5F9;
  border-color: #94A3B8;
}

.btn-excel {
  background-color: #107C41;
  color: #FFFFFF;
}

.btn-excel:hover {
  background-color: #0B5C30;
  box-shadow: 0 2px 5px rgba(16, 124, 65, 0.3);
}

.badge-count {
  background: #2563EB;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

/* TOAST BANNER */
.toast-banner {
  background: #1E293B;
  color: #FFFFFF;
  padding: 8px 16px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.toast-banner.hidden { display: none; }
.toast-banner button { background: none; border: none; color: #94A3B8; font-size: 16px; cursor: pointer; }

/* COLUMN RESIZER & DENSITY PRESETS */
.resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  user-select: none;
  z-index: 60;
  transition: background-color 0.2s ease;
}

.resizer:hover, .resizer.resizing {
  background-color: #34D399;
}

/* DENSITY MODES */
.excel-matrix-table.density-compact th, 
.excel-matrix-table.density-compact td {
  padding: 3px 6px !important;
  font-size: 11px !important;
}

.excel-matrix-table.density-normal th, 
.excel-matrix-table.density-normal td {
  padding: 6px 10px !important;
  font-size: 12px !important;
}

.excel-matrix-table.density-spacious th, 
.excel-matrix-table.density-spacious td {
  padding: 9px 14px !important;
  font-size: 13px !important;
}

/* MATRIX TABLE CONTAINER & STICKY FREEZE PANE */
.matrix-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #FFFFFF;
}

.table-wrapper {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.excel-matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  font-size: 12px;
  background: #FFFFFF;
}

.excel-matrix-table th, 
.excel-matrix-table td {
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 10px;
  white-space: nowrap;
}

/* STICKY FREEZE PANE HEADERS */
.excel-matrix-table thead tr:nth-child(1) th {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--th-unit-bg);
  color: #FFFFFF;
  font-weight: 700;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.3px;
}

.excel-matrix-table thead tr:nth-child(2) th {
  position: sticky;
  top: 34px;
  z-index: 40;
  font-weight: 700;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Header Sub-columns */
.excel-matrix-table th.unit-group-header {
  background: var(--th-unit-bg) !important;
  border-left: 2px solid #34D399;
}

.excel-matrix-table th.subhead-sl { 
  background: var(--th-sl-bg) !important; 
  color: #E6F4ED !important;
}

.excel-matrix-table th.subhead-tp { 
  background: var(--th-tp-bg) !important; 
  color: #FEF3C7 !important; 
}

.excel-matrix-table th.subhead-kcl { 
  background: var(--th-kcl-bg) !important; 
  color: #FECDD3 !important; 
}

/* STICKY FREEZE PANE FIRST 3 COLUMNS */
.excel-matrix-table .col-tt {
  position: sticky;
  left: 0;
  z-index: 30;
  width: 40px;
  min-width: 40px;
  text-align: center;
  background: #EDF2F7;
  font-weight: 700;
  color: var(--text-secondary);
}

.excel-matrix-table .col-name {
  position: sticky;
  left: 40px;
  z-index: 30;
  width: 250px;
  min-width: 250px;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #FFFFFF;
  font-weight: 600;
  color: var(--text-primary);
}

.excel-matrix-table .col-dvt {
  position: sticky;
  left: 290px;
  z-index: 30;
  width: 45px;
  min-width: 45px;
  text-align: center;
  background: #EDF2F7;
  color: var(--text-secondary);
  font-weight: 500;
  border-right: 2px solid var(--border-dark) !important;
}

/* Corner Intersection of Sticky Header and Sticky Columns */
.excel-matrix-table thead tr:nth-child(1) th.col-tt,
.excel-matrix-table thead tr:nth-child(1) th.col-name,
.excel-matrix-table thead tr:nth-child(1) th.col-dvt {
  z-index: 50;
  background: var(--th-unit-bg) !important;
  color: #FFFFFF;
}

.excel-matrix-table thead tr:nth-child(2) th.col-tt,
.excel-matrix-table thead tr:nth-child(2) th.col-name,
.excel-matrix-table thead tr:nth-child(2) th.col-dvt {
  z-index: 50;
  background: var(--th-sl-bg) !important;
  color: #FFFFFF;
}

/* ZEBRA STRIPING & HOVER */
.excel-matrix-table tbody tr:nth-child(even) td {
  background-color: var(--bg-surface);
}

.excel-matrix-table tbody tr:nth-child(odd) td {
  background-color: var(--bg-zebra-odd);
}

.excel-matrix-table tbody tr:hover td {
  background-color: var(--bg-hover-row) !important;
}

.excel-matrix-table tbody tr:hover .col-tt,
.excel-matrix-table tbody tr:hover .col-name,
.excel-matrix-table tbody tr:hover .col-dvt {
  background-color: #E2E8F0 !important;
}

/* SECTION HEADING ROWS */
.excel-matrix-table tr.section-header-row td {
  background: var(--section-bg) !important;
  color: #FFFFFF !important;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  letter-spacing: 0.3px;
}

.excel-matrix-table tr.section-header-row .col-name {
  background: var(--section-bg) !important;
}

/* NUMERIC CELLS FORMATTING */
.cell-num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
}

.cell-zero {
  color: var(--text-muted);
  font-weight: 400;
}

.cell-tp-val {
  background-color: var(--tp-bg);
  color: var(--tp-text);
  font-weight: 600;
}

.cell-kcl-val {
  background-color: var(--kcl-bg);
  color: var(--kcl-text);
  font-weight: 700;
}

.cell-editable {
  cursor: pointer;
  position: relative;
}

.cell-editable:hover::after {
  content: '✎';
  position: absolute;
  right: 2px;
  top: 2px;
  font-size: 9px;
  color: var(--primary-green);
  opacity: 0.8;
}

/* GRAND TOTAL ROW */
.excel-matrix-table tr.grandtotal-row td {
  background-color: var(--grandtotal-bg) !important;
  color: #FFFFFF !important;
  font-weight: 800;
  font-size: 12px;
  border-top: 2px solid #34D399;
  border-bottom: 2px solid #34D399;
}

.excel-matrix-table tr.grandtotal-row .col-name {
  background-color: var(--grandtotal-bg) !important;
  color: #FFFFFF !important;
}

.excel-matrix-table tr.grandtotal-row .cell-tp-val {
  color: #FDE68A !important;
}

.excel-matrix-table tr.grandtotal-row .cell-kcl-val {
  color: #FECDD3 !important;
}

/* MODALS & OVERLAYS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  background: #FFFFFF;
  border-radius: 10px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2), 0 10px 10px -5px rgba(0,0,0,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-medium { width: 560px; }
.modal-large { width: 880px; max-height: 85vh; }

.modal-header {
  background: var(--header-bg-start);
  color: #FFFFFF;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: none; color: #FFFFFF; font-size: 20px; cursor: pointer; }

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.scrollable-modal-body {
  max-height: 65vh;
  overflow-y: auto;
}

.modal-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* UPLOAD DROP ZONE */
.drop-zone {
  border: 2px dashed #94A3B8;
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  background: #F8FAFC;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary-green);
  background: #ECFDF5;
}

.drop-zone-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.drop-zone-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.hidden-file-input { display: none; }

.selected-files-list {
  background: #F1F5F9;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
}

.selected-files-list h4 {
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

.selected-files-list ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selected-files-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #0F172A;
  background: #FFFFFF;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* AUDIT LOG TIMELINE & TRACK CHANGES TABLES */
.audit-event-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  background: #FFFFFF;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.audit-event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.audit-event-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--header-bg-start);
}

.audit-event-time {
  font-size: 11px;
  color: var(--text-muted);
}

.audit-event-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.audit-diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 8px;
}

.audit-diff-table th, .audit-diff-table td {
  border: 1px solid var(--border-color);
  padding: 5px 8px;
}

.audit-diff-table th {
  background: #F1F5F9;
  font-weight: 700;
  text-align: left;
}

.badge-inc {
  background: #DCFCE7;
  color: #15803D;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-dec {
  background: #FEE2E2;
  color: #B91C1C;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.info-tag {
  background: #F1F5F9;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  color: #334155;
}

.info-tag.highlight {
  background: #D1FAE5;
  color: #065F46;
}

.input-large {
  width: 170px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 6px 10px;
  text-align: right;
}

.modal-footer {
  background: #F8FAFC;
  padding: 14px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-color);
}

/* THEME & COLOR CUSTOMIZER STYLES */
.theme-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.theme-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.theme-preset-card {
  background: #FFFFFF;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.theme-preset-card:hover {
  border-color: var(--primary-green);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.theme-preset-card.active {
  border-color: var(--primary-green);
  background: #F0FDF4;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

.preset-preview {
  display: flex;
  gap: 4px;
  width: 100%;
  justify-content: center;
}

.preset-preview .swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15);
}

.preset-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

/* COLOR PICKERS GRID */
.color-pickers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  background: #F8FAFC;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.color-picker-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.color-picker-item label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
}

.color-input-wrapper input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  background: none;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 4px;
}

.color-hex {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
}

/* FULL SCREEN LOGIN OVERLAY STYLES */
.login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #091E15 0%, #0F2E20 50%, #17422E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  backdrop-filter: blur(12px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  padding: 32px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
  margin-bottom: 12px;
}

.login-title {
  font-size: 17px;
  font-weight: 800;
  color: #0F2E20;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 12px;
  color: #475569;
  margin-bottom: 24px;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 12px;
  font-weight: 700;
  color: #1E293B;
}

.password-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrapper input {
  width: 100%;
  padding: 10px 40px 10px 12px;
  font-size: 14px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-family: var(--font-main);
  outline: none;
  transition: all 0.2s ease;
}

.password-field-wrapper input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

.btn-toggle-eye {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.6;
  padding: 4px;
}

.btn-toggle-eye:hover { opacity: 1; }

.login-error-msg {
  background: #FEF2F2;
  border: 1px solid #FECDD3;
  color: #991B1B;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: center;
}

.login-error-msg.hidden { display: none; }

.btn-login-submit {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #FFFFFF;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-login-submit:hover {
  background: linear-gradient(135deg, #047857 0%, #064E3B 100%);
  transform: translateY(-1px);
}

.login-footer-info {
  margin-top: 20px;
  font-size: 11px;
  color: #94A3B8;
  font-weight: 500;
}

.btn-logout:hover {
  background-color: #FEF2F2 !important;
  border-color: #FECDD3 !important;
  color: #B91C1C !important;
}

.modal-small {
  max-width: 440px !important;
}

.form-row.vertical {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.form-row.vertical label {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary);
}

.form-row.vertical input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

/* ==========================================================================
   RESPONSIVE MOBILE & TABLET LAYOUT ENGINE
   ========================================================================== */

@media (max-width: 1024px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 10px 16px;
  }

  .header-branding {
    justify-content: space-between;
    width: 100%;
  }

  .kpi-bar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .kpi-card {
    min-width: 0;
    padding: 6px 8px;
    align-items: center;
    text-align: center;
  }

  .toolbar-section {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 10px;
  }

  .toolbar-left {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    width: 100%;
  }

  .toolbar-right {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .toolbar-right .btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 8px 12px;
    gap: 8px;
  }

  .header-branding {
    gap: 8px;
  }

  .app-logo {
    height: 28px;
  }

  .header-branding h1 {
    font-size: 13px;
    letter-spacing: 0;
    line-height: 1.2;
  }

  .header-branding .subtitle {
    font-size: 10px;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
  }

  .badge-realtime-clock {
    font-size: 9px;
    padding: 1px 6px;
  }

  /* 2x2 Grid for KPI Cards on Mobile Phone screens */
  .kpi-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .kpi-card {
    padding: 6px 8px;
    border-radius: 6px;
  }

  .kpi-label {
    font-size: 9px;
    letter-spacing: 0;
  }

  .kpi-value {
    font-size: 13px;
    margin-top: 1px;
  }

  /* Toolbar adjustments */
  .toolbar-section {
    padding: 8px 10px;
    gap: 8px;
  }

  .toolbar-left {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .search-group {
    grid-column: 1 / -1;
  }

  .control-group label {
    font-size: 10px;
  }

  .control-group select,
  .control-group input[type="text"] {
    font-size: 12px;
    padding: 5px 8px;
    height: 32px;
  }

  .toolbar-right {
    gap: 6px;
  }

  .toolbar-right .btn {
    font-size: 11px;
    padding: 6px 10px;
    height: 32px;
  }

  /* Matrix table wrapper scroll styling for smooth mobile panning */
  .matrix-container {
    padding: 0;
    width: 100vw;
    overflow-x: auto;
  }

  .table-wrapper {
    max-width: 100vw;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


