/* assets/css/style.css - central styles for QC INSPECTION */

:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 70px;
  --navbar-height: 56px;
}

/* Reset and base */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  background: #f5f7fa;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    "Helvetica Neue",
    Arial;
  /* make page a column so footer can be pushed to bottom when content short */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Container layout */
.container-fluid.content-wrapper {
  padding: 8px 14px;
  margin-top: 0;
}

/* Sidebar */
.sidebar-container {
  width: var(--sidebar-width);
  position: fixed; /* fixed overlay to avoid shifting main content */
  left: 0;
  top: var(--navbar-height);
  max-height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  padding-right: 10px;
  background: transparent; /* dark bg handled by .bg-dark */
  transform: translateX(0);
  transition:
    transform 0.25s ease,
    width 0.25s ease;
  z-index: 1040;
}
.sidebar-brand {
  min-height: 42px;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease, min-height 0.2s ease;
}
.sidebar-container .nav-link {
  border-radius: 6px;
  padding: 10px;
  color: rgba(255, 255, 255, 0.95);
}
.sidebar-container .nav-link i {
  width: 18px;
  text-align: center;
}
.sidebar-section {
  margin-top: 0.45rem;
}
.sidebar-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  color: #e9ecef;
  background: transparent;
  font-weight: 600;
  text-align: left;
}
.sidebar-section-toggle:hover,
.sidebar-section.is-open > .sidebar-section-toggle {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.section-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.sidebar-section.is-open .section-chevron {
  transform: rotate(180deg);
}
.sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  margin: 0.25rem 0 0.5rem;
  padding: 0 0 0 0.6rem;
  list-style: none;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  transition: max-height 0.25s ease, opacity 0.2s ease;
  opacity: 0;
}
.sidebar-section.is-open .sidebar-submenu {
  max-height: 500px;
  opacity: 1;
}
.sidebar-submenu .nav-link {
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.78) !important;
  font-size: 0.92rem;
}
.sidebar-submenu .nav-link:hover,
.sidebar-submenu .nav-link.active {
  color: #fff !important;
  background: rgba(13, 110, 253, 0.72);
}
.sidebar-section + .nav-item.mt-3 {
  margin-top: 1rem !important;
}
.sidebar-container .nav-label {
  transition: opacity 0.15s ease-in-out;
}

/* Collapsed sidebar state on body */
.sidebar-collapsed .sidebar-container {
  width: var(--sidebar-collapsed-width) !important;
  padding-left: 10px !important;
  padding-right: 10px !important;
  overflow-x: visible;
  transform: none !important;
}
.sidebar-collapsed .sidebar-brand {
  min-height: 0;
  opacity: 0;
  margin-bottom: 0 !important;
}
.sidebar-collapsed .sidebar-container .nav-link,
.sidebar-collapsed .sidebar-section-toggle {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}
.sidebar-collapsed .sidebar-container > .nav {
  width: 100%;
}
.sidebar-collapsed .sidebar-container > .nav > .nav-item {
  width: 100%;
}
.sidebar-collapsed .sidebar-container .nav-link i,
.sidebar-collapsed .sidebar-section-toggle > span > i,
.sidebar-collapsed .sidebar-other-title strong > i {
  width: 20px;
  min-width: 20px;
  margin: 0 !important;
  text-align: center;
}
.sidebar-collapsed .sidebar-other-title {
  text-align: center;
}
.sidebar-collapsed .sidebar-other-title strong {
  display: block;
  padding-left: 0 !important;
}
.sidebar-collapsed .sidebar-other-title strong > i {
  font-size: 1rem;
}
.sidebar-collapsed .sidebar-section-toggle {
  font-size: 0;
}
.sidebar-collapsed .sidebar-section-toggle > span {
  display: flex;
  justify-content: center;
}
.sidebar-collapsed .sidebar-section-toggle > span > i {
  font-size: 1rem;
}
.sidebar-collapsed .sidebar-section {
  position: relative;
}
.sidebar-collapsed .sidebar-section.is-open .sidebar-submenu {
  position: fixed;
  top: var(--sidebar-flyout-top, calc(var(--navbar-height) + 8px));
  left: calc(var(--sidebar-collapsed-width) + 8px);
  width: 224px;
  max-height: calc(100vh - var(--navbar-height) - 20px);
  overflow-y: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 3px solid #0d6efd;
  border-radius: 0 8px 8px 0;
  background: #212529;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  z-index: 1200;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}
.sidebar-collapsed .sidebar-section:not(.is-open) .sidebar-submenu {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}
.sidebar-collapsed .sidebar-section.is-open .sidebar-section-toggle {
  background: rgba(255, 255, 255, 0.12);
}
.sidebar-collapsed .sidebar-submenu .nav-label {
  display: inline;
  width: auto;
  opacity: 1;
  visibility: visible;
  margin-left: 0.5rem !important;
}
.sidebar-collapsed .sidebar-submenu .nav-link {
  justify-content: flex-start;
  text-align: left;
}
.sidebar-collapsed .sidebar-submenu .nav-link i {
  flex: 0 0 20px;
}
.sidebar-collapsed .section-chevron,
.sidebar-collapsed .sidebar-container .text-muted {
  display: none;
}
.sidebar-collapsed .sidebar-container .mt-4 {
  position: fixed;
  top: auto;
  bottom: 16px;
  left: 18px;
  margin-top: 0 !important;
  z-index: 1050;
}
.sidebar-collapsed .sidebar-container .mt-4 .btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-collapsed .nav-label {
  display: none;
  width: 0;
  margin-left: 0 !important;
}

/* Main content */
.main-content {
  transition:
    padding-left 0.2s ease,
    transform 0.2s ease;
  padding-top: 6px;
  margin-top: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
@media (min-width: 768px) {
  /* For desktop: when sidebar is visible, add left padding so content not covered; when collapsed remove padding */
  body:not(.sidebar-collapsed) .main-content {
    padding-left: var(--sidebar-width);
  }
  .sidebar-collapsed .main-content {
    padding-left: var(--sidebar-collapsed-width);
  }
  .main-content {
    margin-left: 0;
    width: 100%;
  }
}
/* Ensure main content does not overlap navbar */
.main-content {
  transform: none !important;
}
@media (max-width: 767.98px) {
  .main-content {
    transform: none !important;
  }
}
/* Reset possible Bootstrap utility margins that cause gaps */
.container-fluid.content-wrapper {
  padding-top: 0 !important;
}
.row.mt-3,
.row.mt-4,
.row.mt-2 {
  margin-top: 0 !important;
}
.h-100 {
  min-height: unset !important;
}

/* Ensure content fills viewport and starts at top */
.main-content > * {
  margin-top: 0;
}
.main-content h1,
.main-content h2,
.main-content h3,
.main-content h4,
.main-content h5,
.main-content h6 {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
.main-content .row,
.main-content .card {
  margin-top: 0;
}

/* Force rows align top to avoid vertical centering */
.row {
  align-items: flex-start;
}

/* Mobile off-canvas */
.sidebar-container {
  left: 0;
}
@media (max-width: 767.98px) {
  .sidebar-container {
    position: fixed;
    left: -300px;
    top: var(--navbar-height);
    width: 240px;
    z-index: 1040;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    transform: translateX(0) !important;
  }
  .sidebar-container.show-mobile {
    left: 0;
  }
  .sidebar-collapsed .sidebar-container {
    left: -300px;
    width: 240px !important;
    overflow-x: hidden;
  }
  .sidebar-collapsed .sidebar-container.show-mobile {
    left: 0;
  }
  .sidebar-collapsed .sidebar-brand {
    min-height: 42px;
    opacity: 1;
    margin-bottom: 1rem !important;
  }
  .sidebar-collapsed .sidebar-container .nav-link,
  .sidebar-collapsed .sidebar-section-toggle {
    width: 100%;
    height: auto;
    display: flex;
    justify-content: flex-start;
    padding: 10px;
  }
  .sidebar-collapsed .sidebar-section-toggle {
    font-size: inherit;
    justify-content: space-between;
  }
  .sidebar-collapsed .sidebar-section-toggle > span {
    display: inline;
  }
  .sidebar-collapsed .sidebar-section-toggle > span > i {
    font-size: inherit;
  }
  .sidebar-collapsed .section-chevron {
    display: inline-block;
  }
  .sidebar-collapsed .sidebar-section:not(.is-open) .sidebar-submenu,
  .sidebar-collapsed .sidebar-section.is-open .sidebar-submenu {
    position: static;
    display: block;
    width: auto;
    max-height: 500px;
    overflow: hidden;
    margin: 0.25rem 0 0.5rem;
    padding: 0 0 0 0.6rem;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .sidebar-collapsed .sidebar-section:not(.is-open) .sidebar-submenu {
    display: none;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .sidebar-collapsed .sidebar-submenu .nav-label,
  .sidebar-collapsed .nav-label {
    display: inline;
    width: auto;
    opacity: 1;
    visibility: visible;
    margin-left: 0.5rem !important;
  }
  .sidebar-collapsed .sidebar-container .nav-link {
    text-align: left;
  }
  .sidebar-collapsed .sidebar-container .nav-link i,
  .sidebar-collapsed .sidebar-section-toggle > span > i {
    width: 20px;
    min-width: 20px;
    margin: 0 !important;
    text-align: center;
  }
  .sidebar-collapsed .sidebar-other-title {
    text-align: left;
  }
  .sidebar-collapsed .sidebar-other-title strong {
    display: inline;
    padding-left: 0.5rem !important;
  }
  .sidebar-collapsed .sidebar-container .mt-4 {
    position: static;
    margin-top: 1.5rem !important;
  }
  .main-content {
    margin-left: 0;
  }
}

/* Small UI tweaks */
.navbar {
  margin-bottom: 0;
  position: fixed; /* keep navbar fixed on top */
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100; /* ensure navbar is above other fixed elements */
}

/* Ensure page content starts below fixed navbar (increased to avoid overlap) */
.content-wrapper {
  padding-top: calc(
    var(--navbar-height) + 40px
  ); /* increased space so main content fully visible */
}

/* Ensure main-content itself also has a top padding to separate from navbar */
.main-content {
  padding-top: 70px; /* inner spacing increased */
}

/* Utility: ensure no big gap from cards */
.card {
  margin-bottom: 12px;
}

/* Improve scrollbar look (optional) */
.sidebar-container::-webkit-scrollbar {
  width: 8px;
}
.sidebar-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
}

/* Header & utility styles moved from includes/header.php */
.navbar-brand {
  font-weight: 700;
}
/* Final content-wrapper: increased top spacing so main content not hidden by fixed navbar */
.content-wrapper {
  padding-top: 490px; /* lowered further by additional 50px as requested */
  padding-left: 12px;
  padding-right: 12px;
  margin-top: 0;
  flex: 1 0 auto; /* allow content to grow and push footer down */
}

/* Ensure footer stays at bottom */
footer {
  flex-shrink: 0;
}

/* Footer inner alignment: keep text centered and width aligned with main content */
.footer-inner {
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  margin: 0 auto;
  text-align: center; /* center text */
}

/* When sidebar is visible on desktop, offset footer inner so it doesn't sit under sidebar */
@media (min-width: 768px) {
  body:not(.sidebar-collapsed) .footer-inner {
    margin-left: var(--sidebar-width);
    max-width: calc(100% - var(--sidebar-width));
    padding-left: 12px;
    padding-right: 12px;
  }
  .sidebar-collapsed .footer-inner {
    margin-left: 0;
    max-width: 100%;
  }
}

/* smaller screens: footer full width centered */
@media (max-width: 767.98px) {
  .footer-inner {
    margin-left: 0;
    max-width: 100%;
  }
}

/* Auth page wrapper moved from includes/header_simple.php */
body,
html {
  height: 100%;
}
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile sidebar positioning (ensure consistent behavior) */
@media (max-width: 767.98px) {
  .sidebar-container {
    position: fixed;
    z-index: 1040;
    left: -260px;
    top: 56px;
  }
  .sidebar-container.show-mobile {
    left: 0;
  }
}

/* --------------------------------------------------
   Standard container & component styles (global)
   -------------------------------------------------- */

/* Page containers */
.container {
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 15px;
  padding-right: 15px;
}

.container-fluid {
  width: 100%;
  padding-left: 12px;
  padding-right: 12px;
}

/* Reusable inner wrapper that aligns with main content width */
.content-inner {
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

/* Section / page heading */
.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2d3d;
  margin-bottom: 12px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-subtitle {
  color: #6c757d;
  font-size: 0.95rem;
}

.page-main-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1f2d3d;
  margin: 0;
}

.page-toolbar {
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.dashboard-filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-filter-submit {
  flex: 1 1 auto;
  min-height: 42px;
}

.dashboard-filter-reset {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.dashboard-filter-reset i {
  margin: 0;
}

.header-top {
  margin-bottom: 1rem;
}

.header-top h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1f2d3d;
  margin: 0;
}

.page-header {
  margin-bottom: 1.25rem;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  color: #1f2d3d;
  margin: 0 0 0.35rem;
}

.page-header p {
  margin: 0;
  font-size: 0.98rem;
  color: #6c757d;
}

@media (max-width: 767.98px) {
  .page-main-title,
  .header-top h1 {
    font-size: 1.6rem;
  }

  .page-header h2 {
    font-size: 1.25rem;
  }
}

/* Cards */
.card {
  border-radius: 8px;
  border: 1px solid rgba(16, 24, 32, 0.06);
  box-shadow: 0 1px 1px rgba(16, 24, 32, 0.04);
  background: #ffffff;
}
.card .card-body {
  padding: 16px;
}
.card .card-footer {
  padding: 12px 16px;
  background: transparent;
  border-top: 1px solid rgba(16, 24, 32, 0.04);
}

/* Keep tank-photo session content readable over the shared theme. */
.tank-photo-page {
  color: #212529;
}
.tank-photo-page .card-header {
  color: #212529 !important;
  background-color: #e9ecef !important;
  border-bottom-color: #ced4da;
}
.tank-photo-page .card-header h5,
.tank-photo-page .card-header h6 {
  color: #212529 !important;
}
.tank-photo-page .table thead.table-dark th,
.tank-photo-page .table thead th {
  background-color: #343a40 !important;
  color: #ffffff !important;
  border-color: #495057 !important;
}
.table thead.table-dark th {
  background-color: #343a40 !important;
  color: #ffffff !important;
  border-color: #495057 !important;
}
.table thead.table-light th,
#checklistTable thead th {
  background-color: #e9ecef !important;
  color: #212529 !important;
  border-color: #ced4da !important;
}
.tank-photo-page .text-muted {
  color: #5c636a !important;
}
.tank-photo-page label,
.tank-photo-page strong,
.tank-photo-page small {
  color: #212529;
}

/* Forms */
.form-control {
  border-radius: 6px;
  box-shadow: none !important;
  border: 1px solid #dfe4ea;
  padding: 8px 10px;
}
.form-control:focus {
  outline: none;
  box-shadow: none !important;
  border-color: #6c757d;
}
.form-label {
  font-weight: 600;
}

/* Buttons */
.btn {
  border-radius: 6px;
}
.btn-primary {
  background-color: #0d6efd;
  border-color: #0d6efd;
}
.btn-secondary {
  background-color: #6c757d;
  border-color: #6c757d;
}

/* Tables */
.table {
  background: #fff;
  border-color: #cfd4da;
  color: #212529;
}
.table thead th {
  background: #f8f9fa;
  color: #212529;
  font-weight: 600;
  border-bottom: 2px solid #adb5bd;
}
.table tbody tr td {
  vertical-align: middle;
  border-color: #dee2e6;
}
.table tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}
.table tbody tr:hover {
  background-color: #e9f2ff;
}
.table.table-hover > tbody > tr:hover > * {
  background-color: #e9f2ff !important;
  color: #212529;
}
.table.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: #ffffff;
  color: #212529;
}
.table.table-striped > tbody > tr:nth-of-type(even) > * {
  --bs-table-accent-bg: #f8f9fa;
  color: #212529;
}
.table thead.table-dark th {
  background-color: #343a40 !important;
  color: #ffffff !important;
  border-color: #495057 !important;
}
.table thead.table-light th {
  background-color: #e9ecef !important;
  color: #212529 !important;
  border-color: #ced4da !important;
}
.table-responsive {
  overflow-x: auto;
}

/* Utilities */
.text-muted-2 {
  color: #6c757d;
}
.center {
  text-align: center;
}

/* Small screens adjustments for containers */
@media (max-width: 767.98px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }
  .content-inner {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Dashboard layout: the trend gets the full width, analysis cards follow below. */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 270px 270px;
  grid-template-areas: "trend right-top" "pareto right-bottom";
  gap: 16px;
  align-items: stretch;
}
.grid-trend {
  grid-area: trend;
}
.grid-pareto {
  grid-area: pareto;
}
.grid-right {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  height: 100%;
}
.grid-right {
  display: contents;
}
.grid-right .card-okng {
  grid-area: right-top;
}
.grid-right .card-topdefect {
  grid-area: right-bottom;
}

/* ensure pareto sits below trend but aligns with top of right column content */
.card-pareto {
  margin: 0;
}

/* End dashboard grid */

/* Card sizing helpers for dashboard */
.card {
  --card-width: 100%;
  --card-height: 200px;
  width: var(--card-width);
  min-height: var(--card-height);
}

.card-stats {
  --card-height: 110px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(13, 110, 253, 0.08);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  border-radius: 14px;
  overflow: hidden;
}
.card-stats .card-body {
  padding: 14px 16px;
  width: 100%;
}
.card-stats .card-body h6 {
  margin: 0;
  font-size: 0.86rem;
  color: #6c757d;
  font-weight: 600;
}
.card-stats .card-body h3 {
  margin: 8px 0 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2d3d;
}

.card-trend {
  --card-height: 0;
}
.card-trend .card-body {
  padding: 18px;
}

.card-okng {
  --card-height: 0;
}
.card-topdefect {
  --card-height: 0;
  max-height: 260px;
  overflow-y: auto;
}
.card-topdefect .list-group-item {
  border: none;
  padding-left: 0;
  padding-right: 0;
}

.card-pareto {
  --card-height: 0;
}
.card-summary {
  --card-height: 0;
}

.card-trend,
.card-okng,
.card-topdefect,
.card-pareto,
.card-summary {
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.dashboard-grid > * {
  min-width: 0;
}
.dashboard-grid .card {
  height: auto;
  min-height: 0;
}
.grid-trend .card,
.grid-pareto .card,
.grid-right .card {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.dashboard-grid canvas {
  max-width: 100%;
  display: block;
}
.dashboard-grid #trendChart {
  height: 190px !important;
}
.dashboard-grid #paretoChart {
  height: 180px !important;
}
.dashboard-grid #okngChart {
  height: 170px !important;
}
.grid-right .card {
  flex: none;
}
.grid-right .card-summary,
.grid-right .card-topdefect {
  min-height: 0;
}
.dashboard-stat-grid {
  row-gap: 16px;
}
.dashboard-stat-grid > [class*="col-"] {
  display: flex;
}
.dashboard-stat-grid .card-stats {
  width: 100%;
}
.dashboard-visual-section {
  margin-bottom: 24px;
}
.dashboard-summary-section {
  margin-bottom: 24px;
}
.dashboard-summary-grid {
  width: 100%;
  box-sizing: border-box;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding-right: 2px;
}
.dashboard-summary-grid .dashboard-summary-item {
  box-sizing: border-box;
  min-height: 84px;
  min-width: 0;
  width: 100%;
  justify-self: stretch;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 0.75rem;
  border: 1px solid #adb5bd;
  border-radius: 8px;
  overflow: hidden;
}
.dashboard-summary-grid .dashboard-summary-item .summary-label {
  color: #6c757d;
  font-size: 0.9rem;
  line-height: 1.35;
}
.dashboard-summary-grid .dashboard-summary-item strong {
  display: block;
  margin-top: 0.35rem;
  line-height: 1.25;
  text-align: center;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.dashboard-summary-grid .dashboard-summary-item:last-child {
  border-bottom: 1px solid #adb5bd;
  padding-bottom: 0.75rem;
}

.dashboard-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.dashboard-card-header h6 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1f2d3d;
}

.dashboard-mini-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.mini-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.mini-stat-chip-primary {
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
}

.mini-stat-chip-success {
  background: rgba(25, 135, 84, 0.14);
  color: #198754;
}

.mini-stat-chip-danger {
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}

.mini-stat-chip-warning {
  background: rgba(255, 193, 7, 0.18);
  color: #946200;
}

.mini-stat-chip-info {
  background: rgba(13, 202, 240, 0.16);
  color: #0b7285;
}

.mini-stat-chip-neutral {
  background: rgba(108, 117, 125, 0.12);
  color: #495057;
}

.dashboard-summary-list {
  display: grid;
  gap: 0.75rem;
}

.dashboard-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed rgba(108, 117, 125, 0.24);
}

.dashboard-summary-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dashboard-summary-item .summary-label {
  color: #6c757d;
  font-size: 0.9rem;
}

.card-stats-today {
  background: linear-gradient(
    135deg,
    rgba(13, 110, 253, 0.08),
    rgba(13, 110, 253, 0.02)
  );
}

.card-stats-month {
  background: linear-gradient(
    135deg,
    rgba(13, 202, 240, 0.1),
    rgba(13, 202, 240, 0.02)
  );
}

.card-stats-ok {
  background: linear-gradient(
    135deg,
    rgba(25, 135, 84, 0.1),
    rgba(25, 135, 84, 0.02)
  );
}

.card-stats-ng {
  background: linear-gradient(
    135deg,
    rgba(220, 53, 69, 0.1),
    rgba(220, 53, 69, 0.02)
  );
}

.card-stats-hold {
  background: linear-gradient(
    135deg,
    rgba(255, 193, 7, 0.14),
    rgba(255, 193, 7, 0.03)
  );
}

.card-stats-rate {
  background: linear-gradient(
    135deg,
    rgba(111, 66, 193, 0.1),
    rgba(111, 66, 193, 0.02)
  );
}

/* Easy size override examples
   Set custom height/width on a specific card instance using inline style or extra class:
   .card-custom { --card-width: 540px; --card-height: 260px; }
*/
.card-custom {
  --card-width: 100%;
  --card-height: 220px;
}

/* Responsive tweaks: reduce heights on small screens */
@media (max-width: 767.98px) {
  .card-trend {
    --card-height: 220px;
  }
  .card-okng,
  .card-topdefect,
  .card-pareto,
  .card-summary {
    --card-height: 200px;
  }
  .card-stats {
    --card-height: 100px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "trend"
      "pareto"
      "right-top"
      "right-bottom";
  }
  .grid-right {
    display: contents;
    height: auto;
  }
  .grid-right .card {
    height: auto;
    min-height: 0;
  }
  .dashboard-summary-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-card-header {
    flex-direction: column;
  }
  .dashboard-mini-stats {
    justify-content: flex-start;
  }
}

/* End of standard container & components */

/* ===== INSPECTION CHECKLIST TABLE STYLES ===== */
/* Responsive table wrapper with horizontal scroll */
.inspection-checklist-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Inspection checklist table - set minimum widths per column to prevent content cutoff */
table#checklistTable {
  min-width: 1500px !important;
  margin-bottom: 0;
  width: 100%;
  border-collapse: collapse;
}

/* Checklist table header and cells - define proportional widths */
#checklistTable thead th {
  font-weight: 600;
  white-space: nowrap;
  padding: 10px 8px;
  font-size: 0.9rem;
}

#checklistTable tbody td {
  padding: 8px 6px;
  vertical-align: middle;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Column-specific widths for checklist table - using explicit pixel values */
#checklistTable th:nth-child(1),
#checklistTable td:nth-child(1) {
  width: 40px;
  min-width: 40px;
  text-align: center;
}

#checklistTable th:nth-child(2),
#checklistTable td:nth-child(2) {
  width: 150px;
  min-width: 150px;
}

#checklistTable th:nth-child(3),
#checklistTable td:nth-child(3) {
  width: 140px;
  min-width: 140px;
}

#checklistTable th:nth-child(4),
#checklistTable td:nth-child(4) {
  width: 110px;
  min-width: 110px;
}

#checklistTable th:nth-child(5),
#checklistTable td:nth-child(5) {
  width: 90px;
  min-width: 90px;
}

#checklistTable th:nth-child(6),
#checklistTable td:nth-child(6) {
  width: 130px;
  min-width: 130px;
}

#checklistTable th:nth-child(7),
#checklistTable td:nth-child(7) {
  width: 110px;
  min-width: 110px;
}

#checklistTable th:nth-child(8),
#checklistTable td:nth-child(8) {
  width: 160px;
  min-width: 160px;
}

#checklistTable th:nth-child(9),
#checklistTable td:nth-child(9) {
  width: 150px;
  min-width: 150px;
}

/* Form controls inside table cells - optimize for space */
#checklistTable .form-control,
#checklistTable .form-control-sm,
#checklistTable select,
#checklistTable input {
  width: 100%;
  padding: 6px 4px;
  font-size: 0.875rem;
  border: 1px solid #dee2e6;
  border-radius: 3px;
}

/* File input button styling in table */
#checklistTable .btn-sm,
#checklistTable input[type="file"] {
  font-size: 0.75rem;
  padding: 4px 6px;
}

/* Badge/result styling */
#checklistTable .result-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Hover effect on rows */
#checklistTable tbody tr:hover {
  background-color: #f8f9fa;
}

/* Striped rows */
#checklistTable tbody tr:nth-child(odd) {
  background-color: #ffffff;
}

#checklistTable tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

/* Responsive adjustments for checklist table on small screens */
@media (max-width: 1199px) {
  #checklistTable {
    min-width: 1000px;
    font-size: 0.875rem;
  }

  #checklistTable thead th,
  #checklistTable td {
    padding: 6px 4px;
  }
}

@media (max-width: 768px) {
  .inspection-checklist-wrapper {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
    margin-left: -12px;
    margin-right: -12px;
    width: calc(100% + 24px);
  }

  #checklistTable {
    min-width: 900px;
    font-size: 0.8rem;
  }

  #checklistTable thead th,
  #checklistTable td {
    padding: 5px 3px;
  }

  #checklistTable .form-control,
  #checklistTable select {
    font-size: 0.75rem;
  }
}
/* ===== END INSPECTION CHECKLIST TABLE STYLES ===== */
