/* ============================================================
   CADIVI ADMIN UI STYLES
   Admin-only file. Do not edit employee UI here.
   ============================================================ */

/* Admin Shell Layout */
.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 55;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--green-dark) 0%, var(--green-deep) 100%);
  color: #ffffff;
  box-shadow: 4px 0 24px rgba(5, 47, 33, 0.15);
  transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
}

.sidebar-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--green-dark);
  font-weight: 900;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-brand-text small {
  color: #aedabf;
  font-size: 9px;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.sidebar-nav {
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #d2ede0;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: background var(--transition-speed), color var(--transition-speed);
}

.sidebar-nav a:hover, .sidebar-nav a.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-nav a.is-active {
  background: var(--green);
  box-shadow: inset 3px 0 0 #8ee08e;
}

.sidebar-nav span.icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav span.icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-readonly {
  padding: 12px;
  margin: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
}

.sidebar-readonly strong {
  display: block;
  color: #ffffff;
  margin-bottom: 2px;
}

.sidebar-readonly span {
  color: #aedabf;
}

/* Topbar styles */
.admin-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 40;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(5, 47, 33, 0.03);
  transition: left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-topbar .top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: var(--green-dark);
  background: var(--pale);
  cursor: pointer;
  transition: background var(--transition-speed);
}

.sidebar-toggle:hover {
  background: #e2eae3;
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.topbar-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.topbar-copy h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--green-dark);
}

.topbar-copy p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-desktop-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--green-dark);
  background: #e2eae3;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
}

/* Main Layout Area */
.admin-main {
  margin-left: var(--sidebar-width);
  padding: 76px 24px 40px; /* 56px topbar height + 20px gap */
  min-height: 100dvh;
  transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.admin-head-copy {
  display: flex;
  flex-direction: column;
}

.admin-head-copy h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--green-dark);
}

.admin-head-copy p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.admin-main-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.readonly-badge {
  font-size: 12px;
  font-weight: 700;
  color: #1e4620;
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  padding: 6px 12px;
  border-radius: 99px;
}

/* Filter Panel Section */
.admin-filter-card {
  padding: 16px;
}

.desktop-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.desktop-section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-dark);
}

.desktop-section-head p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.filters.shift-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: flex-end;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.filter-actions .btn {
  height: 38px;
}

/* View Switching Structure */
.admin-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-view.hidden-view {
  display: none !important;
}

/* KPI Cards Layout */
.kpi-grid.admin-kpis {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 14px 14px 44px;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
  overflow: hidden;
}

.kpi-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--green);
}

.kpi:before {
  content: '';
  position: absolute;
  left: 12px;
  top: 14px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

/* KPI Colors and Icons */
.kpi-blue:before {
  background-color: #e0f2fe;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%230369a1' viewBox='0 0 24 24'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z'/%3E%3C/svg%3E");
}
.kpi-green:before {
  background-color: #dcfce7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2315803d' viewBox='0 0 24 24'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
}
.kpi-orange:before {
  background-color: #ffedd5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23c2410c' viewBox='0 0 24 24'%3E%3Cpath d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm3.3 14.88L11 13V7h1.5v5.25l4.01 2.39-.77 1.24z'/%3E%3C/svg%3E");
}
.kpi-red:before {
  background-color: #fee2e2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23b91c1c' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
}
.kpi-purple:before {
  background-color: #f3e8ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236b21a8' viewBox='0 0 24 24'%3E%3Cpath d='M19 13H5v-2h14v2z'/%3E%3C/svg%3E");
}
.kpi-teal:before {
  background-color: #ccfbf1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%230f766e' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.53c-.26-.81-1-1.4-1.9-1.4h-1v-3c0-.55-.45-1-1-1h-6v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.4z'/%3E%3C/svg%3E");
}

.kpi-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.kpi-value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1.1;
}

/* Charts Grid Styles */
.chart-grid.admin-charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.chart-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  min-height: 240px;
}

.chart-card .small-title {
  margin-bottom: 2px;
}

.chart-note {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Progress bar charts styles (Machines and Employees) */
.chart-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(70px, 1.2fr) minmax(80px, 2fr) 50px;
  gap: 8px;
  align-items: center;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background var(--transition-speed);
}

.chart-row:hover {
  background: var(--pale);
}

.chart-label {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--green-dark);
}

.chart-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--green-dark);
  text-align: right;
}

.chart-progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  background: #eaeee9;
  accent-color: var(--green);
}

.chart-progress::-webkit-progress-bar {
  background: #eaeee9;
  border-radius: 99px;
}

.chart-progress::-webkit-progress-value {
  background: var(--green);
  border-radius: 99px;
}

.chart-progress::-moz-progress-bar {
  background: var(--green);
  border-radius: 99px;
}

.chart-row:nth-child(even) .chart-progress {
  accent-color: #3b82f6;
}
.chart-row:nth-child(even) .chart-progress::-webkit-progress-value {
  background: #3b82f6;
}
.chart-row:nth-child(even) .chart-progress::-moz-progress-bar {
  background: #3b82f6;
}

.chart-empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
  font-size: 12px;
}

/* Donut chart layout elements (SVG charts) */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  flex-direction: row;
}

.donut-chart-container {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.donut-chart-container svg {
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 9px;
  color: var(--muted);
  line-height: 1.1;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.donut-center strong {
  display: block;
  font-size: 15px;
  color: var(--green-dark);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
  min-width: 0;
}

.donut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--ink);
  transition: background var(--transition-speed);
  cursor: pointer;
}

.donut-item:hover, .donut-item.is-selected {
  background: var(--pale);
}

.donut-item-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.donut-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-item-value {
  font-weight: 700;
  color: var(--green-dark);
  font-variant-numeric: tabular-nums;
}

.donut-hit-area {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  cursor: pointer;
}

.donut-detail {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: 160px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.donut-detail[hidden] {
  display: none;
}

.donut-detail > strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-dark);
  font-size: 12px;
}

.donut-detail > div {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  padding: 2px 0;
}

.donut-detail b {
  color: var(--ink);
}

/* Lower Dashboard Area & Overview Previews */
.admin-overview-lower {
  display: grid;
  grid-template-columns: minmax(0, 38fr) minmax(0, 62fr);
  gap: 16px;
}

.overview-employee-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.overview-employee-tools {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  padding: 10px;
  background: var(--pale);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.overview-upload-pane, .overview-search-pane {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.overview-upload-pane h3, .overview-search-pane h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--green-dark);
}

.overview-upload-row, .overview-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.overview-upload-row input[type=file] {
  flex-grow: 1;
  min-width: 0;
  min-height: 28px;
  padding: 4px;
  font-size: 11px;
  border-color: #cbd4cd;
  border-radius: 4px;
}

.overview-search-row input {
  flex-grow: 1;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
  border-color: #cbd4cd;
  border-radius: 4px;
}

.overview-upload-row .btn, .overview-search-row .btn {
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 4px;
}

.overview-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.overview-stat {
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.overview-stat-total { background: #e8f5e9; }
.overview-stat-active { background: #e3f2fd; }
.overview-stat-admin { background: #fff3e0; }

.overview-stat strong {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
}

.overview-stat-total strong { color: var(--green); }
.overview-stat-active strong { color: var(--blue); }
.overview-stat-admin strong { color: #e65100; }

.overview-stat span {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #abbcb0 #eaeee9;
}

.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  background: #eaeee9;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #abbcb0;
  border-radius: 99px;
}

.employee-preview-wrap {
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-y: auto;
}

/* Tables and directories style */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 8px 10px;
  background: #e2eae3;
  color: var(--green-dark);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  line-height: 1.35;
}

tbody tr:nth-child(even) {
  background: #fbfdfb;
}

tbody tr:hover {
  background: #edf5ef;
}

/* Specific view configurations (Report and Logs) */
.report-export-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.report-export-copy h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--green-dark);
}

.report-export-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.system-log-empty {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

/* Source Management (Catalogs & Directories) */
.source-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
}

.source-upload-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.source-catalogs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.source-catalogs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.catalog-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.catalog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.catalog-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
}

.catalog-badge {
  font-size: 10px;
  font-weight: 700;
  color: #1e4620;
  background: #e8f5e9;
  padding: 2px 6px;
  border-radius: 4px;
}

.catalog-item ul {
  margin: 0;
  padding-left: 16px;
  font-size: 11px;
  color: var(--muted);
}

/* Detailed Dialog Styles */
dialog {
  width: min(840px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  border: 0;
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow-lg);
  background: #ffffff;
  outline: none;
}

dialog::backdrop {
  background: rgba(5, 47, 33, 0.6);
  backdrop-filter: blur(2px);
}

.detail-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.detail-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--green-dark);
}

.detail-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.detail-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--pale);
  color: var(--green-dark);
  cursor: pointer;
  transition: background var(--transition-speed);
}

.detail-close:hover {
  background: #e2eae3;
}

.detail-close svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.detail-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100dvh - 120px);
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.detail-section:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.detail-section h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--green-dark);
  border-bottom: 1px solid var(--pale);
  padding-bottom: 4px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-item {
  border-radius: 6px;
  padding: 8px;
  background: var(--pale);
}

.detail-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-value {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
}

.detail-full {
  grid-column: 1 / -1;
}

/* Employee Directory Views */
.em-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.em-top-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
}

.em-upload-fields {
  display: flex;
  align-items: center;
  gap: 12px;
}

.em-file-input-wrapper {
  flex-grow: 1;
}

.em-file-input-wrapper input[type=file] {
  padding: 6px;
  font-size: 12px;
}

.em-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.em-search-field {
  flex-grow: 1;
}

.em-search-field input {
  height: 38px;
}

.em-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.em-stat-box {
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.em-stat-total { background: #e8f5e9; }
.em-stat-active { background: #e3f2fd; }
.em-stat-admins { background: #fff3e0; }

.em-stat-number {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.em-stat-total .em-stat-number { color: var(--green); }
.em-stat-active .em-stat-number { color: var(--blue); }
.em-stat-admins .em-stat-number { color: #e65100; }

.em-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 2px;
}

.employee-directory-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 440px;
  overflow-y: auto;
}

.em-table-card .employee-directory-table {
  min-width: 900px;
}

.admin-page .employee-directory-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #e2eae3;
}

.admin-page .employee-directory-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #ffffff;
}

.admin-page .employee-directory-table tbody tr:nth-child(even) td:first-child {
  background: #fbfdfb;
}

.admin-page .employee-directory-table tbody tr:hover td:first-child {
  background: #edf5ef;
}

.admin-page .employee-directory-table thead th:first-child {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 30;
  background: #e2eae3;
}

.employee-directory-table select {
  height: 32px;
  min-height: 32px;
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 6px;
}

.employee-directory-table input[type=checkbox] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--green);
}

/* Production record table views (Handover Records) */
.desktop-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--pale);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.desktop-table-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--green-dark);
}

.production-table-wrap {
  max-height: 60vh;
  overflow: auto;
}

.production-table {
  min-width: 2200px;
  table-layout: auto;
}

/* Sticky first 3 columns for production table */
.production-table th:first-child,
.production-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 90px;
  background: #ffffff;
}

.production-table th:nth-child(2),
.production-table td:nth-child(2) {
  position: sticky;
  left: 90px;
  z-index: 3;
  min-width: 70px;
  background: #ffffff;
}

.production-table th:nth-child(3),
.production-table td:nth-child(3) {
  position: sticky;
  left: 160px;
  z-index: 3;
  min-width: 60px;
  background: #ffffff;
  box-shadow: 4px 0 8px rgba(5, 47, 33, 0.08);
}

.production-table thead th:first-child,
.production-table thead th:nth-child(2),
.production-table thead th:nth-child(3) {
  z-index: 7;
  background: #e2eae3;
}

.production-table tbody tr:nth-child(even) td:first-child,
.production-table tbody tr:nth-child(even) td:nth-child(2),
.production-table tbody tr:nth-child(even) td:nth-child(3) {
  background: #fbfdfb;
}

.production-table tbody tr:hover td:first-child,
.production-table tbody tr:hover td:nth-child(2),
.production-table tbody tr:hover td:nth-child(3) {
  background: #edf5ef;
}

/* Sticky notes */
.keyboard-hint, .table-scroll-note {
  font-size: 11px;
  color: var(--muted);
  background: var(--pale);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Collapsed Sidebar overrides */
.admin-page.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width);
}

.admin-page.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 18px 0;
}

.admin-page.sidebar-collapsed .sidebar-brand-text,
.admin-page.sidebar-collapsed .sidebar-readonly {
  display: none;
}

.admin-page.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: 8px 0;
}

.admin-page.sidebar-collapsed .sidebar-nav a .sidebar-text {
  display: none;
}

/* Sidebar tooltip only on collapsed desktop */
.admin-page.sidebar-collapsed .sidebar-nav a[data-tooltip] {
  position: relative;
}

.admin-page.sidebar-collapsed .sidebar-nav a[data-tooltip]:hover:after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--green-deep);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

/* Admin Login Card */
.admin-page:has(#adminLogin:not(.hidden)) {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-deep) 100%);
  padding: 16px;
}

.login-card.admin-login-card {
  width: min(100%, 400px);
  padding: 28px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  border: none;
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--green);
  color: #ffffff;
  font-weight: 900;
  font-size: 24px;
  margin: 0 auto 12px;
  box-shadow: 0 4px 12px rgba(37, 122, 69, 0.3);
}

.login-brand h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--green-dark);
}

.login-brand p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Responsive Rules and Breakpoints */

/* Responsive: 1400px breakpoint */
@media (max-width: 1400px) {
  .kpi-grid.admin-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .chart-grid.admin-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-overview-lower {
    grid-template-columns: 1fr;
  }
}

/* Responsive: 1024px breakpoint */
@media (max-width: 1024px) {
  .filters.shift-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .em-top-row {
    grid-template-columns: 1fr;
  }
  .source-grid {
    grid-template-columns: 1fr;
  }
}

/* Responsive: Tablet / Mobile 900px breakpoint */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px;
  }
  
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-speed) ease;
    width: 240px;
  }
  
  .admin-page.sidebar-open .admin-sidebar {
    transform: translateX(0);
  }
  
  .admin-topbar {
    left: 0;
  }
  
  .admin-main {
    margin-left: 0;
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* Sidebar backdrop for mobile */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(5, 47, 33, 0.4);
    backdrop-filter: blur(2px);
  }
  
  .admin-page.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .filters.shift-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Responsive: Small Mobile 600px breakpoint */
@media (max-width: 600px) {
  .filters.shift-filters {
    grid-template-columns: 1fr;
  }
  .filter-actions {
    width: 100%;
  }
  .filter-actions .btn {
    flex-grow: 1;
  }
  .admin-page #dashboardOverviewView .kpi-grid.admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-page #dashboardOverviewView .chart-grid.admin-charts {
    grid-template-columns: 1fr;
  }
  .admin-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .admin-main-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .admin-main-actions .btn {
    flex-grow: 1;
  }
  .detail-content {
    grid-template-columns: 1fr;
  }
  
  /* Disable sticky headers/cols on tiny screens to avoid layout breaks */
  .production-table th:first-child,
  .production-table td:first-child,
  .production-table th:nth-child(2),
  .production-table td:nth-child(2),
  .production-table th:nth-child(3),
  .production-table td:nth-child(3) {
    position: static !important;
    box-shadow: none !important;
  }
}

/* ============================================================
   CADIVI ADMIN RESPONSIVE OVERRIDES (LATEST LAYOUT RULES)
   ============================================================ */

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --sidebar-width: 226px;
  --sidebar-collapsed-width: 70px;
}

/* Fix sidebar/topbar class matches & layout math */
.admin-topbar {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  left: 0 !important;
  right: auto !important;
  transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1),
              width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-main {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
  transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1),
              width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-page.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width);
}

.admin-page.sidebar-collapsed .sidebar-brand-copy,
.admin-page.sidebar-collapsed .sidebar-readonly {
  display: none !important;
}

.admin-page.sidebar-collapsed .sidebar-nav a .sidebar-label {
  display: none !important;
}

/* Prevent text clipping in critical elements */
.chart-label,
.th,
th,
.kpi-label,
.kpi-value {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-overflow: unset;
}

.chart-label {
  white-space: normal;
}

/* Overview Lower Grid ratio match */
.admin-overview-lower {
  display: grid;
  grid-template-columns: minmax(0, 38fr) minmax(0, 62fr);
  gap: 16px;
}

/* KPI Responsive Grid */
.kpi-grid.admin-kpis {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
}

/* Charts Responsive Grid */
.chart-grid.admin-charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* Filters Responsive Grid */
.filters.shift-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: flex-end;
}

/* Donut CSS match with JS .donut-chart */
.donut-chart {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Responsive Rules for Desktop -> Tablet -> Mobile */
@media (max-width: 1449px) {
  .kpi-grid.admin-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .chart-grid.admin-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .filters.shift-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .admin-page #dashboardOverviewView .admin-overview-lower {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px;
  }

  .admin-topbar,
  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 240px;
    transform: translateX(-100%);
    transition: transform var(--transition-speed) ease;
    z-index: 60;
  }

  .admin-page.sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-page #dashboardOverviewView .kpi-grid.admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters.shift-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-page #dashboardOverviewView .overview-employee-tools {
    grid-template-columns: 1fr;
  }
}

/* Prioritize overview preview columns on compact screens */
@media (max-width: 1100px) {
  .overview-record-card .production-table th:nth-child(7),
  .overview-record-card .production-table td:nth-child(7),
  .overview-record-card .production-table th:nth-child(12),
  .overview-record-card .production-table td:nth-child(12),
  .overview-record-card .production-table th:nth-child(13),
  .overview-record-card .production-table td:nth-child(13),
  .overview-record-card .production-table th:nth-child(14),
  .overview-record-card .production-table td:nth-child(14),
  .overview-record-card .production-table th:nth-child(16),
  .overview-record-card .production-table td:nth-child(16) {
    display: none;
  }
}

/* Card view on small mobile for overview handover preview */
@media (max-width: 640px) {
  .filters.shift-filters {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .filter-actions .btn {
    flex: 1 1 auto;
  }

  .admin-page #dashboardOverviewView .chart-grid.admin-charts {
    grid-template-columns: 1fr;
  }

  .overview-record-card .production-table,
  .overview-record-card .production-table thead,
  .overview-record-card .production-table tbody,
  .overview-record-card .production-table tr,
  .overview-record-card .production-table td {
    display: block;
    width: 100%;
  }

  .overview-record-card .production-table {
    min-width: 0 !important;
  }

  .overview-record-card .production-table thead {
    display: none;
  }

  .overview-record-card .production-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #ffffff;
  }

  .overview-record-card .production-table td {
    border-bottom: 1px solid var(--pale);
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
  }

  .overview-record-card .production-table td:last-child {
    border-bottom: 0;
    padding-top: 8px;
  }

  .overview-record-card .production-table td:before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    text-align: left;
    margin-right: 8px;
  }
}

/* ============================================================
   ADMIN-PAGE SCOPED FIXES — visual matching to CADIVI UI reference
   ============================================================ */

/* Page layout container and body settings */
.admin-page {
  overflow-x: hidden;
  background-color: #f4f7f4;
  color: #172019;
  
  /* Global Admin Design Tokens */
  --admin-sidebar: 185px;
  --admin-sidebar-collapsed: 70px;
  
  --admin-green-900: #063d28;
  --admin-green-800: #0b5132;
  --admin-green-700: #146638;
  --admin-green-600: #238044;
  
  --admin-bg: #f4f7f4;
  --admin-card: #ffffff;
  
  --admin-border: #dce5de;
  --admin-border-soft: #e8eee9;
  
  --admin-text: #172019;
  --admin-muted: #66736a;
  
  --admin-radius: 12px;
  --admin-radius-lg: 16px;
  
  --admin-shadow: 0 6px 20px rgba(20,55,30,.06);
  --admin-gap: 14px;
}

/* Override existing roots specifically for admin */
.admin-page {
  --sidebar-width: var(--admin-sidebar);
  --sidebar-collapsed-width: var(--admin-sidebar-collapsed);
}

/* Sidebar styling matching CADIVI Dark Forest Theme */
.admin-page .admin-sidebar {
  width: var(--sidebar-width);
  background: var(--admin-green-900);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  box-shadow: 4px 0 24px rgba(5, 47, 33, 0.15);
}

.admin-page .sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  padding: 12px 8px;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  text-decoration: none;
}

.admin-page.sidebar-collapsed .sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}

.admin-page .sidebar-brand-logo {
  display: block;
  width: 168px;
  height: 58px;
  object-fit: contain;
  object-position: center;
  background: transparent;
  padding: 0;
  border-radius: 0;
  transition: width .22s ease, height .22s ease, border-radius .22s ease, padding .22s ease;
}

.admin-page .sidebar-brand-logo.logo-compact {
  display: none;
}

.admin-page.sidebar-collapsed .sidebar-brand-logo.logo-full {
  display: none;
}

.admin-page.sidebar-collapsed .sidebar-brand-logo.logo-compact {
  display: block;
  width: 52px;
  height: 52px;
  min-width: 52px;
  max-width: 52px;
  padding: 0;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.admin-page .sidebar-nav a {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

/* Active item */
.admin-page .sidebar-nav a.is-active,
.admin-page .sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-radius: 10px;
  box-shadow: none;
}

/* Sidebar icons limit to 20px max */
.admin-page .sidebar-nav a > svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  max-width: 20px;
  flex: 0 0 20px;
  fill: currentColor;
}

.admin-page .sidebar-readonly {
  display: none !important; /* Hide read-only block inside sidebar */
}

/* 2. Topbar green background & compact 68px height */
.admin-page .admin-topbar {
  height: 58px;
  background: var(--admin-green-800);
  border-bottom: none;
  box-shadow: 0 4px 12px rgba(5, 47, 33, 0.15);
  color: #ffffff;
  left: 0 !important;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
}

.admin-page .admin-topbar .top-inner {
  padding: 0 24px;
  height: 100%;
}

.admin-page .admin-topbar .topbar-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  text-align: center;
}

.admin-page .admin-topbar .topbar-copy h1,
.admin-page .admin-topbar .topbar-copy .brand {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.admin-page .admin-topbar .topbar-copy p,
.admin-page .admin-topbar .topbar-copy .sub {
  font-size: 12px;
  color: #aedabf;
  margin: 1px 0 0;
}

.admin-page .admin-topbar .sidebar-toggle {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  width: 40px;
  height: 40px;
}

.admin-page .admin-topbar .sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.admin-page .admin-topbar .admin-desktop-label {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-page .admin-topbar .nav-btn {
  background: #ffffff;
  color: var(--admin-green-800);
  padding: 0 16px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  font-size: 13px;
  transition: opacity 0.15s ease;
}

.admin-page .admin-topbar .nav-btn:hover {
  opacity: 0.9;
}

/* Global Admin Card Settings */
.admin-page .card,
.admin-page .admin-filter-card,
.admin-page .chart-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
}

/* 3. Dashboard header above filters */
.admin-page .admin-main {
  padding: 68px 16px 10px; /* Space for 58px topbar + 10px margin */
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  gap: 6px;
}

.admin-page .admin-head {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-page .admin-head-copy {
  display: flex;
  flex-direction: column;
}

.admin-page .admin-head .eyebrow {
  display: none; /* Removed based on CADIVI design tokens */
}

.admin-page .admin-head h2,
.admin-page .admin-head .section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--admin-green-900);
  margin: 0;
  text-transform: none; /* Removed uppercase to match reference */
  line-height: 1.2;
}

.admin-page .admin-head p,
.admin-page .admin-head .section-note {
  font-size: 11px;
  color: var(--admin-muted);
  margin: 0;
  line-height: 1.2;
}

.admin-page .dashboard-update-note {
  font-size: 10px;
  color: var(--admin-green-600);
  margin-top: 1px;
  font-weight: 600;
  line-height: 1.2;
}

.admin-page .admin-main-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-page .readonly-badge {
  background: var(--admin-border-soft);
  color: var(--admin-green-800);
  border: 1px solid var(--admin-border);
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 4. Filters Row Layout on Desktop */
.admin-page .admin-filter-card {
  padding: 8px 10px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--admin-shadow);
  border: 1px solid var(--admin-border);
}

.admin-page .desktop-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--admin-border-soft);
}

.admin-page .section-icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-page .section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--admin-border-soft);
  color: var(--admin-green-700);
  border-radius: 6px;
  font-size: 14px;
}

.admin-page .desktop-section-head {
  margin-bottom: 4px;
  padding-bottom: 4px;
}

.admin-page .desktop-section-head h2 {
  font-size: 12px;
}

.admin-page .filters.shift-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 6px;
  align-items: flex-end;
}

.admin-page .filters.shift-filters .field label {
  font-size: 10px;
  margin-bottom: 2px;
  color: var(--admin-muted);
  font-weight: 600;
}

.admin-page .filters.shift-filters .field input,
.admin-page .filters.shift-filters .field select {
  height: 32px;
  min-height: 32px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 11px;
  padding: 0 8px;
}

.admin-page .filters.shift-filters .field input:focus,
.admin-page .filters.shift-filters .field select:focus {
  border-color: var(--admin-green-600);
  outline: none;
}

.admin-page .filters.shift-filters .filter-actions {
  display: flex;
  gap: 6px;
}

.admin-page .filters.shift-filters .filter-actions .btn {
  height: 32px;
  min-height: 32px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 0 12px;
}

/* Button overrides for Admin */
.admin-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.admin-page .btn-primary {
  background: var(--admin-green-700);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 4px rgba(20, 102, 56, 0.2);
}
.admin-page .btn-primary:hover {
  background: var(--admin-green-800);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(20, 102, 56, 0.25);
}

.admin-page .btn-secondary {
  background: #ffffff;
  color: var(--admin-text);
  border: 1px solid var(--admin-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.admin-page .btn-secondary:hover {
  background: var(--admin-border-soft);
  border-color: #cbd5ce;
}

.admin-page .btn-export {
  background: #ffffff;
  color: var(--admin-green-700);
  border: 1px solid var(--admin-green-700);
}
.admin-page .btn-export:hover {
  background: #f0fdf4;
}

/* 5. 8 KPIs in ONE Row on Desktop */
.admin-page #dashboardOverviewView {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.admin-page #dashboardOverviewView .admin-kpis {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

@media (min-width: 1450px) {
  .admin-page #dashboardOverviewView .admin-kpis {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

.admin-page #dashboardOverviewView .kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  min-height: 58px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--admin-shadow);
  border: 1px solid var(--admin-border);
  position: relative;
  overflow: hidden;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  max-height: none;
}

.admin-page #dashboardOverviewView .kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 55, 30, 0.08);
}

.admin-page .kpi:before {
  display: none; /* Disable pseudo icon background */
}

.admin-page .kpi-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-page .kpi-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.admin-page .kpi-icon svg {
  width: 14px !important;
  height: 14px !important;
  display: block;
  fill: currentColor;
  max-width: none !important;
  max-height: none !important;
}

.admin-page .kpi-blue .kpi-icon { background: #e0f2fe; color: #0369a1; }
.admin-page .kpi-green .kpi-icon { background: #dcfce7; color: #15803d; }
.admin-page .kpi-orange .kpi-icon { background: #ffedd5; color: #c2410c; }
.admin-page .kpi-red .kpi-icon { background: #fee2e2; color: #b91c1c; }
.admin-page .kpi-purple .kpi-icon { background: #f3e8ff; color: #6b21a8; }
.admin-page .kpi-teal .kpi-icon { background: #ccfbf1; color: #0f766e; }

.admin-page .kpi-copy {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.admin-page .kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--admin-muted);
  text-transform: none; /* Match reference */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-page #dashboardOverviewView .kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--admin-text);
  line-height: 1;
  margin-top: 2px;
}

.admin-page .kpi-note {
  display: none; /* Hide bottom notes inside small cards */
}

/* 6. 4 Charts in ONE Row on Desktop */
.admin-page #dashboardOverviewView .admin-charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

@media (min-width: 1450px) {
  .admin-page #dashboardOverviewView .admin-charts {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

.admin-page #dashboardOverviewView .chart-card {
  height: 160px;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--admin-border);
  box-shadow: var(--admin-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-page .chart-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.admin-page .chart-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-page .chart-mark-blue { background: #0369a1; }
.admin-page .chart-mark-green { background: #15803d; }
.admin-page .chart-mark-orange { background: #c2410c; }
.admin-page .chart-mark-purple { background: #6b21a8; }

.admin-page .chart-card .small-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0;
}

.admin-page .chart-note {
  margin-bottom: 6px;
}

.admin-page .chart-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-page .chart-row {
  min-width: 0;
  padding: 1px 4px;
  gap: 6px;
}

.admin-page .chart-label, .admin-page .chart-value {
  font-size: 10px;
}

.admin-page .chart-progress {
  height: 5px;
}

/* 7. Donut layouts: Donut left, Legend right */
.admin-page .donut-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row;
  flex: 1;
}

.admin-page #dashboardOverviewView .donut-chart {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.admin-page .donut-chart-container {
  width: 80px;
  height: 80px;
}

.admin-page .donut-center strong {
  font-size: 14px;
}

.admin-page .donut-legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
}

.admin-page .donut-item {
  width: 100%;
  border-radius: 4px;
  padding: 2px 4px;
  background: var(--pale);
  border: none;
  font-size: 9px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-page .donut-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
  margin-right: 6px;
  display: inline-block;
  flex-shrink: 0;
}

/* 8. 38/62 Bottom Layout Ratio */
.admin-page #dashboardOverviewView .admin-overview-lower {
  display: grid;
  grid-template-columns: minmax(0, 38fr) minmax(0, 62fr);
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.admin-page #dashboardOverviewView .admin-preview-card {
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
}

.admin-page .preview-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.admin-page .preview-kicker {
  font-size: 9px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-page .overview-card-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--green-dark);
  margin: 1px 0 0;
}

.admin-page .text-link {
  font-size: 9px;
  font-weight: 700;
  color: var(--green);
  background: none;
  border: none;
  cursor: pointer;
}

.admin-page #dashboardOverviewView .admin-preview-card {
  padding: 8px 10px;
}

.admin-page table {
  width: 100%;
  border-collapse: collapse;
}

.admin-page table th {
  background: #f7faf7;
  color: var(--admin-green-900);
  font-weight: 700;
  font-size: 9px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}

.admin-page table td {
  padding: 4px 6px;
  font-size: 9px;
  border-bottom: 1px solid var(--admin-border-soft);
  color: var(--admin-text);
}

.admin-page tbody tr:hover {
  background: #f4faf5;
}

/* Status Pills */
.admin-page .badge,
.admin-page .status-pill,
.admin-page [class*="status-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.admin-page .status-closed,
.admin-page .status-dong,
.admin-page [data-status="ĐÓNG"] {
  background: #e6f4ea;
  color: #137333;
}

.admin-page .status-open,
.admin-page .status-mo,
.admin-page [data-status="MỞ"] {
  background: #fef7e0;
  color: #b06000;
}

/* Eye / Detail Action Button */
.admin-page .btn-eye,
.admin-page .btn-view-detail,
.admin-page .overview-record-card .btn-blue,
.admin-page .btn-icon-only {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--admin-border);
  color: var(--admin-muted);
  box-shadow: none;
}

.admin-page .btn-eye:hover,
.admin-page .btn-view-detail:hover,
.admin-page .overview-record-card .btn-blue:hover,
.admin-page .btn-icon-only:hover {
  background: #f4faf5;
  color: var(--admin-green-600);
  border-color: var(--admin-green-600);
}

.admin-page .col-action {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  text-align: center;
  padding: 0;
}

.admin-page #dashboardOverviewView .overview-employee-card {
  gap: 4px;
}

.admin-page #dashboardOverviewView .overview-employee-tools {
  padding: 6px 8px;
  gap: 8px;
}

.admin-page .overview-upload-pane h3, .admin-page .overview-search-pane h3 {
  font-size: 10px;
}

.admin-page .overview-upload-row input[type=file], .admin-page .overview-search-row input {
  height: 28px;
  min-height: 28px;
  font-size: 10px;
}

.admin-page .overview-upload-row .btn, .admin-page .overview-search-row .btn {
  height: 28px;
  min-height: 28px;
  font-size: 10px;
  padding: 0 10px;
}

.admin-page .overview-stats-row {
  margin-top: 4px;
  gap: 6px;
}

.admin-page .overview-stat {
  padding: 4px;
}

.admin-page .overview-stat strong {
  font-size: 16px;
}

.admin-page #dashboardOverviewView .employee-preview-wrap {
  max-height: 200px;
}

.admin-page #dashboardOverviewView .production-table-wrap.compact-records {
  max-height: 230px;
}

/* Overview preview only: compact short fields, prioritize production details. */
@media (min-width: 641px) {
  .admin-page #dashboardOverviewView .overview-production-table {
    width: 1380px;
    min-width: 1380px;
    table-layout: fixed;
  }

  .admin-page #dashboardOverviewView .overview-production-table .col-date { width: 100px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-book { width: 65px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-shift { width: 60px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-leader { width: 165px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-machine { width: 155px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-order { width: 110px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-product { width: 190px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-quantity { width: 85px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-runtime { width: 80px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-stop { width: 125px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-handover { width: 85px; }
  .admin-page #dashboardOverviewView .overview-production-table .col-detail { width: 60px; }

  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(1),
  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(2),
  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(3) {
    white-space: nowrap;
    text-align: center;
  }

  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(1) {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
  }

  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(2) {
    left: 100px;
    width: 65px;
    min-width: 65px;
    max-width: 65px;
  }

  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(3) {
    left: 165px;
    width: 60px;
    min-width: 60px;
    max-width: 60px;
  }

  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(4),
  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(5),
  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(7) {
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
  }

  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(8),
  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(9),
  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(11),
  .admin-page #dashboardOverviewView .overview-production-table :is(th, td):nth-child(12) {
    text-align: center;
  }
}

/* Base Full-Size View CSS */
.admin-page .admin-view {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.admin-page .hidden-view {
    display: none !important;
}

.admin-page .admin-view:not(.hidden-view) {
    display: block;
}

/* Remove default hidden display for subviews managed by JS */
.admin-page #reportFiltersView,
.admin-page #handoverRecordsView,
.admin-page #employeeManagementView {
  width: 100%;
}

/* 9. Responsive layout adjustments */
@media (max-width: 1449px) {
  .admin-page #dashboardOverviewView .admin-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .admin-page #dashboardOverviewView .admin-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .admin-page #dashboardOverviewView .admin-overview-lower {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .admin-page .admin-topbar,
  .admin-page .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .admin-page .admin-sidebar {
    position: fixed;
    transform: translateX(-100%);
    z-index: 60;
  }

  .admin-page.sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-page .admin-sidebar::after {
    display: none;
  }
}

/* ============================================================
   ULTRA-COMPACT DENSITY SPECIFIC OVERRIDES FOR OVERVIEW DASHBOARD
   Applies on standard desktop (>= 1180px) when dashboardOverviewView is active
   ============================================================ */
@media (min-width: 1180px) {
  /* Scoped container: only compacts everything when overview dashboard is showing */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) {
    --admin-gap: 6px;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-topbar {
    height: 52px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-topbar .top-inner {
    padding: 0 16px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-topbar .topbar-copy h1,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-topbar .topbar-copy .brand {
    font-size: 16px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-topbar .topbar-copy p,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-topbar .topbar-copy .sub {
    font-size: 10px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-main {
    padding: 58px 12px 6px !important; /* 52px topbar + 6px gap */
    gap: 6px !important;
  }

  /* Admin Header */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-head {
    height: 48px !important;
    padding: 0 4px !important;
    margin: 0 !important;
    border-bottom: none !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-head-copy h2,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-head-copy .section-title {
    font-size: 15px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-head-copy p,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-head-copy .section-note,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .dashboard-update-note {
    font-size: 10px !important;
    margin-top: 0 !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-main-actions .btn {
    height: 30px !important;
    padding: 0 12px !important;
    font-size: 11px !important;
  }

  /* Filters */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .admin-filter-card {
    padding: 6px 10px !important;
    margin-bottom: 0 !important;
    border-radius: 8px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .desktop-section-head {
    margin-bottom: 2px !important;
    padding-bottom: 2px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .desktop-section-head h2 {
    font-size: 11px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .desktop-section-head .keyboard-hint {
    font-size: 9px !important;
    padding: 2px 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .filters.shift-filters {
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto !important;
    gap: 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .filters.shift-filters .field label {
    font-size: 9px !important;
    margin-bottom: 1px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .filters.shift-filters .field input,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .filters.shift-filters .field select {
    height: 32px !important;
    min-height: 32px !important;
    font-size: 11px !important;
    padding: 0 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .filters.shift-filters .filter-actions .btn {
    height: 32px !important;
    min-height: 32px !important;
    font-size: 11px !important;
    padding: 0 8px !important;
  }

  /* View container gap */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView {
    gap: 6px !important;
  }

  /* 8 KPIs on 1 row */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .admin-kpis {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .kpi {
    padding: 6px 8px !important;
    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
    gap: 2px !important;
    border-radius: 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .kpi-icon {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .kpi-icon svg {
    width: 12px !important;
    height: 12px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .kpi-label {
    font-size: 9px !important;
    line-height: 1.1 !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .kpi-value {
    font-size: 18px !important;
    line-height: 1 !important;
    margin-top: 0px !important;
  }

  /* 4 Charts on 1 row */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .admin-charts {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .chart-card {
    height: 165px !important;
    min-height: 165px !important;
    max-height: 165px !important;
    padding: 6px 8px !important;
    border-radius: 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .chart-card .small-title {
    font-size: 10px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .chart-note {
    font-size: 9px !important;
    margin-bottom: 2px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .chart-content {
    gap: 2px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .chart-row {
    padding: 0px 4px !important;
    gap: 4px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .chart-label,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .chart-value {
    font-size: 9px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .chart-progress {
    height: 4px !important;
  }

  /* Donut charts styling */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .donut-wrap {
    gap: 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .donut-chart,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .donut-chart-container {
    width: 85px !important;
    height: 85px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .donut-center {
    inset: 15% !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .donut-center strong {
    font-size: 12px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .donut-legend {
    gap: 1px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .donut-item {
    font-size: 8.5px !important;
    padding: 1px 3px !important;
  }

  /* Bottom Previews (38/62 ratio) */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .admin-overview-lower {
    grid-template-columns: minmax(0, 38fr) minmax(0, 62fr) !important;
    gap: 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .admin-preview-card {
    padding: 6px 8px !important;
    border-radius: 6px !important;
    display: flex;
    flex-direction: column;
    gap: 4px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .preview-card-head {
    padding-bottom: 2px !important;
    margin-bottom: 2px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-card-title {
    font-size: 10px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-employee-tools {
    padding: 4px 6px !important;
    gap: 6px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-upload-pane,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-search-pane {
    gap: 2px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-upload-pane p {
    font-size: 9px !important;
    margin: 0 !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-stats-row {
    margin-top: 2px !important;
    gap: 4px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-stat {
    padding: 2px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-stat strong {
    font-size: 13px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-stat span {
    font-size: 9px !important;
  }

  /* Table styling: exactly 3-4 rows visible, height 28px - 32px per row, 9px-10px font */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .employee-preview-wrap {
    max-height: 140px !important; /* Limit container to fit exactly 4 rows including header */
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView .production-table-wrap.compact-records {
    max-height: 140px !important; /* Limit container to fit exactly 4 rows including header */
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView table th {
    font-size: 9px !important;
    padding: 5px 6px !important;
    height: 28px !important;
    line-height: 1.1 !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) #dashboardOverviewView table td {
    font-size: 9px !important;
    padding: 4px 6px !important;
    height: 28px !important;
    line-height: 1.1 !important;
  }

  /* Actions column: keep only eye icon button compact, no text */
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .btn-eye,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .btn-view-detail,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-record-card .btn-blue,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .btn-icon-only {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    border-radius: 4px !important;
  }

  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .btn-eye svg,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .btn-view-detail svg,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .overview-record-card .btn-blue svg,
  .admin-page:has(#dashboardOverviewView:not(.hidden-view)) .btn-icon-only svg {
    width: 12px !important;
    height: 12px !important;
  }
}

/* Dedicated report view */
.admin-page #reportFiltersView:not(.hidden-view) {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.admin-page #reportFiltersView .report-page-main-card,
.admin-page #reportFiltersView .report-data-card {
  width: 100%;
  min-width: 0;
  padding: 20px 22px;
}

.admin-page #reportFiltersView .report-page-section-head h2,
.admin-page #reportFiltersView .report-data-head h2 {
  margin: 2px 0 0;
  color: var(--admin-green-800);
  font-size: 16px;
  font-weight: 800;
}

.admin-page #reportFiltersView .report-page-section-head p {
  margin: 4px 0 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-page #reportFiltersView .report-page-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 28px;
  row-gap: 14px;
  margin-top: 18px;
}

.admin-page #reportFiltersView .field {
  min-width: 0;
}

.admin-page #reportFiltersView .field label {
  display: block;
  margin-bottom: 6px;
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 600;
}

.admin-page #reportFiltersView .field input,
.admin-page #reportFiltersView .field select,
.admin-page #reportFiltersView #reportSearch,
.admin-page #reportFiltersView #reportPageSize {
  width: 100%;
  height: 42px;
  min-height: 42px;
  border: 1px solid #d8e0d9;
  border-radius: 8px;
  background: #ffffff;
  color: var(--admin-text);
  font: inherit;
  font-size: 13px;
  padding: 0 11px;
}

.admin-page #reportFiltersView .field input:focus,
.admin-page #reportFiltersView .field select:focus,
.admin-page #reportFiltersView #reportSearch:focus,
.admin-page #reportFiltersView #reportPageSize:focus {
  border-color: var(--admin-green-600);
  outline: 2px solid rgba(20, 102, 56, 0.12);
  outline-offset: 1px;
}

.admin-page #reportFiltersView .report-page-filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.admin-page #reportFiltersView .report-page-filter-actions .btn,
.admin-page #reportFiltersView .report-export-option .btn,
.admin-page #reportFiltersView .report-data-actions .btn {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 7px;
  font-size: 12px;
  gap: 7px;
}

.admin-page #reportFiltersView .btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.admin-page #reportFiltersView .report-page-divider {
  height: 1px;
  margin: 22px 0 18px;
  background: #e1e7e2;
}

.admin-page #reportFiltersView .report-export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.admin-page #reportFiltersView .report-export-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 12px 24px 12px 0;
}

.admin-page #reportFiltersView .report-export-option + .report-export-option {
  border-left: 1px solid #e1e7e2;
  padding-right: 0;
  padding-left: 24px;
}

.admin-page #reportFiltersView .report-export-option h3 {
  margin: 0;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 700;
}

.admin-page #reportFiltersView .report-data-card {
  padding: 0;
  overflow: hidden;
}

.admin-page #reportFiltersView .report-data-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  border-bottom: 1px solid #e1e7e2;
}

.admin-page #reportFiltersView .report-data-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-page #reportFiltersView #reportSearch {
  width: 240px;
  height: 40px;
  min-height: 40px;
}

.admin-page #reportFiltersView .report-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.admin-page #reportFiltersView .report-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: auto;
}

.admin-page #reportFiltersView .report-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 10px;
  border: 1px solid #e1e7e2;
  background: #eef4ef;
  color: var(--admin-green-800);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.admin-page #reportFiltersView .report-table td {
  padding: 8px 10px;
  border: 1px solid #e1e7e2;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.3;
  vertical-align: middle;
}

.admin-page #reportFiltersView .report-table tbody tr:hover td {
  background: #f7faf7;
}

.admin-page #reportFiltersView .report-handover-pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff4dd;
  color: #9a5a00;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-page #reportFiltersView .report-handover-pill.is-closed {
  background: #e5f5e9;
  color: #16713f;
}

.admin-page #reportFiltersView .report-action-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 6px;
}

.admin-page #reportFiltersView .report-action-btn svg {
  width: 15px;
  height: 15px;
}

.admin-page #reportFiltersView .report-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 20px;
  border-top: 1px solid #e1e7e2;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-page #reportFiltersView .report-page-controls,
.admin-page #reportFiltersView .report-page-numbers {
  display: flex;
  align-items: center;
  gap: 5px;
}

.admin-page #reportFiltersView .report-page-controls .btn,
.admin-page #reportFiltersView .report-page-number {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #d8e0d9;
  border-radius: 6px;
  background: #ffffff;
  color: var(--admin-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.admin-page #reportFiltersView .report-page-number.is-active {
  border-color: var(--admin-green-700);
  background: var(--admin-green-700);
  color: #ffffff;
  font-weight: 700;
}

.admin-page #reportFiltersView .report-page-ellipsis {
  min-width: 22px;
  text-align: center;
}

.admin-page #reportFiltersView #reportPageSize {
  width: 105px;
  height: 32px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .admin-page #reportFiltersView .report-page-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-page #reportFiltersView .report-export-option {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .admin-page #reportFiltersView .report-page-main-card {
    padding: 16px;
  }

  .admin-page #reportFiltersView .report-page-filter-grid,
  .admin-page #reportFiltersView .report-export-grid {
    grid-template-columns: 1fr;
  }

  .admin-page #reportFiltersView .report-page-filter-actions,
  .admin-page #reportFiltersView .report-data-actions,
  .admin-page #reportFiltersView .report-data-head,
  .admin-page #reportFiltersView .report-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-page #reportFiltersView .report-page-filter-actions .btn,
  .admin-page #reportFiltersView .report-data-actions .btn,
  .admin-page #reportFiltersView #reportSearch {
    width: 100%;
  }

  .admin-page #reportFiltersView .report-export-option,
  .admin-page #reportFiltersView .report-export-option + .report-export-option {
    border-left: 0;
    padding: 12px 0;
  }

  .admin-page #reportFiltersView .report-export-option + .report-export-option {
    border-top: 1px solid #e1e7e2;
  }

  .admin-page #reportFiltersView .report-page-controls {
    flex-wrap: wrap;
  }
}

/* Handover records view */
.admin-page #handoverRecordsView {
  min-width: 0;
}

.admin-page #handoverRecordsView .handover-filter-card,
.admin-page #handoverRecordsView .handover-data-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

.admin-page #handoverRecordsView .handover-filter-card {
  padding: 16px 18px;
}

.admin-page #handoverRecordsView .handover-filter-head,
.admin-page #handoverRecordsView .handover-data-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.admin-page #handoverRecordsView .handover-filter-head h2,
.admin-page #handoverRecordsView .handover-data-head h2 {
  margin: 2px 0 3px;
  color: var(--admin-green-800);
  font-size: 18px;
  font-weight: 800;
}

.admin-page #handoverRecordsView .handover-filter-head p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-page #handoverRecordsView .handover-filter-grid {
  display: grid;
  grid-template-columns: minmax(250px, 1.35fr) minmax(90px, .55fr) minmax(220px, 1.15fr) minmax(170px, .9fr) minmax(220px, 1.15fr);
  gap: 12px;
  margin-top: 14px;
  align-items: end;
}

.admin-page #handoverRecordsView .field,
.admin-page #handoverRecordsView .handover-leader-field {
  min-width: 0;
  position: relative;
}

.admin-page #handoverRecordsView .field label,
.admin-page #handoverRecordsView .handover-field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--admin-green-800);
  font-size: 12px;
  font-weight: 700;
}

.admin-page #handoverRecordsView .field input,
.admin-page #handoverRecordsView .field select,
.admin-page #handoverRecordsView .handover-select-button,
.admin-page #handoverRecordsView #handoverPageSize {
  width: 100%;
  height: 42px;
  min-height: 42px;
  border: 1px solid #d8e0d9;
  border-radius: 8px;
  background: #ffffff;
  color: var(--admin-text);
  font: inherit;
  font-size: 13px;
  padding: 0 12px;
}

.admin-page #handoverRecordsView .handover-date-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.admin-page #handoverRecordsView .handover-date-range label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.admin-page #handoverRecordsView .handover-date-range span {
  color: var(--admin-muted);
  font-weight: 700;
}

.admin-page #handoverRecordsView .handover-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.admin-page #handoverRecordsView #handoverLeaderValue {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-page #handoverRecordsView .handover-select-arrow {
  color: var(--admin-muted);
  flex: 0 0 auto;
}

.admin-page #handoverRecordsView .handover-leader-dropdown {
  position: absolute;
  inset: calc(100% + 6px) 0 auto 0;
  z-index: 20;
  padding: 8px;
  border: 1px solid #d8e0d9;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(5, 47, 33, .16);
}

.admin-page #handoverRecordsView .handover-leader-search-wrap input {
  width: 100%;
  height: 38px;
  border: 1px solid #d8e0d9;
  border-radius: 7px;
  font-size: 13px;
  padding: 0 10px;
}

.admin-page #handoverRecordsView .handover-leader-options {
  max-height: 230px;
  margin-top: 7px;
  overflow-y: auto;
}

.admin-page #handoverRecordsView .handover-leader-option {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--admin-text);
  text-align: left;
  cursor: pointer;
}

.admin-page #handoverRecordsView .handover-leader-option.is-active,
.admin-page #handoverRecordsView .handover-leader-option:hover {
  background: #eef4ef;
}

.admin-page #handoverRecordsView .handover-leader-option[aria-selected="true"] {
  color: var(--admin-green-800);
  font-weight: 700;
}

.admin-page #handoverRecordsView .handover-leader-primary,
.admin-page #handoverRecordsView .handover-leader-secondary {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-page #handoverRecordsView .handover-leader-primary {
  font-size: 13px;
}

.admin-page #handoverRecordsView .handover-leader-secondary,
.admin-page #handoverRecordsView .handover-leader-empty {
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-page #handoverRecordsView .handover-leader-empty {
  padding: 8px 9px;
}

.admin-page #handoverRecordsView .handover-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-page #handoverRecordsView .handover-filter-actions {
  margin-top: 12px;
}

.admin-page #handoverRecordsView .handover-data-card {
  padding: 0;
  overflow: hidden;
}

.admin-page #handoverRecordsView .handover-data-head {
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #e1e7e2;
}

.admin-page #handoverRecordsView .handover-table-wrap {
  width: 100%;
  max-width: 100%;
  max-height: 64vh;
  overflow: auto;
}

.admin-page #handoverRecordsView .handover-production-table {
  width: 100%;
  min-width: 1380px;
  border-collapse: collapse;
  table-layout: fixed;
}

.admin-page #handoverRecordsView .handover-production-table th,
.admin-page #handoverRecordsView .handover-production-table td {
  position: static !important;
  left: auto !important;
  box-shadow: none !important;
}

.admin-page #handoverRecordsView .handover-production-table th {
  position: sticky !important;
  top: 0;
  z-index: 2;
  padding: 8px 9px;
  border: 1px solid #e1e7e2;
  background: #eef4ef;
  color: var(--admin-green-800);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-page #handoverRecordsView .handover-production-table td {
  padding: 8px 9px;
  border: 1px solid #e1e7e2;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.28;
  vertical-align: middle;
}

.admin-page #handoverRecordsView .handover-production-table tbody tr:hover td {
  background: #f7faf7;
}

.admin-page #handoverRecordsView .handover-production-table th:nth-child(1),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(1) { width: 7%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(2),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(2) { width: 7%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(3),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(3) { width: 7%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(4),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(4) { width: 10%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(5),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(5) { width: 9%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(6),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(6) { width: 10%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(7),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(7) { width: 10%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(8),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(8) { width: 13%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(9),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(9) { width: 7%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(10),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(10) { width: 5%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(11),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(11) { width: 6%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(12),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(12) { width: 7%; }
.admin-page #handoverRecordsView .handover-production-table th:nth-child(13),
.admin-page #handoverRecordsView .handover-production-table td:nth-child(13) { width: 5%; }

.admin-page #handoverRecordsView .handover-production-table :is(th, td):nth-child(1),
.admin-page #handoverRecordsView .handover-production-table :is(th, td):nth-child(2),
.admin-page #handoverRecordsView .handover-production-table :is(th, td):nth-child(3),
.admin-page #handoverRecordsView .handover-production-table :is(th, td):nth-child(9),
.admin-page #handoverRecordsView .handover-production-table :is(th, td):nth-child(10),
.admin-page #handoverRecordsView .handover-production-table :is(th, td):nth-child(11),
.admin-page #handoverRecordsView .handover-production-table :is(th, td):nth-child(12),
.admin-page #handoverRecordsView .handover-production-table :is(th, td):nth-child(13) {
  text-align: center;
}

.admin-page #handoverRecordsView .handover-production-table .cell-main {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.admin-page #handoverRecordsView .handover-production-table .cell-sub {
  margin-top: 3px;
  color: var(--admin-muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.admin-page #handoverRecordsView .handover-production-table .col-action .btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 7px;
  background: var(--admin-green-800);
}

.admin-page #handoverRecordsView .handover-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-top: 1px solid #e1e7e2;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-page #handoverRecordsView .handover-page-controls,
.admin-page #handoverRecordsView .handover-page-numbers {
  display: flex;
  align-items: center;
  gap: 5px;
}

.admin-page #handoverRecordsView .handover-page-controls .btn,
.admin-page #handoverRecordsView .handover-page-number {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #d8e0d9;
  border-radius: 6px;
  background: #ffffff;
  color: var(--admin-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.admin-page #handoverRecordsView .handover-page-number.is-active {
  border-color: var(--admin-green-700);
  background: var(--admin-green-700);
  color: #ffffff;
  font-weight: 700;
}

.admin-page #handoverRecordsView .handover-page-ellipsis {
  min-width: 22px;
  text-align: center;
}

.admin-page #handoverRecordsView #handoverPageSize {
  width: 105px;
  height: 32px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

@media (max-width: 1280px) {
  .admin-page #handoverRecordsView .handover-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-page #handoverRecordsView .handover-filter-card {
    padding: 16px;
  }

  .admin-page #handoverRecordsView .handover-filter-head,
  .admin-page #handoverRecordsView .handover-data-head,
  .admin-page #handoverRecordsView .handover-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-page #handoverRecordsView .handover-filter-grid,
  .admin-page #handoverRecordsView .handover-date-range {
    grid-template-columns: 1fr;
  }

  .admin-page #handoverRecordsView .handover-date-range span {
    display: none;
  }

  .admin-page #handoverRecordsView .handover-filter-actions,
  .admin-page #handoverRecordsView .handover-page-controls {
    flex-wrap: wrap;
  }

  .admin-page #handoverRecordsView .handover-filter-actions .btn {
    width: 100%;
  }
}

/* Mobile-only final overrides. Approved tablet and desktop rules start at 768px. */
@media (max-width: 767px) {
  body.admin-page {
    overflow-x: hidden;
  }

  .admin-page .admin-topbar,
  .admin-page .admin-main {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  .admin-page .admin-topbar {
    height: 60px;
  }

  .admin-page .admin-topbar .top-inner {
    gap: 8px;
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .admin-page .topbar-left {
    min-width: 0;
    flex: 1 1 auto;
    gap: 8px;
  }

  .admin-page .admin-topbar .topbar-copy {
    min-width: 0;
    align-items: flex-start;
    text-align: left;
  }

  .admin-page .admin-topbar .topbar-copy .brand {
    font-size: 14px;
    line-height: 1.15;
    letter-spacing: 0.02em;
    overflow-wrap: anywhere;
  }

  .admin-page .admin-topbar .topbar-copy .sub,
  .admin-page .admin-topbar .admin-desktop-label {
    display: none;
  }

  .admin-page .admin-header-actions {
    flex: 0 0 auto;
    gap: 0;
  }

  .admin-page .admin-topbar .sidebar-toggle,
  .admin-page .admin-topbar .nav-btn {
    min-width: 44px;
    min-height: 44px;
    height: 44px;
  }

  .admin-page .admin-topbar .nav-btn {
    padding: 0 12px;
    font-size: 12px;
  }

  .admin-page .admin-main {
    min-width: 0;
    gap: 12px;
    padding: 72px max(12px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .admin-page .admin-view,
  .admin-page .admin-view > *,
  .admin-page .card,
  .admin-page .table-wrap {
    min-width: 0;
    max-width: 100%;
  }

  .admin-page .table-wrap {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .admin-page .filters.shift-filters,
  .admin-page #reportFiltersView .report-page-filter-grid,
  .admin-page #reportFiltersView .report-export-grid,
  .admin-page #handoverRecordsView .handover-filter-grid,
  .admin-page #handoverRecordsView .handover-date-range {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-page #dashboardOverviewView .admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-page #dashboardOverviewView .admin-charts,
  .admin-page #dashboardOverviewView .admin-overview-lower,
  .admin-page #dashboardOverviewView .overview-employee-tools {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-page .overview-upload-row,
  .admin-page .overview-search-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-page .overview-upload-row .btn,
  .admin-page .overview-search-row .btn {
    width: 100%;
  }

  .admin-page input:not([type="checkbox"]),
  .admin-page select,
  .admin-page textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .admin-page .btn,
  .admin-page .handover-select-button,
  .admin-page .handover-leader-option {
    min-height: 44px;
  }

  .admin-page .filter-actions,
  .admin-page #handoverRecordsView .handover-filter-actions,
  .admin-page #handoverRecordsView .handover-page-controls,
  .admin-page #reportFiltersView .report-page-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .admin-page .filter-actions .btn,
  .admin-page #handoverRecordsView .handover-filter-actions .btn {
    flex: 1 1 140px;
  }

  .admin-page #reportFiltersView .report-page-filter-actions,
  .admin-page #reportFiltersView .report-data-actions,
  .admin-page #reportFiltersView .report-data-head,
  .admin-page #reportFiltersView .report-pagination,
  .admin-page #handoverRecordsView .handover-filter-head,
  .admin-page #handoverRecordsView .handover-data-head,
  .admin-page #handoverRecordsView .handover-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-page #reportFiltersView .report-page-filter-actions .btn,
  .admin-page #reportFiltersView .report-data-actions .btn,
  .admin-page #reportFiltersView #reportSearch {
    width: 100%;
  }

  .admin-page #reportFiltersView .report-export-option,
  .admin-page #reportFiltersView .report-export-option + .report-export-option {
    align-items: stretch;
    border-left: 0;
    padding: 12px 0;
  }

  .admin-page #reportFiltersView .report-export-option + .report-export-option {
    border-top: 1px solid #e1e7e2;
  }

  .admin-page #handoverRecordsView .handover-date-range span {
    display: none;
  }

  .admin-page #handoverRecordsView .handover-leader-dropdown {
    max-height: min(54dvh, 360px);
    overflow-y: auto;
  }

  .admin-page #handoverRecordsView .handover-leader-options {
    max-height: none;
  }

  .admin-page #reportFiltersView .report-action-btn,
  .admin-page #handoverRecordsView .handover-production-table .col-action .btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .admin-page .employee-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .admin-page dialog {
    width: calc(100% - 24px);
    max-width: none;
    max-height: calc(100dvh - 24px);
    overflow: hidden;
  }

  .admin-page .detail-head {
    padding: 12px;
  }

  .admin-page .detail-content,
  .admin-page .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-page .detail-content {
    max-height: calc(100dvh - 96px);
    padding: 12px;
  }
}
