/* WATER LANKA SERVICES (PVT) LTD - ERP STYLES */
:root {
  --primary: #0a3d62;
  --primary-dark: #072a44;
  --primary-light: #1e5f8a;
  --accent: #00a8cc;
  --accent-hover: #008eb0;
  --accent-light: #e0f7fa;
  --secondary: #2c3e50;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Layout */
#app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #092c48 0%, #051929 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 2px 0 10px rgba(0,0,0,0.15);
  overflow-y: auto;
}

.brand-header {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
}

.brand-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent) 0%, #0077b6 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0,168,204,0.4);
}

.brand-text h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.brand-text p {
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.sidebar-nav {
  padding: 15px 10px;
  flex: 1;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #94a3b8;
  padding: 12px 14px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 3px;
  transition: all 0.2s ease;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0,168,204,0.25) 0%, rgba(0,168,204,0.05) 100%);
  color: #ffffff;
  border-left: 3.5px solid var(--accent);
  font-weight: 600;
}

.nav-item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  opacity: 0.9;
}

/* Main Container */
#main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
}

/* Header */
#top-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.company-badge {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fy-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-info-text {
  line-height: 1.2;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.role-tag {
  font-size: 10px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  display: inline-block;
}

.role-tag.admin { background: #fee2e2; color: #991b1b; }
.role-tag.pm { background: #e0e7ff; color: #3730a3; }
.role-tag.accountant { background: #dcfce7; color: #166534; }
.role-tag.cashier { background: #fef3c7; color: #92400e; }

/* Quick Switcher dropdown */
.quick-role-select {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #f8fafc;
  cursor: pointer;
}

/* Page Content */
#content-area {
  padding: 24px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.page-title p {
  color: var(--text-muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-light);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: #e2e8f0;
}

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

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.kpi-card.accent::before { background: var(--accent); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.info::before { background: var(--info); }

.kpi-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

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

/* Cards & Tables */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
}

.card-body {
  padding: 20px;
}

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

.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

table.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background-color: #f1f5f9;
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 750px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalSlide 0.25s ease-out;
}

.modal-content.modal-lg {
  max-width: 950px;
}

.modal-content.modal-xl {
  max-width: 1100px;
}

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

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

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

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

.form-group.col-span-3 {
  grid-column: span 3;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,168,204,0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Toast Alerts & Operational Error Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 440px;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.22);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastFade 0.3s ease;
  min-width: 280px;
  line-height: 1.4;
  position: relative;
  transition: opacity 0.25s, transform 0.25s;
}

.toast-icon {
  font-size: 16px;
  line-height: 1;
  margin-top: 2px;
  flex-shrink: 0;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}

.toast-msg {
  font-size: 12.5px;
  word-break: break-word;
}

.toast-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s;
}

.toast-close:hover {
  color: #ffffff;
}

.toast.toast-success {
  background: #064e3b;
  border-left: 5px solid #10b981;
}

.toast.toast-error {
  background: #7f1d1d;
  border-left: 5px solid #ef4444;
  animation: toastFade 0.3s ease, shakeAlert 0.45s ease;
}

.toast.toast-warning {
  background: #78350f;
  border-left: 5px solid #f59e0b;
  animation: toastFade 0.3s ease, shakeAlert 0.35s ease;
}

.toast.toast-info {
  background: #1e3a8a;
  border-left: 5px solid #3b82f6;
}

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

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  15%, 55% { transform: translateX(-7px); }
  35%, 75% { transform: translateX(7px); }
}

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

/* Global Operational Error Notification Banner */
.global-error-banner {
  background: #fef2f2;
  border-bottom: 2px solid #ef4444;
  padding: 12px 24px;
  position: sticky;
  top: var(--header-height);
  z-index: 85;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.15);
  animation: slideDown 0.3s ease, shakeAlert 0.4s ease 0.1s;
}

.error-banner-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 1400px;
  margin: 0 auto;
}

.error-banner-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

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

.error-banner-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-banner-info p {
  font-size: 13px;
  color: #7f1d1d;
  line-height: 1.45;
}

.error-banner-details {
  margin-top: 8px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11.5px;
  color: #991b1b;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

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

/* Mobile Toggle and Drawer Elements */
.mobile-toggle-btn {
  display: none;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.mobile-toggle-btn:hover {
  background: #e2e8f0;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 28px;
  cursor: pointer;
  padding: 0 4px;
  margin-left: auto;
  line-height: 1;
  transition: color 0.15s;
}

.sidebar-close-btn:hover {
  color: #ffffff;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 110;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Water Lanka Mandatory Field Disclaimers & Statutory Notices */
.water-lanka-disclaimer-box {
  background: linear-gradient(135deg, rgba(10, 61, 98, 0.05), rgba(0, 168, 204, 0.08));
  border: 1px solid rgba(0, 168, 204, 0.35);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #1e3a8a;
  line-height: 1.45;
}

.water-lanka-disclaimer-box .disclaimer-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
  color: var(--primary);
  font-size: 12.5px;
}

.water-lanka-disclaimer-box .disclaimer-body {
  color: #334155;
  font-size: 11.5px;
}

.required-asterisk {
  color: #ef4444;
  font-weight: 800;
  margin-left: 3px;
  font-size: 13px;
  cursor: help;
  user-select: none;
}

.doc-disclaimer-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-left: 3.5px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 22px;
  margin-bottom: 22px;
  font-size: 11px;
  color: #475569;
  line-height: 1.45;
}

.modal-footer-disclaimer {
  font-size: 11px;
  color: #64748b;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Auth Login Screen */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #092c48 0%, #001220 100%);
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  padding: 36px 32px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent) 0%, #0077b6 100%);
  color: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
  box-shadow: 0 6px 16px rgba(0,168,204,0.4);
}

.login-header h2 {
  font-size: 20px;
  color: var(--primary);
  font-weight: 700;
}

.login-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.demo-credentials-box {
  background: #f8fafc;
  border: 1px dashed var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-top: 20px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.demo-credentials-box strong {
  color: var(--primary);
}

/* PRINT MEDIA STYLES - CLEAN ISOLATED PDF EXPORT */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  /* Hide navigation, sidebar, topbar, buttons, headers */
  #sidebar,
  #top-header,
  .page-header,
  .page-actions,
  .btn,
  .modal-close,
  .modal-footer,
  .quick-role-select,
  #toast-container,
  .no-print {
    display: none !important;
  }

  /* When modal is open, completely hide the main background content area */
  body.modal-open #main-wrapper,
  body.modal-open #content-area {
    display: none !important;
  }

  /* Modal turns into direct full-width document */
  .modal-overlay {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    display: block !important;
  }

  .modal-content {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .modal-header {
    display: none !important;
  }

  .modal-body {
    padding: 0 !important;
    overflow: visible !important;
  }

  #main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }

  #content-area {
    padding: 0 !important;
  }

  .printable-document {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10px 15px !important;
    box-shadow: none !important;
    border: none !important;
  }

  table {
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  thead {
    display: table-header-group;
  }
}

/* Printable Document Template Styling */
.printable-document {
  background: #ffffff;
  padding: 32px 36px;
  color: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  max-width: 900px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

.doc-logo-container {
  margin-bottom: 8px;
}

.doc-logo-img {
  max-height: 64px;
  max-width: 320px;
  object-fit: contain;
  display: block;
}
  background: #ffffff;
  padding: 36px 40px;
  color: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  max-width: 900px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

.doc-letterhead {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.doc-company-info h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.doc-company-info .company-slogan {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.doc-company-info p {
  font-size: 11.5px;
  color: #475569;
  line-height: 1.4;
}

.doc-meta {
  text-align: right;
}

.doc-title-badge {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.doc-meta-table {
  font-size: 12px;
  margin-left: auto;
}

.doc-meta-table td {
  padding: 2px 6px;
}

.doc-meta-table td.label {
  font-weight: 600;
  color: #64748b;
}

.doc-party-info {
  display: flex;
  justify-content: space-between;
  background: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  font-size: 12.5px;
}

.doc-party-col h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
  font-weight: 700;
}

.doc-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 12.5px;
}

.doc-items-table th {
  background: var(--primary);
  color: #ffffff;
  padding: 10px 12px;
  font-weight: 600;
  text-align: left;
}

.doc-items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.doc-items-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.doc-totals-box {
  width: 320px;
  margin-left: auto;
  margin-bottom: 28px;
  font-size: 13px;
}

.doc-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid #f1f5f9;
}

.doc-totals-row.grand-total {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  border-top: 2px solid var(--primary);
  border-bottom: 2px double var(--primary);
  padding: 8px 0;
  margin-top: 4px;
}

.doc-bank-box {
  background: #f0fdf4;
  border: 1px dashed #86efac;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 24px;
  font-size: 12px;
}

.doc-bank-box h4 {
  font-size: 12px;
  color: #166534;
  margin-bottom: 4px;
}

.doc-signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 40px;
  padding-top: 20px;
}

.doc-signature-line {
  border-top: 1px dashed #94a3b8;
  padding-top: 8px;
  text-align: center;
  font-size: 11.5px;
  color: #475569;
}

.doc-signature-line strong {
  display: block;
  color: var(--primary);
}

/* =======================================================
   RESPONSIVE LAYOUT ENGINE (MOBILE, TABLET & DESKTOP)
   ======================================================= */

/* Tablet & Mobile Screens (<= 1024px) */
@media screen and (max-width: 1024px) {
  #sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 120;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }

  #sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .mobile-toggle-btn {
    display: inline-flex;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Screens (<= 768px) */
@media screen and (max-width: 768px) {
  #top-header {
    padding: 8px 12px;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-left {
    gap: 8px;
    flex: 1 1 auto;
  }

  .header-right {
    gap: 8px;
  }

  .header-tin-text {
    display: none !important;
  }

  .btn-text {
    display: none;
  }

  .user-info-text {
    display: none;
  }

  .header-action-btn {
    padding: 6px 10px;
  }

  #content-area {
    padding: 12px 10px;
  }

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

  .page-title h1 {
    font-size: 19px;
  }

  .page-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 42px;
    font-size: 13px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .summary-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-grid,
  .form-grid.grid-3 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Responsive Touch-Friendly Tables */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 4px rgba(0,0,0,0.03);
  }

  .data-table,
  .table {
    min-width: 600px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Modals on Mobile */
  .modal-overlay {
    padding: 10px;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    margin: auto 0 !important;
    border-radius: var(--radius-md) !important;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-header h3 {
    font-size: 15px;
  }

  .modal-body {
    padding: 14px 16px;
    max-height: calc(92vh - 130px);
    overflow-y: auto;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
    min-height: 42px;
  }

  /* Toast Alerts on Mobile */
  #toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }

  /* Printable Documents Fluid Mobile Preview */
  .printable-document {
    padding: 16px !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .doc-letterhead {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }

  .doc-meta {
    text-align: left;
  }

  .doc-meta-table {
    margin-left: 0;
  }

  .doc-party-info {
    flex-direction: column;
    gap: 12px;
  }

  .doc-totals-box {
    width: 100%;
    margin-left: 0;
  }

  .doc-signatures {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 24px;
  }

  /* Global Error Banner Mobile View */
  .global-error-banner {
    padding: 10px 14px;
  }

  .error-banner-content {
    flex-direction: column;
    gap: 10px;
  }

  .error-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Small Smartphone View (<= 480px) */
@media screen and (max-width: 480px) {
  .company-name-text {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11.5px;
  }

  .fy-badge {
    display: none;
  }

  .login-card {
    padding: 24px 18px;
    margin: 12px;
  }

  .login-header h2 {
    font-size: 17px;
  }

  .form-control {
    font-size: 14px;
    min-height: 42px;
  }

  .btn {
    min-height: 40px;
  }
}

/* Site & Field Operations Styles: Rentals, Wages, Transport, Expenses */
.cost-pillar-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin: 2px 4px 2px 0;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.cost-pillar-badge.rental { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.cost-pillar-badge.wages { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.cost-pillar-badge.transport { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.cost-pillar-badge.expenses { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-teal { background: #ccfbf1; color: #115e59; }


/* Sri Lanka Customs CUSDEC & Landing Cost Engine Styles */
.cusdec-box-card {
  border: 1px solid #0284c7;
  border-radius: 8px;
  background: #f8fafc;
  padding: 16px;
  margin-bottom: 16px;
}
.cusdec-grid-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: #e0f2fe;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  border: 1px solid #bae6fd;
}
.cusdec-asycuda-box {
  border: 1px solid #94a3b8;
  padding: 8px 12px;
  background: white;
  border-radius: 4px;
  position: relative;
}
.cusdec-asycuda-box .box-num {
  font-size: 10px;
  font-weight: 800;
  color: #0369a1;
  text-transform: uppercase;
}
.cusdec-asycuda-box .box-title {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
}
.cusdec-asycuda-box .box-content {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.landed-cost-summary-panel {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  padding: 20px;
  border-radius: 10px;
  margin-top: 20px;
  border: 1px solid #334155;
}
.landed-cost-metric {
  text-align: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.landed-cost-metric .metric-val {
  font-size: 18px;
  font-weight: 800;
  color: #38bdf8;
}
.landed-cost-metric .metric-lbl {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
}
.hsn-tag {
  display: inline-block;
  background: #f1f5f9;
  color: #0369a1;
  font-family: monospace;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}
.tax-pill {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
  font-weight: 600;
}
.tax-pill.cid { background: #e0e7ff; color: #3730a3; }
.tax-pill.pal { background: #fef3c7; color: #92400e; }
.tax-pill.cess { background: #fce7f3; color: #9d174d; }
.tax-pill.sscl { background: #ffedd5; color: #c2410c; }
.tax-pill.vat { background: #dcfce7; color: #166534; }

/* ========================================================
   PURCHASING & MARKETING RFQ ENGINE & AUTO-QUOTE STYLES
   ======================================================== */
.rfq-metric-card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}
.rfq-metric-card .val {
  font-size: 24px;
  font-weight: 700;
  color: #0b4f6c;
  margin-top: 4px;
}
.rfq-metric-card .lbl {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
}
.rfq-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.rfq-badge.broadcasted { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.rfq-badge.bids-received { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.rfq-badge.quoted { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.rfq-badge.closed { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

.supplier-bid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin: 16px 0;
}
.supplier-bid-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  position: relative;
  transition: all 0.2s ease;
}
.supplier-bid-box.has-quote {
  background: #f0fdf4;
  border-color: #86efac;
}
.supplier-bid-box.lowest-bid {
  background: #ecfdf5;
  border: 2px solid #10b981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}
.lowest-bid-ribbon {
  position: absolute;
  top: -10px;
  right: 12px;
  background: #10b981;
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.whatsapp-btn {
  background-color: #25d366 !important;
  color: white !important;
  border: none !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.whatsapp-btn:hover {
  background-color: #128c7e !important;
}
.email-btn {
  background-color: #0b4f6c !important;
  color: white !important;
  border: none !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.email-btn:hover {
  background-color: #083344 !important;
}
.comparison-matrix-table th {
  background-color: #f1f5f9;
  font-weight: 600;
  font-size: 12px;
}
.lowest-item-price {
  background-color: #dcfce7 !important;
  color: #166534 !important;
  font-weight: 700;
}
.auto-quote-preview {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
