@import url("/css/app.css?v=8.9.73");
@import url("/css/tokens.css?v=8.9.73");

/* Unified Light & Dark theme tokens (single source of truth) */
body.theme-light {
  color-scheme: light;
}

body:not(.theme-light) {
  color-scheme: dark;
}

/* Global Typography & Font Weights Enhancement */
body, input, button, select, textarea {
  font-family: var(--font-sans) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .page-main-title, .erp-panel-title, .ds-page-title, .ds-section-title {
  font-family: var(--font-heading) !important;
  letter-spacing: -0.015em;
}

/* Standardized Buttons (Consistent Height, Clean Borders, No over-blur) */
.btn {
  font-family: var(--font-sans) !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 14px !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  transition: all 0.15s ease !important;
}

.btn.primary {
  background: #2563eb !important;
  color: #ffffff !important;
  border: 1px solid #1d4ed8 !important;
}
.btn.primary:hover:not(:disabled) {
  background: #1d4ed8 !important;
}

body:not(.theme-light) .btn.primary {
  background: #3b82f6 !important;
  border: 1px solid #2563eb !important;
}
body:not(.theme-light) .btn.primary:hover:not(:disabled) {
  background: #2563eb !important;
}

/* Standardized High-Readability Data Tables */
.table, .kitech-custom-table, .admin-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 13.5px !important;
}

.table th, .kitech-custom-table th, .admin-table th {
  padding: 10px 14px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  white-space: nowrap !important;
}

.table td, .kitech-custom-table td, .admin-table td {
  padding: 12px 14px !important;
  font-size: 13.5px !important;
  line-height: 1.45 !important;
  vertical-align: middle !important;
}

/* Dark Theme Table Contrast */
body:not(.theme-light) .table th,
body:not(.theme-light) .kitech-custom-table th,
body:not(.theme-light) .admin-table th {
  background: #18284c !important;
  color: #cbd5e1 !important;
  border-bottom: 1px solid #23355d !important;
}

body:not(.theme-light) .table td,
body:not(.theme-light) .kitech-custom-table td,
body:not(.theme-light) .admin-table td {
  background: transparent !important;
  color: #f1f5f9 !important;
  border-bottom: 1px solid #1e315d !important;
}

body:not(.theme-light) .table tr:hover td,
body:not(.theme-light) .kitech-custom-table tr:hover td,
body:not(.theme-light) .admin-table tr:hover td {
  background: rgba(30, 49, 93, 0.5) !important;
}

/* Dark Mode Panels & Cards (Crisp, High Contrast, No Over-glow) */
body:not(.theme-light) .erp-panel,
body:not(.theme-light) .erp-filter-bar,
body:not(.theme-light) .admin-table-wrap,
body:not(.theme-light) .kitech-members-table-wrap {
  background: #131f3b !important;
  border: 1px solid #23355d !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

body:not(.theme-light) .erp-kpi-card {
  background: #131f3b !important;
  border: 1px solid #23355d !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
  padding: 10px 12px !important;
}

body:not(.theme-light) .erp-kpi-val {
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 18px !important;
}

body:not(.theme-light) .erp-kpi-lbl {
  color: #cbd5e1 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.02em !important;
}

body:not(.theme-light) .erp-kpi-sub {
  color: #94a3b8 !important;
  font-size: 10.5px !important;
}

body:not(.theme-light) .weather-card {
  background: #131f3b !important;
  border: 1px solid #23355d !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* Light Theme Overrides */
body.theme-light .topbar,
body.theme-light .topbar-clock-time,
body.theme-light .topbar-clock-date {
  color: #0f172a !important;
}

body.theme-light .kitech-page-top-header .page-main-title,
body.theme-light .ind-root .page-main-title,
body.theme-light .ind-root .erp-panel-title,
body.theme-light .ind-root strong {
  color: #0f172a !important;
}

body.theme-light .kitech-page-top-header .page-sub-title,
body.theme-light .erp-sub-txt {
  color: #475569 !important;
}

body.theme-light .erp-panel,
body.theme-light .erp-filter-bar,
body.theme-light .erp-panel-head,
body.theme-light .ind-machine-chip,
body.theme-light .erp-kpi-card,
body.theme-light .admin-table-wrap,
body.theme-light .weather-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

body.theme-light .erp-kpi-card {
  padding: 10px 12px !important;
}

body.theme-light .erp-kpi-val {
  color: #0f172a !important;
  font-weight: 700 !important;
  font-size: 18px !important;
}

body.theme-light .erp-kpi-lbl {
  color: #475569 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.02em !important;
}

body.theme-light .erp-kpi-sub {
  color: #64748b !important;
  font-size: 10.5px !important;
}

body.theme-light .kitech-custom-table {
  background: #ffffff !important;
  color: #0f172a !important;
}

body.theme-light .kitech-custom-table th {
  background: #f8fafc !important;
  color: #475569 !important;
  border-bottom: 1px solid #cbd5e1 !important;
}

body.theme-light .kitech-custom-table td {
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.theme-light .ind-root .btn.secondary,
body.theme-light .ind-root .btn.ghost,
body.theme-light .erp-panel .btn.secondary,
body.theme-light .erp-panel .btn.ghost,
body.theme-light .erp-filter-bar .btn.secondary,
body.theme-light .erp-filter-bar .btn.ghost {
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  background: #f8fafc !important;
}

body.theme-light .ind-root input:not([type="checkbox"]):not([type="radio"]),
body.theme-light .ind-root select:not(.topbar-home-select),
body.theme-light .ind-root textarea,
body.theme-light .erp-filter-bar input,
body.theme-light .erp-filter-bar select {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
}

/* Anti-Overflow & Mobile/PC 60fps Smoothness Polish */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}
button, a, select, input, [role="switch"], .btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.erp-panel, .ind-area-column {
  contain: layout style;
}

.table-wrap, .kitech-members-table-wrap, .admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile & PC Modal / Dialog & Topbar Safety */
dialog.dialog {
  width: min(560px, calc(100vw - 20px)) !important;
  max-width: calc(100vw - 20px) !important;
  max-height: 90dvh !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
}
@media (max-width: 768px) {
  .ind-topbar-selectors {
    max-width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .ind-topbar-selectors select {
    max-width: 100% !important;
    min-width: 0 !important;
  }
}
