/* Global Styles and Design System */
:root {
  --font-family: 'Plus Jakarta Sans', 'Noto Sans Lao', system-ui, sans-serif;
  --bg-app: #f4f6f8;
  --bg-card: #ffffff;
  --text-main: #1a202c;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  /* Primary Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  
  --secondary: #475569;
  --secondary-hover: #334155;
  
  /* Status Colors */
  --color-pending: #d97706;      /* Gold/Orange */
  --color-pending-light: #fef3c7;
  
  --color-approved: #16a34a;     /* Green */
  --color-approved-light: #dcfce7;
  
  --color-transit: #0891b2;      /* Cyan */
  --color-transit-light: #ecfeff;
  
  --color-arrived: #0d9488;      /* Teal */
  --color-arrived-light: #ccfbf1;
  
  --color-rejected: #dc2626;     /* Red */
  --color-rejected-light: #fee2e2;

  --color-urgent: #ea580c;       /* Urgent Checkbox/Badge */
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Secondary / Sub English text styling across menus & bilingual labels */
.en-sub {
  font-size: 0.82em;
  opacity: 0.82;
  font-weight: 500;
  display: inline;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background-color: var(--bg-card);
  padding: 0.55rem 35px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-top-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
}

.header-top-row .header-logo {
  justify-self: start;
}

.header-top-row .header-nav {
  justify-self: center;
}

.header-top-row .db-portability {
  justify-self: end;
}

.header-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.75rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-logo .icon {
  font-size: 1.6rem;
}

.header-logo h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.header-logo .subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: -2px;
}

.header-nav {
  display: flex;
  gap: 0.4rem;
}

.nav-btn {
  background: none;
  border: 1px solid transparent;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.nav-btn:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.nav-btn.active {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.1);
}

/* Database Portability */
.db-portability {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #f8fafc;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.db-info {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.db-path-label code {
  background-color: #e2e8f0;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.76rem;
}

/* Header Dashboard Sub-Tabs (Compact, next to Import DB) */
.header-subtabs {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  gap: 3px;
}

.header-subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
  text-decoration: none;
}

.header-subtab-btn:hover:not(.active) {
  background: #ffffff;
  color: var(--primary);
  border-color: #cbd5e1;
}

.header-subtab-btn.active {
  background: var(--primary, #2563eb) !important;
  color: #ffffff !important;
  border-color: var(--primary, #2563eb) !important;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.header-subtab-btn .en-sub {
  font-size: 0.68rem;
  opacity: 0.85;
}

.header-subtab-btn.active .en-sub {
  color: rgba(255, 255, 255, 0.9) !important;
}

.header-subtab-btn.dropdown-open {
  background: #ffffff !important;
  color: var(--primary, #0284c7) !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.db-actions {
  display: flex;
  gap: 0.4rem;
}

.upload-label {
  cursor: pointer;
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

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

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

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

.btn-info {
  background-color: var(--color-transit);
  color: #fff;
}
.btn-info:hover {
  background-color: #0e7490;
}

.btn-outline {
  background: none;
  border-color: #cbd5e1;
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Main Dashboard Workspace Layout */
.main-content {
  display: block;
  flex: 1;
  padding: 1rem 35px 2.5rem 35px;
  max-width: 100%;
  margin: 0;
}

/* Sidebar Forms */
.sidebar-forms {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-forms .btn {
  font-size: 13px;
  line-height: 1.35;
  padding: 0.65rem 0.75rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
}

/* Accordion Component */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.accordion-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: var(--bg-card);
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  transition: var(--transition);
}

.accordion-header:hover {
  background-color: #f8fafc;
}

.accordion-arrow {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.accordion-item.active {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.accordion-item.active .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  background-color: #fff;
}

.accordion-item.active .accordion-content {
  display: block;
}

/* Forms UI */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.form-group label .hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: var(--font-family);
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #fff;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-checkbox {
  margin: 1.25rem 0;
}

.form-checkbox label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}

.form-checkbox input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  display: inline-block;
  position: relative;
  transition: var(--transition);
}

.form-checkbox input[type="checkbox"]:checked + .checkbox-custom {
  background-color: var(--color-urgent);
  border-color: var(--color-urgent);
}

.form-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.urgent-text {
  color: var(--color-urgent);
}

.input-readonly {
  background-color: #f1f5f9 !important;
  color: var(--text-muted) !important;
  cursor: not-allowed;
}

.field-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: block;
}

/* Center Panel - Task Tracker */
.task-tracker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Metrics Row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 0.45rem;
  margin: 0;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  min-height: 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
}

.metric-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.metric-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.metric-num {
  font-size: 1.05rem;
  font-weight: 700;
  display: block;
  line-height: 1.1;
}

.metric-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.15;
  white-space: normal;
}

.metric-label .en-sub {
  font-size: 0.62rem;
  font-weight: normal;
  display: inline;
}

.metric-icon {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-left: 0.35rem;
  flex-shrink: 0;
}

/* Card custom subtle accents */
.card-total { border-left: 3.5px solid var(--secondary); }
.card-pending { border-left: 3.5px solid var(--color-pending); }
.card-urgent { border-left: 3.5px solid var(--color-urgent); }
.card-transit { border-left: 3.5px solid var(--color-transit); }
.card-arrived { border-left: 3.5px solid var(--color-arrived); }
.card-rejected { border-left: 3.5px solid var(--color-urgent); }
.card-approved { border-left: 3.5px solid var(--color-arrived); }

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background-color: var(--bg-card);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  height: 34px;
  box-sizing: border-box;
}

.req-search-box {
  width: 230px;
  max-width: 250px;
  flex: 0 0 auto;
}

.search-icon {
  color: var(--text-muted);
  margin-right: 0.35rem;
  font-size: 0.8rem;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 0.8rem;
  color: var(--text-main);
  width: 100%;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-group select {
  padding: 0.25rem 0.55rem;
  font-family: var(--font-family);
  font-size: 0.78rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  background-color: #fff;
  cursor: pointer;
  height: 34px;
  box-sizing: border-box;
}

.filter-group-shipment {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.shipment-checkboxes {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: #f8fafc;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  height: 34px;
  box-sizing: border-box;
}

.shipment-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
  white-space: nowrap;
  user-select: none;
}

.shipment-check-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  margin: 0;
}

/* Tasks Table & Container */
.tasks-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 5px 1.25rem 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.tasks-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  background-color: #f1f5f9;
  color: var(--text-muted);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  padding: 0.28rem 0.45rem;
  border-bottom: 1px solid #cbd5e1;
  font-size: 0.76rem;
  vertical-align: middle;
}

/* Let columns wrap by default to save width, but keep key fields clean and single-line */
.data-table th {
  white-space: nowrap;
}

/* Semantic column wrapping control */
.col-doc-id,
.col-submit-date,
.col-urgency,
.col-status,
.col-action {
  white-space: nowrap;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #cbd5e1;
}

/* Sortable Date Header - Interactive Blue Header */
.sortable-date-header {
  color: #2563eb !important;
  cursor: pointer !important;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sortable-date-header:hover {
  color: #1d4ed8 !important;
  background-color: #eff6ff !important;
}

.sortable-date-header .en-sub {
  color: #3b82f6 !important;
  opacity: 0.95;
}

.sortable-date-header:hover .en-sub {
  color: #1d4ed8 !important;
}

.sort-indicator {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #2563eb;
  vertical-align: middle;
}

.sortable-date-header:hover .sort-indicator {
  color: #1d4ed8;
}

.data-table tbody tr {
  transition: var(--transition);
  border-bottom: 1px solid #cbd5e1;
}

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

/* Compact tasks table row details and tight vertical spacing */
#tasks-table tbody tr {
  border-bottom: 1px solid #cbd5e1;
}

#tasks-table tbody td {
  padding: 0.28rem 0.45rem;
  border-bottom: 1px solid #cbd5e1;
  line-height: 1.25;
}

#tasks-table tbody td small {
  font-size: 0.7rem;
  line-height: 1.15;
}

.data-table td .desc-text {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.actions-header {
  text-align: center;
}

.actions-header .th-content {
  justify-content: center;
  text-align: center;
}

.actions-header,
.actions-cell {
  text-align: center;
  padding: 0.5rem 0.25rem !important;
}

/* Edit button styling in tasks table (~30% smaller, compact and clean) */
.actions-cell .btn,
.btn-action-edit {
  padding: 0.2rem 0.46rem !important;
  font-size: 0.72rem !important;
  line-height: 1.15 !important;
  border-radius: 4px !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.2rem !important;
  font-weight: 500 !important;
}

.actions-cell .btn .en-sub,
.btn-action-edit .en-sub {
  font-size: 0.65rem !important;
  opacity: 0.9 !important;
}

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

/* Badges for status */
.badge-status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-align: center;
}

.status-pending { background-color: var(--color-pending-light); color: var(--color-pending); }
.status-approved { background-color: var(--color-approved-light); color: var(--color-approved); }
.status-transit { background-color: var(--color-transit-light); color: var(--color-transit); }
.status-arrived { background-color: var(--color-arrived-light); color: var(--color-arrived); }
.status-rejected { background-color: var(--color-rejected-light); color: var(--color-rejected); }

.badge-priority {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
}

.priority-urgent { background-color: #fff2e8; color: var(--color-urgent); border: 1px solid rgba(234, 88, 12, 0.2); }
.priority-normal { background-color: #f8fafc; color: var(--text-muted); border: 1px solid var(--border-color); }

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

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

.modal-container {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#modal-warehouse-goods .modal-container,
#modal-employee .modal-container,
#modal-vehicle .modal-container,
#modal-warehouse .modal-container {
  max-width: 1250px !important;
  width: 96vw !important;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-summary-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.summary-item {
  color: var(--text-main);
}

.summary-item strong {
  color: var(--text-muted);
}

.modal-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
  margin: 1.25rem 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

/* Report Section View */
.report-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.report-controls-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.report-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.report-preview-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.report-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.report-preview-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.report-summary-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.sum-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}

.sum-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.sum-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.2rem;
}

/* Print Only Styles (Hidden by default) */
.print-only {
  display: none;
}

/* @media Print layout overrides */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
  }
  
  .app-container,
  .modal-overlay,
  .sidebar-forms,
  .task-tracker,
  .app-header,
  .report-controls-card,
  .report-preview-header,
  .nav-btn,
  .db-portability,
  .sidebar-forms,
  #view-dashboard,
  #view-reports {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
    width: 100%;
    padding: 1.5cm;
  }
  
  .print-header {
    text-align: center;
    margin-bottom: 1.5cm;
    border-bottom: 2px solid #000;
    padding-bottom: 0.5cm;
  }
  
  .print-header h1 {
    font-size: 20pt;
    margin-bottom: 0.2cm;
  }
  
  .print-header h3 {
    font-size: 14pt;
    color: #333;
    margin-bottom: 0.2cm;
  }
  
  .print-header p {
    font-size: 10pt;
    font-style: italic;
  }
  
  .print-summary {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1cm;
    background-color: #f9f9f9;
    padding: 0.4cm;
    border: 1px solid #ddd;
    font-size: 10pt;
  }
  
  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5cm;
  }
  
  .print-table th,
  .print-table td {
    border: 1px solid #ccc;
    padding: 0.25cm 0.2cm;
    font-size: 8pt;
    text-align: left;
    word-break: break-word;
  }
  
  .print-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    text-transform: uppercase;
  }
  
  .print-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 8pt;
    margin-top: 1cm;
  }
  
  .signature-line {
    font-weight: bold;
  }
}

/* View Responsiveness Adaptations */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .app-header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .header-top-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .header-bottom-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .header-logo {
    justify-content: center;
  }
  
  .header-nav {
    justify-content: center;
  }
  
  .db-portability {
    justify-content: center;
  }

  .header-right-actions {
    margin-left: 0;
  }
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .metrics-row {
    grid-template-columns: 1fr;
  }
  
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-controls {
    flex-direction: column;
  }
  
  .nav-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }
}

/* Column Visibility Manager */
#tasks-table.hide-col-doc-id .col-doc-id { display: none; }
#tasks-table.hide-col-submit-date .col-submit-date { display: none; }
#tasks-table.hide-col-requester .col-requester { display: none; }
#tasks-table.hide-col-project-code .col-project-code { display: none; }
#tasks-table.hide-col-location .col-location { display: none; }
#tasks-table.hide-col-item .col-item { display: none; }
#tasks-table.hide-col-urgency .col-urgency { display: none; }
#tasks-table.hide-col-status .col-status { display: none; }
#tasks-table.hide-col-purchased .col-purchased { display: none; }
#tasks-table.hide-col-shipment .col-shipment { display: none; }
#tasks-table.hide-col-action .col-action { display: none; }

/* Resizable & Draggable Table Customizer */
#tasks-table,
#wh-main-table,
#st-main-table,
#fuel-timeline-table,
#maint-history-table,
#emp-main-table,
#veh-main-table,
#wh-reg-table {
  table-layout: fixed;
  width: max-content;
  border-collapse: collapse;
}

#tasks-table th,
#tasks-table td,
#wh-main-table th,
#wh-main-table td,
#st-main-table th,
#st-main-table td,
#fuel-timeline-table th,
#fuel-timeline-table td,
#maint-history-table th,
#maint-history-table td,
#emp-main-table th,
#emp-main-table td,
#veh-main-table th,
#veh-main-table td,
#wh-reg-table th,
#wh-reg-table td {
  border-bottom: 1px solid #cbd5e1;
  box-sizing: border-box;
}

#tasks-table th,
#wh-main-table th,
#st-main-table th,
#fuel-timeline-table th,
#maint-history-table th,
#emp-main-table th,
#veh-main-table th,
#wh-reg-table th {
  position: relative;
  user-select: none;
  overflow: visible !important;
  cursor: grab;
  border-right: 1px solid #cbd5e1;
}

#tasks-table th:last-child,
#wh-main-table th:last-child,
#st-main-table th:last-child,
#fuel-timeline-table th:last-child,
#maint-history-table th:last-child,
#emp-main-table th:last-child,
#veh-main-table th:last-child,
#wh-reg-table th:last-child {
  border-right: none;
}

#tasks-table th:active,
#wh-main-table th:active,
#st-main-table th:active,
#fuel-timeline-table th:active,
#maint-history-table th:active,
#emp-main-table th:active,
#veh-main-table th:active,
#wh-reg-table th:active {
  cursor: grabbing;
}

#tasks-table th.is-dragging,
#wh-main-table th.is-dragging,
#st-main-table th.is-dragging,
#fuel-timeline-table th.is-dragging,
#maint-history-table th.is-dragging,
#emp-main-table th.is-dragging,
#veh-main-table th.is-dragging,
#wh-reg-table th.is-dragging {
  opacity: 0.45;
  background-color: #e2e8f0 !important;
  cursor: grabbing;
}

#tasks-table th.drop-target-left,
#wh-main-table th.drop-target-left,
#st-main-table th.drop-target-left,
#fuel-timeline-table th.drop-target-left,
#maint-history-table th.drop-target-left,
#emp-main-table th.drop-target-left,
#veh-main-table th.drop-target-left,
#wh-reg-table th.drop-target-left {
  box-shadow: inset 4px 0 0 #2563eb !important;
}

#tasks-table th.drop-target-right,
#wh-main-table th.drop-target-right,
#st-main-table th.drop-target-right,
#fuel-timeline-table th.drop-target-right,
#maint-history-table th.drop-target-right,
#emp-main-table th.drop-target-right,
#veh-main-table th.drop-target-right,
#wh-reg-table th.drop-target-right {
  box-shadow: inset -4px 0 0 #2563eb !important;
}

.th-content {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  overflow: hidden;
  cursor: grab;
}

.th-content:active {
  cursor: grabbing;
}

.th-label-wrap {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
}

.th-label-wrap:active {
  cursor: grabbing;
}

/* Clear vertical divider line and grab zone for column resizing */
.col-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  width: 10px;
  bottom: 0;
  cursor: col-resize !important;
  user-select: none;
  z-index: 25;
  background: transparent;
}

.col-resizer::after {
  content: '';
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 4px;
  width: 2px;
  background-color: #94a3b8;
  border-radius: 1px;
  transition: all 0.15s ease;
}

.col-resizer:hover::after,
.col-resizer.resizing::after {
  top: 0;
  bottom: 0;
  width: 3px;
  left: 3.5px;
  background-color: #2563eb !important;
}

#tasks-table td,
#wh-main-table td,
#st-main-table td,
#fuel-timeline-table td,
#maint-history-table td,
#emp-main-table td,
#veh-main-table td,
#wh-reg-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid #f1f5f9;
}

#tasks-table td:last-child,
#wh-main-table td:last-child,
#st-main-table td:last-child,
#fuel-timeline-table td:last-child,
#maint-history-table td:last-child,
#emp-main-table td:last-child,
#veh-main-table td:last-child,
#wh-reg-table td:last-child {
  border-right: none;
}

#tasks-table td.col-action,
#wh-main-table td.col-action,
#st-main-table td.col-action,
#fuel-timeline-table td.col-action,
#maint-history-table td.col-action,
#emp-main-table td.col-action,
#veh-main-table td.col-action,
#wh-reg-table td.col-action {
  overflow: visible !important;
}

/* =============================================================================
   Excel-Lookalike Gridlines Mode (1px solid black)
   Toggled via btn-toggle-gridlines button or persistent user preference
   ============================================================================= */
body.excel-gridlines-enabled table.data-table,
body.excel-gridlines-enabled #tasks-table,
body.excel-gridlines-enabled #wh-main-table,
body.excel-gridlines-enabled #st-main-table,
body.excel-gridlines-enabled #fuel-timeline-table,
body.excel-gridlines-enabled #maint-history-table,
body.excel-gridlines-enabled #emp-main-table,
body.excel-gridlines-enabled #veh-main-table,
body.excel-gridlines-enabled #wh-reg-table,
body.excel-gridlines-enabled #report-preview-table,
body.excel-gridlines-enabled #table-maintenance-logs,
body.excel-gridlines-enabled .excel-grid {
  border-collapse: collapse !important;
  border: 1px solid #000000 !important;
}

body.excel-gridlines-enabled table.data-table th,
body.excel-gridlines-enabled table.data-table td,
body.excel-gridlines-enabled #tasks-table th,
body.excel-gridlines-enabled #tasks-table td,
body.excel-gridlines-enabled #wh-main-table th,
body.excel-gridlines-enabled #wh-main-table td,
body.excel-gridlines-enabled #st-main-table th,
body.excel-gridlines-enabled #st-main-table td,
body.excel-gridlines-enabled #fuel-timeline-table th,
body.excel-gridlines-enabled #fuel-timeline-table td,
body.excel-gridlines-enabled #maint-history-table th,
body.excel-gridlines-enabled #maint-history-table td,
body.excel-gridlines-enabled #emp-main-table th,
body.excel-gridlines-enabled #emp-main-table td,
body.excel-gridlines-enabled #veh-main-table th,
body.excel-gridlines-enabled #veh-main-table td,
body.excel-gridlines-enabled #wh-reg-table th,
body.excel-gridlines-enabled #wh-reg-table td,
body.excel-gridlines-enabled #report-preview-table th,
body.excel-gridlines-enabled #report-preview-table td,
body.excel-gridlines-enabled #table-maintenance-logs th,
body.excel-gridlines-enabled #table-maintenance-logs td,
body.excel-gridlines-enabled .excel-grid th,
body.excel-gridlines-enabled .excel-grid td {
  border: 1px solid #000000 !important;
}

body.excel-gridlines-enabled table.data-table th,
body.excel-gridlines-enabled #tasks-table th,
body.excel-gridlines-enabled #wh-main-table th,
body.excel-gridlines-enabled #st-main-table th,
body.excel-gridlines-enabled #fuel-timeline-table th,
body.excel-gridlines-enabled #maint-history-table th,
body.excel-gridlines-enabled #emp-main-table th,
body.excel-gridlines-enabled #veh-main-table th,
body.excel-gridlines-enabled #wh-reg-table th,
body.excel-gridlines-enabled #report-preview-table th,
body.excel-gridlines-enabled #table-maintenance-logs th,
body.excel-gridlines-enabled .excel-grid th {
  background-color: #f1f5f9 !important;
  border-bottom: 2px solid #000000 !important;
  color: #0f172a !important;
}

body.excel-gridlines-enabled table.data-table tbody tr:hover td,
body.excel-gridlines-enabled #tasks-table tbody tr:hover td,
body.excel-gridlines-enabled #wh-main-table tbody tr:hover td,
body.excel-gridlines-enabled #st-main-table tbody tr:hover td,
body.excel-gridlines-enabled #fuel-timeline-table tbody tr:hover td,
body.excel-gridlines-enabled #maint-history-table tbody tr:hover td,
body.excel-gridlines-enabled #emp-main-table tbody tr:hover td,
body.excel-gridlines-enabled #veh-main-table tbody tr:hover td,
body.excel-gridlines-enabled #wh-reg-table tbody tr:hover td,
body.excel-gridlines-enabled #report-preview-table tbody tr:hover td,
body.excel-gridlines-enabled .excel-grid tbody tr:hover td {
  background-color: #f8fafc !important;
}

/* Ensure column resizers align cleanly with 1px black borders */
body.excel-gridlines-enabled .col-resizer {
  right: -1px;
}

/* Toggle Gridlines Button Styling */
.btn-toggle-gridlines {
  transition: all 0.15s ease-in-out;
}

.btn-toggle-gridlines.active {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.18);
}

.btn-toggle-gridlines.active .en-sub {
  color: #cbd5e1 !important;
}

.column-visibility-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 5px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.75rem;
  z-index: 90;
  width: 280px;
  text-align: left;
}

.col-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s ease;
}

.col-item-row:hover {
  background-color: #f1f5f9;
}

.col-reorder-btns {
  display: flex;
  gap: 0.2rem;
}

.col-reorder-btn {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  font-size: 0.65rem;
  cursor: pointer;
  color: #475569;
  line-height: 1.2;
}

.col-reorder-btn:hover:not(:disabled) {
  background: #f8fafc;
  color: var(--primary);
  border-color: var(--primary);
}

.col-reorder-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Fuel Tracking & Timeline Styles */
.fuel-timeline {
  position: relative;
  padding: 0.15rem 0 0.35rem 1.4rem;
}

.fuel-timeline::before {
  content: '';
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  left: 0.55rem;
  width: 2px;
  background: #cbd5e1;
  border-radius: 2px;
}

.fuel-timeline-item {
  position: relative;
  margin-bottom: 0.35rem;
}

.fuel-timeline-dot {
  position: absolute;
  left: -1.25rem;
  top: 0.45rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 2px #e0f2fe;
}

.fuel-timeline-dot.diesel {
  border-color: #d97706;
  box-shadow: 0 0 0 2px #fef3c7;
}

.fuel-timeline-dot.petrol {
  border-color: #059669;
  box-shadow: 0 0 0 2px #d1fae5;
}

.fuel-timeline-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 0.32rem 0.55rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: box-shadow 0.15s ease;
}

.fuel-timeline-card:hover {
  box-shadow: var(--shadow-sm);
}

.fuel-timeline-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding-bottom: 0.25rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid #f1f5f9;
}

.fuel-timeline-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.22rem 0.65rem;
  font-size: 0.7rem;
  line-height: 1.25;
}

@media (max-width: 860px) {
  .fuel-timeline-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .fuel-timeline-meta {
    grid-template-columns: 1fr;
  }
}

.fuel-timeline-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #334155;
  min-width: 0;
}

.fuel-timeline-meta-item .label {
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.fuel-timeline-meta-item .label .en-sub {
  font-size: 0.58rem;
  color: #94a3b8;
  font-weight: normal;
}

.fuel-timeline-meta-item strong {
  font-size: 0.72rem;
  font-weight: 700;
}

.fuel-timeline-meta-item span {
  font-size: 0.72rem;
}

.fuel-timeline-meta .wh-tag-pill {
  font-size: 0.68rem !important;
  padding: 0.06rem 0.35rem !important;
  border-radius: 4px !important;
  line-height: 1.2 !important;
  box-shadow: none !important;
}

.fuel-timeline-meta .wh-tag-pill span {
  font-size: 0.68rem !important;
}

.fuel-badge-diesel {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.66rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  line-height: 1.2;
}

.fuel-badge-petrol {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.66rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  line-height: 1.2;
}

.fuel-plate-badge {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  line-height: 1.2;
}

/* Fleet Maintenance Hub Styles */
.maint-vehicle-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
  min-height: 48px;
}

.maint-vehicle-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.maint-vehicle-card.active {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.maint-vehicle-card.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3.5px;
  background-color: var(--primary);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

@media (max-width: 960px) {
  .maint-layout-grid,
  .fuel-layout-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Fuel Tracking Vehicle-Centric Hub Styles */
.fuel-vehicle-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
  min-height: 48px;
}

.fuel-vehicle-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.fuel-vehicle-card.active {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.fuel-vehicle-card.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3.5px;
  background-color: var(--primary);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* Reusable Pagination Styles */
.pagination-bar {
  margin-top: 0.65rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pagination-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0.2rem 0.55rem;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.pagination-btn:hover:not(:disabled):not(.disabled):not(.active) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--primary);
  transform: translateY(-1px);
}

.pagination-btn.active {
  background: var(--primary, #2563eb);
  color: #ffffff !important;
  border-color: var(--primary, #2563eb) !important;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
  cursor: default;
}

.pagination-btn:disabled,
.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
  transform: none;
}

.pagination-ellipsis {
  padding: 0 0.3rem;
  color: #94a3b8;
  font-weight: bold;
}

