﻿:root {
  --ink: #1f2933;
  --muted: #697386;
  --line: #c7d0d9;
  --heavy: #111827;
  --green: #e2f0d9;
  --green-strong: #c6e0b4;
  --peach: #fce4d6;
  --blue: #ddebf7;
  --yellow: #fff2cc;
  --paper: #ffffff;
  --bg: #eef3f7;
  --danger: #d92d20;
  --sticky-top-offset: 112px;
  --z-settlement-detail: 1550;
  --z-app-dialog: 1600;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Malgun Gothic", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font-family: "Malgun Gothic", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
}

/* Work-group schedule and daily overtime dialogs */
.overview-company .company-work-schedule-btn { min-height: 30px; margin-left: auto; padding: 0 10px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 800; white-space: nowrap; }
.overview-company .company-work-schedule-btn:hover { border-color: #60a5fa; background: #dbeafe; }
.overview-company .overview-company-count { margin-left: 4px; }
.overview-group-title .work-schedule-unset { color: #b45309; font-size: 11px; font-weight: 700; }
.work-schedule-popup,.overtime-detail-popup { position: fixed; z-index: 1200; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15,23,42,.42); }
.work-schedule-window,.overtime-detail-window { width: min(920px,96vw); max-height: 92vh; overflow: auto; border: 1px solid #cbd8e7; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.25); }
.work-schedule-head,.overtime-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid #e2e8f0; background: #f8fbff; }
.work-schedule-head > div,.overtime-detail-head > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.work-schedule-head strong,.overtime-detail-head strong { color: #0f172a; font-size: 18px; font-weight: 900; }
.work-schedule-head span,.overtime-detail-head span { color: #64748b; font-size: 13px; font-weight: 700; }
.work-schedule-close,.overtime-detail-close { min-height: 34px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #475569; }
.work-schedule-layout { display: grid; grid-template-columns: 210px minmax(0,1fr); min-height: 470px; }
.work-schedule-groups { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-right: 1px solid #e2e8f0; background: #f8fafc; }
.work-schedule-groups button { display: flex; min-height: 58px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 3px; padding: 9px 11px; border: 1px solid #dbe5f1; border-radius: 9px; background: #fff; color: #334155; text-align: left; }
.work-schedule-groups button.active { border-color: #f4c36a; background: #fff8e8; box-shadow: inset 3px 0 0 #f59e0b; }
.work-schedule-groups small { color: #64748b; font-size: 11px; font-weight: 700; }
.work-schedule-form { min-width: 0; padding: 18px 20px; }
.work-schedule-form h3 { margin: 0 0 16px; color: #0f172a; font-size: 17px; }
.attendance-policy-fieldset { margin: 18px 0; padding: 14px; border: 1px solid #bfdbfe; border-radius: 10px; background: #f8fbff; }
.attendance-policy-fieldset legend { padding: 0 6px; color: #1d4ed8; font-size: 14px; font-weight: 800; }
.attendance-policy-toggle { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; color: #1e3a5f; font-size: 13px; font-weight: 800; }
.attendance-policy-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.attendance-policy-grid label { display: grid; gap: 5px; color: #475569; font-size: 12px; font-weight: 700; }
.attendance-policy-grid label > div { display: flex; align-items: center; gap: 6px; }
.attendance-policy-grid input { width: 100%; min-width: 0; }
.attendance-policy-grid em { color: #64748b; font-size: 12px; font-style: normal; white-space: nowrap; }
.attendance-review-badge { display: block; width: max-content; max-width: 100%; margin-top: 4px; padding: 2px 6px; overflow: hidden; border: 1px solid #f4c36a; border-radius: 999px; background: #fff8e8; color: #b45309; font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.mobile-overtime-report { display: grid; gap: 10px; padding: 14px; border: 1px solid #bfdbfe; border-radius: 10px; background: #f8fbff; }
.mobile-overtime-report > strong { color: #1e3a5f; font-size: 14px; }
.mobile-overtime-report > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.mobile-overtime-report label { display: grid; gap: 5px; color: #475569; font-size: 12px; font-weight: 700; }
.mobile-overtime-report button { justify-self: start; min-height: 34px; padding: 0 12px; border: 1px solid #2563eb; border-radius: 7px; background: #2563eb; color: #fff; font-size: 13px; font-weight: 800; }
.overtime-special-exception { display: flex; align-items: center; gap: 7px; margin: 12px 20px; color: #b45309; font-size: 13px; font-weight: 800; }
.schedule-basic-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.schedule-basic-grid > label { display: flex; flex-direction: column; gap: 6px; color: #475569; font-size: 12px; font-weight: 800; }
.schedule-basic-grid > label > div { display: flex; align-items: center; gap: 7px; }
.schedule-basic-grid input,.schedule-basic-grid select,.schedule-break-row input,.schedule-break-row select,.overtime-detail-window input,.overtime-detail-window select { height: 38px; min-height: 38px; padding: 0 10px; border: 1px solid #cbd8e7; border-radius: 8px; box-sizing: border-box; background: #fff; color: #1e293b; font-size: 13px; }
.schedule-basic-grid > label > div input { min-width: 0; flex: 1; }
.schedule-basic-grid em { color: #64748b; font-size: 12px; font-style: normal; }
.schedule-breaks-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.schedule-add-break { min-height: 34px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1d4ed8; }
.schedule-break-list { display: flex; flex-direction: column; gap: 8px; }
.schedule-break-row { display: grid; grid-template-columns: minmax(100px,1.3fr) 78px 12px 78px minmax(105px,1fr) auto auto; align-items: center; gap: 6px; padding: 8px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fbfdff; }
.schedule-deduct { display: inline-flex; align-items: center; gap: 5px; color: #475569; font-size: 12px; font-weight: 700; white-space: nowrap; }
.schedule-deduct input { width: 16px; height: 16px; min-height: 16px; padding: 0; }
.schedule-delete-break { min-height: 34px; border: 1px solid #fecaca; border-radius: 8px; background: #fff7f7; color: #dc2626; }
.work-schedule-actions,.overtime-detail-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid #e2e8f0; background: #f8fafc; }
.work-schedule-save,.overtime-detail-save { min-width: 84px; min-height: 38px; border: 1px solid #2563eb; border-radius: 8px; background: #2563eb; color: #fff; }
.work-schedule-cancel,.overtime-detail-cancel { min-width: 84px; min-height: 38px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #475569; }
.attendance-management-view .time-work-table td.overtime-cell { position: relative; }
.attendance-management-view .time-work-table .attendance-time-like-field.manual-overtime { border-color: #f59e0b; box-shadow: inset 0 0 0 1px rgba(245,158,11,.18); }
.overtime-detail-trigger { position: absolute; right: 10px; bottom: 10px; width: 8px; min-width: 8px; height: 8px; min-height: 8px; padding: 0; border: 0; border-radius: 50%; background: #2563eb; box-shadow: 0 0 0 2px #fff; }
.overtime-detail-window { width: min(720px,96vw); }
.overtime-detail-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 16px 20px; }
.overtime-detail-summary span { padding: 9px 11px; border-radius: 8px; background: #f1f5f9; color: #475569; font-size: 13px; font-weight: 700; }
.overtime-detail-calculation { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 0 20px 14px; }
.overtime-detail-calculation div { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border: 1px solid #dbe5f1; border-radius: 9px; }
.overtime-lunch-row { display: grid; grid-template-columns: 120px 1fr 110px; align-items: center; gap: 8px; margin: 0 20px 14px; color: #334155; font-size: 13px; font-weight: 800; }
.overtime-break-options { display: flex; flex-direction: column; gap: 7px; margin: 0 20px 16px; }
.overtime-break-options label { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid #e2e8f0; border-radius: 8px; color: #475569; font-size: 12px; font-weight: 700; }
.overtime-break-options input { width: 16px; height: 16px; min-height: 16px; padding: 0; }
.overtime-break-options em { color: #2563eb; font-style: normal; }
.overtime-final-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 0 20px 18px; }
.overtime-final-grid label { display: flex; flex-direction: column; gap: 6px; color: #475569; font-size: 12px; font-weight: 800; }
.overtime-final-grid output { display: flex; align-items: center; height: 38px; padding: 0 10px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1d4ed8; font-size: 14px; font-weight: 900; }
.overtime-final-grid .overtime-reason-row { grid-column: 1 / -1; }
@media (max-width:800px) { .work-schedule-layout { grid-template-columns: 1fr; } .work-schedule-groups { max-height: 145px; overflow-y: auto; border-right: 0; border-bottom: 1px solid #e2e8f0; } .schedule-basic-grid,.overtime-detail-summary,.overtime-detail-calculation,.overtime-final-grid,.attendance-policy-grid { grid-template-columns: 1fr; } .schedule-break-row { grid-template-columns: 1fr 72px 10px 72px; } .schedule-break-row select,.schedule-break-row .schedule-deduct,.schedule-break-row .schedule-delete-break { grid-column: auto / span 1; } .overtime-lunch-row { grid-template-columns: 1fr; } .mobile-overtime-report > div { grid-template-columns: 1fr; } }

/* Attendance management: clean card redesign */
.time-view.attendance-management-view {
  display: grid;
  gap: 14px;
  overflow: visible;
  border: 0;
  background: transparent;
}

.time-work-empty { display: grid; gap: 10px; padding: 18px; border: 1px solid #dbe5f1; border-radius: 12px; background: #fff; color: #64748b; font-weight: 700; text-align: center; }
.time-work-empty p { margin: 0; }
.time-work-empty .time-add-row-btn { justify-self: center; min-height: 42px; }

.time-view.attendance-management-view.hidden {
  display: none !important;
}

.attendance-management-view .time-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between;
  gap: 20px !important;
  padding: 20px 22px !important;
  border: 1px solid #dbe5f1 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05) !important;
}

.attendance-management-view .time-head-copy {
  display: grid !important;
  gap: 6px;
  min-width: 0;
}

.attendance-management-view .time-head h2 {
  grid-column: auto !important;
  grid-row: auto !important;
  font-size: 22px !important;
  line-height: 1.25;
}

.attendance-management-view .time-head-copy p {
  grid-column: auto !important;
  grid-row: auto !important;
  margin: 0 !important;
  color: #64748b !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: left !important;
  white-space: normal !important;
}

.attendance-management-view .time-head-actions {
  grid-column: auto !important;
  grid-row: auto !important;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.attendance-management-view .time-head-actions button {
  min-height: 42px !important;
  padding: 0 16px !important;
  border-color: #cbd8e7 !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

.attendance-management-view .time-head-actions .time-date-action {
  min-width: 210px;
  color: #1d4ed8 !important;
  background: #f8fbff !important;
}

.attendance-management-view .time-head-actions .time-primary-action {
  border-color: #2563eb !important;
  background: #2563eb !important;
  color: #ffffff !important;
}

.time-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.time-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 18px 20px;
  border: 1px solid #dbe5f1;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 2px 9px rgba(15, 23, 42, 0.04);
}

.time-summary-card span {
  color: #64748b;
  font-size: 14px;
  font-weight: 800;
}

.time-summary-card strong {
  color: #0f172a;
  font-size: 25px;
  font-weight: 800;
}

.time-summary-attended { border-top: 3px solid #3b82f6; }
.time-summary-working { border-top: 3px solid #10b981; }
.time-summary-completed { border-top: 3px solid #64748b; }
.time-summary-attended strong { color: #2563eb; }
.time-summary-working strong { color: #059669; }
.time-summary-completed strong { color: #475569; }

.time-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #dbe5f1;
  border-radius: 12px;
  background: #ffffff;
}

.time-toolbar > p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.time-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.attendance-management-view .time-work-table {
  overflow-x: auto !important;
  border: 1px solid #dbe5f1 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05) !important;
}

.attendance-management-view .time-work-table table {
  width: 100%;
  min-width: 1180px !important;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.attendance-management-view .time-work-table th,
.attendance-management-view .time-work-table td {
  padding: 11px 9px;
  border: 0;
  border-bottom: 1px solid #e6edf5;
  color: #334155;
}

.attendance-management-view .time-work-table th {
  height: 46px;
  background: #f1f6fc !important;
  color: #475569 !important;
  font-size: 12px;
  font-weight: 800 !important;
  white-space: nowrap;
}

.attendance-management-view .time-work-table th:first-child {
  border-radius: 13px 0 0 0;
}

.attendance-management-view .time-work-table th:last-child {
  border-radius: 0 13px 0 0;
}

.attendance-management-view .time-work-table tbody tr:not(.time-add-helper-row):hover td {
  background: #f8fbff;
}

.attendance-management-view .time-work-table tbody tr.checked-row td,
.attendance-management-view .time-work-table tbody tr.selected-row td {
  background: #eef5ff !important;
}

.attendance-management-view .time-work-table th:nth-child(1),
.attendance-management-view .time-work-table td:nth-child(1) { width: 48px; }
.attendance-management-view .time-work-table th:nth-child(2),
.attendance-management-view .time-work-table td:nth-child(2) { width: 60px; }
.attendance-management-view .time-work-table th:nth-child(3),
.attendance-management-view .time-work-table td:nth-child(3) { width: 200px; }
.attendance-management-view .time-work-table th:nth-child(4),
.attendance-management-view .time-work-table td:nth-child(4) { width: 70px; }
.attendance-management-view .time-work-table th:nth-child(5),
.attendance-management-view .time-work-table td:nth-child(5) { width: 145px; }
.attendance-management-view .time-work-table th:nth-child(6),
.attendance-management-view .time-work-table td:nth-child(6) { width: 150px; }
.attendance-management-view .time-work-table th:nth-child(7),
.attendance-management-view .time-work-table td:nth-child(7),
.attendance-management-view .time-work-table th:nth-child(8),
.attendance-management-view .time-work-table td:nth-child(8) { width: 105px; }
.attendance-management-view .time-work-table th:nth-child(9),
.attendance-management-view .time-work-table td:nth-child(9) { width: 90px; }
.attendance-management-view .time-work-table th:nth-child(10),
.attendance-management-view .time-work-table td:nth-child(10) { width: 190px; }

.attendance-management-view .time-work-table input {
  min-height: 38px;
  padding: 6px 9px;
  border: 1px solid #cbd8e7;
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
}

.attendance-management-view .time-work-table input:focus {
  border-color: #6b9df4;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.time-name-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.attendance-management-view .time-delete-row-btn {
  min-width: 44px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  background: #fff7f7;
  font-size: 11px;
}

.attendance-management-view .time-gender {
  min-width: 38px;
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.attendance-management-view .time-gender.male {
  border-color: #bfdbfe;
  background: #eaf3ff;
  color: #1d4ed8;
}

.attendance-management-view .time-gender.female {
  border-color: #fbcfe8;
  background: #fdf0f7;
  color: #be185d;
}

.attendance-management-view .time-add-helper-row td {
  padding: 9px 12px;
  border-bottom: 0;
  text-align: right;
  background: #fbfdff;
}

.attendance-management-view .time-add-row-btn {
  min-width: 76px;
  min-height: 34px;
  border-color: #b9cff0;
  border-radius: 9px;
  background: #f4f8ff;
  color: #2563eb;
}

@media (max-width: 1200px) {
  .time-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .time-toolbar-actions {
    justify-content: flex-start;
    width: 100%;
  }
}

@media (max-width: 900px) {
  .attendance-management-view .time-head {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .attendance-management-view .time-head-actions {
    justify-content: flex-start !important;
    width: 100%;
  }

  .time-summary-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    overflow-x: auto;
  }

  .time-toolbar-actions {
    align-items: flex-start;
    flex-direction: column;
  }

}

.layout.time-mode #summaryBand {
  display: none !important;
}

@media (max-width: 1500px) {
  .attendance-management-view .time-head {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .attendance-management-view .time-head-actions {
    justify-content: flex-start !important;
    flex-direction: row !important;
    width: 100%;
  }
}

@media (max-width: 620px) {
  .time-summary-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .attendance-management-view .time-head-actions .time-date-action,
  .attendance-management-view .time-head-actions button {
    width: 100%;
  }
}

button {
  border: 1px solid #9fb0c0;
  background: #fff;
  color: var(--ink);
  min-height: 32px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  background: #f2f7fb;
}

.hidden {
  display: none !important;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-start;
  padding: 16px 20px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(31, 41, 51, 0.06);
  position: sticky;
  top: 0;
  z-index: 30;
}

h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: 0;
}

.date-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 8px;
  background: #eef7ff;
  border: 1px solid #c7dff2;
  border-radius: 8px;
}

.group-head input {
  border: 1px solid #aebdcc;
  min-height: 34px;
  padding: 4px 8px;
  background: #fff;
}

.actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 570px;
}

.topbar button {
  border-color: #9bb3c8;
  border-radius: 6px;
  background: #ffffff;
  min-height: 34px;
  padding: 0 13px;
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.06);
}

.topbar button:hover {
  background: #f0f7ff;
  border-color: #6f9fca;
}

.tab-btn.active {
  background: #d8ecff;
  border-color: #4386bd;
  font-weight: 700;
  color: #123f63;
}

#saveBtn {
  background: #f7fff1;
  border-color: #8fbd70;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.layout.employee-mode {
  grid-template-columns: minmax(0, 1fr);
}

.layout.employee-mode .sidebar {
  display: none;
}

.layout.time-mode #addCompanyBtn {
  display: none;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 14px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  z-index: 12;
}

.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 10px;
  padding-left: 6px;
  font-size: 17px;
}

.side-head button {
  width: 32px;
  padding: 0;
}

.company-search {
  width: 100%;
  min-height: 38px;
  margin: 0 0 12px;
  padding: 0 12px;
  border: 1px solid #cbd8e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  font-size: 14px;
}

.company-search::placeholder {
  color: #94a3b8;
}

.company-search,
.name-search,
.dispatch-name-search,
.employee-search {
  padding-right: 34px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}

.company-search::-webkit-search-cancel-button,
.name-search::-webkit-search-cancel-button,
.dispatch-name-search::-webkit-search-cancel-button,
.employee-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.company-search-status {
  margin: -4px 2px 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.company-list-empty {
  padding: 18px 14px;
  border: 1px dashed #cbd8e8;
  border-radius: 12px;
  background: #f8fbff;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.company-recent-searches {
  display: none;
  margin: -2px 0 12px;
  padding: 10px 10px 12px;
  border: 1px solid #dbe5f1;
  border-radius: 12px;
  background: #f8fbff;
}

.company-recent-searches.visible {
  display: block;
}

.company-recent-searches-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.company-recent-searches-head span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.company-recent-clear {
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.company-recent-searches-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.company-recent-chip {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #c9d7ea;
  border-radius: 999px;
  background: #ffffff;
  color: #315cae;
  font-size: 12px;
  font-weight: 800;
}

.company-recent-chip:hover {
  background: #eef5ff;
  border-color: #9dbcf4;
}

.search-history-popup {
  position: fixed;
  z-index: 1400;
  background: #fff;
  border: 1px solid #cbd8e8;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.search-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: #f8fbff;
  border-bottom: 1px solid #e2e8f0;
}

.search-history-head strong {
  font-size: 13px;
}

.search-history-head button {
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: #64748b;
}

.search-history-list {
  display: grid;
  gap: 0;
  max-height: 220px;
  overflow: auto;
}

.search-history-item {
  min-height: 36px;
  border: 0;
  border-top: 1px solid #f1f5f9;
  background: #fff;
  text-align: left;
  padding: 0 12px;
}

.search-history-item:hover {
  background: #eef6ff;
}

.time-name-popup {
  position: fixed;
  z-index: 1450;
  display: grid;
  gap: 0;
  background: #fff;
  border: 1px solid #cbd8e8;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.time-name-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  border: 0;
  border-top: 1px solid #f1f5f9;
  background: #fff;
  text-align: left;
  padding: 0 12px;
}

.time-name-suggestion:first-child {
  border-top: 0;
}

.time-name-suggestion:hover,
.time-name-suggestion.active {
  background: #eef6ff;
}

.time-name-suggestion-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: #0f172a;
}

.time-name-suggestion-gender {
  flex: 0 0 auto;
  min-width: 24px;
  font-size: 12px;
  font-weight: 800;
}

.time-name-suggestion-gender.male {
  color: #2563eb;
}

.time-name-suggestion-gender.female {
  color: #db2777;
}

/* Recover plain title text */
h1 {
  display: block !important;
}

h1::before {
  content: none !important;
  display: none !important;
}

.company-list {
  display: grid;
  gap: 7px;
}

.company-item {
  width: 100%;
  border: 1px solid #b8c8d7;
  background: #fff;
  text-align: left;
  box-shadow: 0 1px 0 rgba(44, 66, 86, 0.04);
}

.company-item.empty-company .company-toggle,
.company-item.empty-company .company-group-link {
  background: #f8fafc;
  color: var(--ink);
  border-color: #d8e0ea;
}

.company-item.active {
  background: #eaf4ff;
  border-color: #4f8ecb;
  box-shadow: inset 3px 0 0 #2f80ed;
  opacity: 1;
}

.company-toggle {
  width: 100%;
  border: 0;
  background: var(--blue);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  gap: 10px;
  align-items: center;
  text-align: left;
  min-height: 32px;
  padding: 6px 9px;
  cursor: pointer;
}

.company-toggle::after {
  content: "▾";
  grid-column: 3;
  justify-self: end;
  font-size: 16px;
  font-weight: 800;
  color: #334155;
  line-height: 1;
  margin-left: 0;
}

.company-item.collapsed .company-toggle::after {
  content: "▸";
}

.company-toggle:hover {
  background: #d5e8f8;
}

.company-toggle strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
  line-height: 1.25;
}

.company-toggle span {
  grid-column: 2;
  justify-self: end;
  min-width: 20px;
  text-align: right;
  font-size: 14px;
  font-weight: 800;
  color: #1d4ed8;
}

.company-groups {
  display: grid;
  gap: 4px;
  padding: 6px 8px 8px 14px;
}

.company-group-link {
  width: 100%;
  border: 1px solid #c8d8e8;
  background: #f8fbff;
  min-height: 24px;
  padding: 3px 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}

.company-group-link span {
  min-width: 0;
}

.company-group-link strong {
  justify-self: end;
  min-width: 18px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
}


.company-group-link.search-match {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
  background: linear-gradient(180deg, #fff8dc 0%, #fff1bd 100%);
  border-color: #e4b84b;
}

.company-toggle.search-match {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
  background: linear-gradient(180deg, #fff7d6 0%, #ffeeb2 100%);
  box-shadow: inset 0 0 0 1px rgba(240, 180, 75, 0.28);
}

.workspace {
  min-width: 0;
  padding: 16px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.daily-overview {
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.quick-bank {
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.quick-bank.active {
  background: #eef7ff;
  outline: 2px solid #2f80ed;
  outline-offset: -2px;
}

.quick-bank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--blue);
  border-bottom: 1px solid var(--line);
}

.quick-bank-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.quick-bank-head h2 {
  margin: 0;
  font-size: 16px;
}

.quick-bank-target-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid #c9d7ea;
  border-radius: 999px;
  background: #ffffff;
  color: #315cae;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.quick-bank-target-label.flash {
  animation: quickBankTargetPulse 0.85s ease;
}

@keyframes quickBankTargetPulse {
  0% {
    background: #ffffff;
    border-color: #c9d7ea;
    color: #315cae;
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
  }
  35% {
    background: #eef5ff;
    border-color: #8fb4f5;
    color: #1d4ed8;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
  }
  100% {
    background: #ffffff;
    border-color: #c9d7ea;
    color: #315cae;
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
  }
}

.quick-bank-head span {
  color: var(--muted);
  font-size: 12px;
}

.quick-bank-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-bank-actions button {
  min-height: 28px;
  padding: 0 10px;
}

.name-search {
  width: 180px;
  min-height: 28px;
  border: 1px solid #aebdcc;
  padding: 3px 8px;
}

.quick-name-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 150px;
  overflow: auto;
  padding: 8px;
}

.quick-name-bank.drop-ready {
  background: #eef7ff;
  outline: 2px dashed #2f80ed;
  outline-offset: -4px;
}

.quick-name {
  min-height: 31px;
  padding: 4px 11px;
  border-radius: 0;
  cursor: grab;
  font-size: 13px;
}

.quick-name.dragging {
  opacity: 0.45;
}

.quick-name.selected {
  border-color: #1d4ed8;
  outline: 2px solid #1d4ed8;
  outline-offset: 1px;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
  font-weight: 700;
}

.overview-names .person-pill.selected,
.name-cell .employee-chip.selected {
  background: #ffffff !important;
  outline: 1px solid #2563eb;
  outline-offset: -1px;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
  font-weight: 700;
}

.quick-name.insert-before-bank {
  box-shadow: inset 4px 0 0 #2f80ed;
}

.quick-name.insert-after-bank {
  box-shadow: inset -4px 0 0 #2f80ed;
}

.quick-name.male {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #0f3f8c;
}

.quick-name.female {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #9d174d;
}

.overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--green);
  border-bottom: 1px solid var(--line);
}

.overview-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.overview-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.overview-head-actions button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #c9d7e6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.overview-head-actions button:hover {
  background: #f8fbff;
  border-color: #9ab8d9;
}

.overview-head h2 {
  margin: 0;
  font-size: 17px;
}

.overview-total {
  font-weight: 700;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 8px;
  padding: 14px 8px 8px;
}

.overview-card {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  text-align: left;
  background: #fff;
  border: 1px solid #aebdcc;
  cursor: grab;
}

.overview-card.empty-company .overview-company,
.overview-card.empty-company .overview-group {
  background: #f8fafc;
  color: var(--ink);
}

.overview-card.empty-company {
  border-color: #d8e0ea;
}

.overview-card:active {
  cursor: grabbing;
}

.overview-card.active {
  outline: 2px solid #5b8db8;
  background: #f8fbff;
  opacity: 1;
}

.overview-card.search-match {
  outline: 2px solid #f59e0b;
}

.overview-card.drop-ready {
  outline: 3px dashed #2f80ed;
  background: #eef7ff;
}

.overview-card.dragging-company {
  opacity: .55;
}

.overview-company {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--blue);
  cursor: pointer;
}

.overview-company::after {
  content: "▾";
  font-size: 16px;
  font-weight: 800;
  color: #334155;
  line-height: 1;
  margin-left: 8px;
}

.overview-card.collapsed .overview-company::after {
  content: "▸";
}

.overview-company strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.overview-company span {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.overview-groups {
  display: grid;
}

.overview-group {
  border-bottom: 1px solid #e0e5ea;
  padding: 5px 7px;
  cursor: pointer;
}

.overview-group.search-match {
  background: #fff8db;
}

.overview-group:last-child {
  border-bottom: 0;
}

.overview-group-title {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 44px 70px auto;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.overview-group-title span,
.overview-group-title em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.overview-add-person {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #c9d7e6;
  border-radius: 6px;
  background: #ffffff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.overview-add-person:hover {
  background: #f8fbff;
  border-color: #9ab8d9;
}

.overview-names {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.overview-names span {
  border: 1px solid #d7dde3;
  background: #fff;
  padding: 4px 10px;
  font-size: 13px;
  line-height: 1.45;
}

.overview-names .person-pill {
  cursor: grab;
  user-select: none;
  position: relative;
}

.overview-names .person-pill.search-match {
  outline: 2px solid #f59e0b;
  background: #fef08a;
  border-color: #d97706;
  color: #111827;
}

.jump-highlight {
  animation: jumpHighlight 1.1s ease-in-out 1;
}

@keyframes jumpHighlight {
  0%,
  100% {
    box-shadow: none;
  }

  35%,
  70% {
    box-shadow: 0 0 0 4px #f59e0b;
  }
}

.overview-names .person-pill.dragging {
  opacity: 0.45;
}

.overview-names .person-pill.insert-before-pill,
.overview-names .person-pill.insert-after-pill {
  outline: 2px solid #2f80ed;
}

.overview-names .person-pill.insert-before-pill {
  box-shadow: inset 4px 0 0 #2f80ed;
}

.overview-names .person-pill.insert-after-pill {
  box-shadow: inset -4px 0 0 #2f80ed;
}

.overview-names .person-pill.male,
.name-cell .employee-chip.male {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #0f3f8c;
}

.overview-names .person-pill.female,
.name-cell .employee-chip.female {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #9d174d;
}

.overview-names .more {
  background: var(--yellow);
  font-weight: 700;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px;
  min-height: 58px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.metric strong {
  font-size: 24px;
}

.metric.total {
  background: var(--green);
}

.editor {
  display: grid;
  gap: 12px;
}

.editor-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.group-panel {
  background: #fff;
  border: 1px solid var(--line);
}

.group-panel.drop-ready,
.overview-group.drop-ready {
  background: #eef7ff;
  outline: 2px dashed #5b8db8;
  outline-offset: -2px;
}

.group-panel.active,
.overview-group.active {
  background: #eef7ff;
  outline: 2px solid #2f80ed;
  outline-offset: -2px;
}

.group-head {
  display: grid;
  grid-template-columns: minmax(150px, 260px) 160px;
  gap: 8px;
  align-items: center;
  justify-content: start;
  padding: 8px;
  background: var(--peach);
  border-bottom: 1px solid var(--line);
}

.group-head label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.remove-group {
  min-width: 74px;
  color: var(--danger);
}

.people-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.people-grid.mixed-grid {
  grid-template-columns: 1fr;
}

.people-grid section + section {
  border-left: 1px solid var(--line);
}

.people-grid.mixed-grid section + section {
  border-left: 0;
}

.gender-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}

.gender-head.male,
.gender-head.female,
.gender-head.mixed {
  background: var(--yellow);
  color: #c00000;
}

.name-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  min-height: 96px;
}

.mixed-grid .name-list {
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
}

.name-list.drop-ready {
  background: #eef7ff;
  outline: 2px dashed #5b8db8;
  outline-offset: -2px;
}

.name-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  border-right: 1px solid #d7dde3;
  border-bottom: 1px solid #d7dde3;
  position: relative;
}

.name-cell.insert-before-cell::before,
.name-cell.insert-after-cell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #2f80ed;
  z-index: 2;
}

.name-cell.insert-before-cell::before {
  left: 0;
}

.name-cell.insert-after-cell::after {
  right: 0;
}

.name-cell input {
  min-width: 0;
  border: 0;
  padding: 7px 8px;
}

.name-cell button {
  min-height: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-left: 1px solid #e0e5ea;
  color: var(--danger);
}

.name-cell .employee-chip {
  color: var(--ink);
  min-width: 0;
  text-align: left;
  padding: 8px 10px;
  border-left: 0;
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 600;
}

.name-cell .employee-chip:hover {
  background: var(--blue);
}

.name-cell .employee-chip.dragging {
  opacity: 0.45;
  background: var(--yellow);
}

.name-cell .employee-chip.drop-ready {
  outline: 2px dashed #2f80ed;
  outline-offset: -3px;
}

.name-cell .employee-chip.insert-before {
  box-shadow: inset 4px 0 0 #2f80ed;
}

.name-cell .employee-chip.insert-after {
  box-shadow: inset -4px 0 0 #2f80ed;
}

.person-menu {
  position: fixed;
  z-index: 1000;
  display: grid;
  min-width: 148px;
  padding: 6px;
  gap: 4px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #c9d7e5;
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(35, 55, 80, 0.18);
  backdrop-filter: blur(8px);
}

.person-menu button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  color: #1f2937;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.person-menu button:last-child {
  color: var(--danger);
}

.company-menu button[data-action="back"] {
  color: var(--ink);
}

.company-menu button[data-action="add-company"] {
  background: #eef6ff;
  color: #1d4ed8;
}

.person-menu button:hover {
  background: #eef7ff;
  transform: translateY(-1px);
}

.person-menu button[data-action="remove"]:hover {
  background: #fff1f2;
}

.person-menu button[data-action="add-company"]:hover {
  background: #dbeafe;
}

.confirm-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 41, 51, 0.32);
  backdrop-filter: blur(3px);
}

.confirm-window {
  min-width: 300px;
  max-width: min(92vw, 360px);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #c9d7e5;
  border-radius: 16px;
  box-shadow: 0 22px 42px rgba(31, 41, 51, 0.22);
  padding: 22px 20px 18px;
}

.confirm-window p {
  margin: 0 0 18px;
  font-weight: 800;
  font-size: 24px;
  text-align: center;
  color: #0f172a;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.confirm-actions button {
  min-width: 84px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid #c9d7e5;
  background: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.confirm-yes {
  color: var(--danger);
  font-weight: 700;
  background: #fff5f5;
  border-color: #f2c7c7;
}

.confirm-no {
  color: #334155;
}

.confirm-message .confirm-name {
  font-weight: 900;
}

.confirm-message .confirm-name.male {
  color: #2563eb;
}

.confirm-message .confirm-name.female {
  color: #db2777;
}

.confirm-message .confirm-company {
  color: #0f172a;
  font-weight: 900;
}

.confirm-message .confirm-group {
  color: #475569;
  font-weight: 800;
}

.confirm-message .confirm-row {
  color: #2563eb;
  font-weight: 900;
}

.app-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-app-dialog);
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(31, 41, 51, 0.36);
  backdrop-filter: blur(3px);
}

.app-dialog-overlay.hidden { display: none; }

.app-dialog {
  width: min(440px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 18px 20px;
  border: 1px solid #d8e4f1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
}

.app-dialog.tone-warning { border-color: #f0d4a1; }
.app-dialog.tone-danger { border-color: #efb6b6; }

.app-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-dialog-title { color: #0f172a; font-size: 17px; font-weight: 700; }

.app-dialog-close {
  display: grid;
  width: 32px;
  min-width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid #d8e4f1;
  border-radius: 8px;
  background: #fff;
  color: #526173;
  font-size: 20px;
  line-height: 1;
}

.app-dialog-message {
  min-height: 42px;
  margin: 14px 0 18px;
  color: #334155;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.app-dialog-actions button {
  min-width: 72px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  font: inherit;
  font-weight: 700;
}

.app-dialog-cancel {
  border: 1px solid #c9d9ea;
  background: #fff;
  color: #526173;
}

.app-dialog-confirm {
  border: 1px solid #2f6df3;
  background: #2f6df3;
  color: #fff;
}

.app-dialog.tone-warning .app-dialog-confirm { border-color: #d58b18; background: #d58b18; }
.app-dialog.tone-danger .app-dialog-confirm { border-color: #dc2626; background: #dc2626; }

.app-dialog button:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }

@media (max-width: 420px) {
  .app-dialog { padding: 16px; }
  .app-dialog-actions button { flex: 1 1 120px; }
}

.confirm-actions button:hover {
  background: #f8fbff;
}

.confirm-yes:hover {
  background: #ffe8e8;
}

.print-menu-popup {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 41, 51, 0.28);
}

.print-menu-window {
  width: min(560px, 96vw);
  max-height: 86vh;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  background: #ffffff;
  border: 1px solid #8fa9bf;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(31, 41, 51, 0.22);
  overflow: hidden;
}

.print-menu-head,
.print-menu-select-head,
.print-menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.print-menu-head {
  background: var(--green);
  border-bottom: 1px solid #b8c9d8;
}

.print-menu-head strong {
  font-size: 18px;
}

.print-menu-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
  background: #f7fbff;
  border-bottom: 1px solid #d7e2ec;
}

.print-menu-actions button,
.print-menu-footer button {
  min-height: 38px;
  font-weight: 700;
}

.print-menu-select-head {
  background: #ffffff;
  border-bottom: 1px solid #d7e2ec;
}

.print-menu-select-head span {
  font-weight: 800;
}

.print-menu-select-head div {
  display: flex;
  gap: 6px;
}

.print-company-select-list {
  display: grid;
  gap: 6px;
  padding: 10px 14px;
  overflow: auto;
  background: #f9fbfd;
}

.print-company-option {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 9px;
  background: #ffffff;
  border: 1px solid #c7d7e4;
  border-radius: 6px;
}

.print-company-option input {
  width: 16px;
  height: 16px;
}

.print-company-option span {
  font-weight: 800;
}

.print-company-option em {
  font-style: normal;
  color: var(--muted);
  white-space: nowrap;
}

.print-menu-footer {
  border-top: 1px solid #d7e2ec;
  background: #ffffff;
}

.print-menu-status {
  color: var(--danger);
  font-weight: 700;
}

.employee-popup {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.24);
}

.quick-add-popup {
  position: fixed;
  inset: 0;
  z-index: 920;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.24);
}

.quick-add-window {
  width: min(460px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 44px rgba(35, 55, 80, 0.22);
  overflow: hidden;
}

.company-rename-window {
  width: min(420px, 92vw);
}

.company-rename-body {
  gap: 12px;
}

.company-rename-help {
  margin: -2px 0 2px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}
.quick-add-head {
  padding: 16px 20px 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
}

.quick-add-body {
  display: grid;
  gap: 14px;
  padding: 0 20px 18px;
}

.quick-add-label {
  display: grid;
  gap: 7px;
  color: #38506a;
  font-size: 14px;
  font-weight: 700;
}

.quick-add-label input,
.quick-add-label select {
  width: 100%;
  min-width: 0;
  border: 1px solid #bfd0e5;
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  background: #fff;
  color: var(--navy);
}

.quick-add-label input:focus,
.quick-add-label select:focus {
  outline: none;
  border-color: #6ea2ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.quick-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 20px;
}

.quick-add-actions button {
  min-width: 88px;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 800;
}

.quick-add-save {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-color: #2563eb;
  color: #fff;
}

.time-share-popup {
  position: fixed;
  inset: 0;
  z-index: 1320;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(3px);
}

.time-share-window {
  width: min(92vw, 720px);
  max-height: 90vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #ffffff;
  border: 1px solid #c9d7e5;
  border-radius: 18px;
  box-shadow: 0 22px 42px rgba(31, 41, 51, 0.24);
  overflow: hidden;
}

.time-share-head,
.time-share-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #f8fbff;
  border-bottom: 1px solid #dbe6f0;
}

.time-share-actions {
  justify-content: flex-end;
  border-top: 1px solid #dbe6f0;
  border-bottom: 0;
}

.time-share-head strong {
  font-size: 19px;
}

.time-share-body {
  overflow: auto;
  padding: 18px;
  background: #eef4fb;
}

.time-share-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  background: #ffffff;
}

.time-share-close,
.time-share-print,
.time-share-copy {
  min-width: 86px;
  min-height: 38px;
  border-radius: 10px;
  font-weight: 800;
}

.time-share-print {
  color: #0f172a;
}

.time-share-copy {
  color: #2563eb;
}

.time-share-copy.is-copying::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 8px;
  display: inline-block;
  vertical-align: -2px;
  border: 2px solid rgba(37, 99, 235, 0.24);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.quick-add-cancel {
  background: #eef4ff;
  border-color: #d9e5f7;
  color: #365278;
}


.group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.group-actions .remove-group {
  margin-left: auto;
}

.employee-view {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

.time-view {
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
}

.dispatch-view {
  background: #fff;
  border: 1px solid var(--line);
}

.dispatch-head {
  display: grid;
  grid-template-columns: 180px 1fr 180px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--green);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.dispatch-head h2 {
  margin: 0;
  font-size: 18px;
  grid-column: 1;
  grid-row: 1;
}

.dispatch-total {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  justify-self: center;
  grid-column: 2;
  grid-row: 1;
}

.dispatch-head-spacer {
  width: 100%;
  min-height: 1px;
  grid-column: 3;
  grid-row: 1;
}

.dispatch-bank {
  border-bottom: 1px solid var(--line);
  background: #eef6ff;
  padding: 8px 10px;
}

.dispatch-bank-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.dispatch-name-search {
  width: 180px;
  min-height: 30px;
  border: 1px solid #aebdcc;
  padding: 4px 8px;
  font: inherit;
  background: #fff;
}

.dispatch-name-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 38px;
  padding: 6px;
  border: 1px solid #7aa7d9;
  background: #fff;
}

.dispatch-name-bank.drop-ready {
  outline: 2px dashed #2563eb;
  background: #eff6ff;
}

.dispatch-person {
  min-height: 26px;
  border: 1px solid #93c5fd;
  padding: 2px 8px;
  font-weight: 700;
  cursor: pointer;
}

.dispatch-person.male {
  background: #dbeafe;
  color: #0f3f8c;
}

.dispatch-person.female {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #9d174d;
}

.dispatch-name.assigned {
  border-style: dashed;
  background: #fff7ed;
  color: #9a3412;
}

.dispatch-person.not-attended {
  background: #fef08a;
  border-color: #facc15;
  color: #111827;
}

.time-head {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--green);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.time-head h2 {
  margin: 0;
  font-size: 18px;
}

.time-head > div:first-child {
  display: contents;
}

.time-head h2 {
  grid-column: 1;
  grid-row: 1;
}

.time-head p {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  grid-column: 2;
  grid-row: 1;
}

.time-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  grid-column: 3;
  grid-row: 1;
}

.time-copy-excel-btn {
  min-width: 112px;
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  align-self: center;
  border: 1px solid #86adf0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #edf4ff 100%);
  color: #1a4588;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.12);
}

.time-copy-excel-btn:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e6f0ff 100%);
  border-color: #5e92ea;
  box-shadow: 0 6px 12px rgba(59, 130, 246, 0.16);
}

.time-copy-excel-btn:active {
  transform: translateY(1px);
}

.time-copy-excel-icon {
  position: relative;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.time-copy-excel-icon::before,
.time-copy-excel-icon::after {
  content: "";
  position: absolute;
  border: 1.8px solid currentColor;
  border-radius: 3px;
  background: #ffffff;
}

.time-copy-excel-icon::before {
  width: 10px;
  height: 10px;
  top: 3px;
  left: 1px;
  opacity: 0.92;
}

.time-copy-excel-icon::after {
  width: 10px;
  height: 10px;
  top: 0;
  left: 4px;
}

.time-copy-excel-btn.is-copying {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.time-copy-excel-btn.is-copying::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid #c7d6ea;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: time-copy-spin 0.8s linear infinite;
}

@keyframes time-copy-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.time-work-table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: auto;
}

.time-work-table table {
  width: 100%;
  min-width: 1150px;
  border-collapse: collapse;
  table-layout: fixed;
}

.time-work-table th,
.time-work-table td {
  border: 1px solid var(--line);
  padding: 5px;
  text-align: center;
  vertical-align: middle;
}

.time-work-table th {
  background: #f5f7fa;
  font-weight: 700;
}

.time-work-table th:nth-child(1),
.time-work-table td:nth-child(1) {
  width: 44px;
}

.time-work-table th:nth-child(2),
.time-work-table td:nth-child(2) {
  width: 54px;
}

.time-work-table th:nth-child(3),
.time-work-table td:nth-child(3) {
  width: 120px;
}

.time-work-table th:nth-child(4),
.time-work-table td:nth-child(4) {
  width: 64px;
}

.time-work-table th:nth-child(5),
.time-work-table td:nth-child(5),
.time-work-table th:nth-child(6),
.time-work-table td:nth-child(6) {
  width: 144px;
}

.time-work-table th:nth-child(7),
.time-work-table td:nth-child(7) {
  width: 72px;
}

.time-work-table th:nth-child(8),
.time-work-table td:nth-child(8) {
  width: 130px;
}

.time-work-table th:nth-child(9),
.time-work-table td:nth-child(9) {
  width: calc(50% - 74px);
}

.time-work-table th:nth-child(10),
.time-work-table td:nth-child(10) {
  width: 74px;
}

.time-work-table tbody tr.selected-row td {
  background: #eef5ff;
}

.time-row-number-cell {
  cursor: pointer;
  font-weight: 700;
}

.time-work-table input {
  width: 100%;
  min-height: 30px;
  border: 1px solid #aebdcc;
  padding: 3px 6px;
  font: inherit;
  background: #fff;
}

.time-name-input {
  text-align: center;
  font-weight: 700;
  color: #0f172a;
}

.time-blank-name-input {
  background: #ffffff;
  color: #0f172a;
}

.time-blank-name-input::placeholder {
  color: #9aa7b8;
  font-weight: 600;
}

.time-group-input {
  text-align: center;
  color: #1f2937;
}

.time-work-table input.time-input-error {
  border-color: #f29aa3;
  background: #fff1f2;
  color: #991b1b;
}

.time-work-table input.time-input-warning {
  border-color: #f2cf74;
  background: #fff8db;
  color: #8a5a00;
}

.time-empty-row input[disabled] {
  background: #f8fbff;
  color: transparent;
}

.time-empty-row .time-gender.blank {
  color: #94a3b8;
}

.time-restore-inline-btn {
  min-width: 52px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #2563eb;
}

.time-delete-row-btn {
  min-width: 64px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #c62828;
  white-space: nowrap;
}

.time-add-row-btn {
  min-width: 64px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #2563eb;
  white-space: nowrap;
}

.time-add-helper-row td {
  background: #fcfdff;
  border-top: 1px solid #e7eef7;
}

.time-add-helper-row td:first-child {
  height: 30px;
  padding: 0;
  border-right: 0;
  border-top: 1px solid #e7eef7;
}

.time-add-helper-row td:last-child {
  text-align: center;
  width: 86px;
  min-width: 86px;
  padding: 4px 0 6px;
  border-top: 1px solid #e7eef7;
  background: #fcfdff;
}

.time-add-helper-row .time-add-row-btn {
  border-color: #d7e5f6;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.04);
}

.time-work-table td:nth-child(5) input,
.time-work-table td:nth-child(6) input {
  max-width: 124px;
  text-align: center;
}

.time-work-table td:nth-child(7) input {
  max-width: 58px;
  text-align: center;
}

.time-row-check {
  width: 16px !important;
  height: 16px;
  min-height: 16px !important;
  accent-color: #3b82f6;
}

.time-select-all {
  width: 16px !important;
  height: 16px;
  min-height: 16px !important;
  accent-color: #3b82f6;
}

.time-gender {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 24px;
  font-weight: 700;
}

.time-gender.male {
  background: #dbeafe;
  color: #0f3f8c;
}

.time-gender.female {
  background: #fce7f3;
  color: #9d174d;
}

.employee-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--green);
  border-bottom: 1px solid var(--line);
}

.employee-panel {
  overflow: hidden;
  min-width: 0;
  border: 1px solid #d8e4f1;
  border-radius: 14px;
  background: #ffffff;
}

.employee-head h2 {
  margin: 0;
  font-size: 17px;
}

.employee-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.employee-head-actions #addEmployeeBtn {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #b9cff0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
  color: #2563eb;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.employee-layout {
  display: block;
  padding: 12px;
  min-width: 0;
  box-sizing: border-box;
}

.employee-panel-list-section {
  padding-top: 2px;
  min-width: 0;
}

.employee-content-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: stretch; width: 100%; min-width: 0; box-sizing: border-box; }
.employee-card { min-width: 0; height: 100%; min-height: 100%; border: 1px solid #d8e4f1; border-radius: 12px; background: #fff; }
.employee-list-card { width: 100%; padding: 12px; box-sizing: border-box; }
.employee-list-card .employee-list { border: 0; border-radius: 0; box-shadow: none; }
.employee-detail-card { display: flex; flex-direction: column; width: 100%; min-width: 0; max-height: 760px; overflow: auto; padding: 14px 16px; background: #fbfdff; box-sizing: border-box; }
.employee-detail-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid #e5edf6; }
.employee-detail-card-header h3 { margin: 0 0 7px; font-size: 18px; font-weight: 700; line-height: 1.3; color: #0f172a; }
.employee-detail-guide { margin: 14px 0 0; color: #64748b; font-size: 13px; line-height: 1.6; }
.employee-detail-card .employee-status-badge { min-height: 30px; padding: 0 10px; font-size: 13px; }
.employee-detail-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.employee-detail-tab { min-height: 36px; padding: 6px 8px; border: 1px solid #d8e4f1; border-radius: 8px; background: #fff; color: #526173; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.25; cursor: pointer; }
.employee-detail-tab:hover { border-color: #9fc4e8; background: #f8fbff; }
.employee-detail-tab:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.employee-detail-tab.active { border-color: #73aee1; background: #eaf4ff; color: #1d5f99; font-weight: 700; }
.employee-detail-tab-content { display: grid; flex: 1 1 auto; align-content: start; margin: 12px 0 0; }
.employee-detail-tab-content > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; min-height: 36px; padding: 10px 0; border-bottom: 1px solid #edf2f8; }
.employee-detail-tab-content > div:last-child { border-bottom: 0; }
.employee-detail-tab-content > div.wide { grid-column: 1 / -1; }
.employee-detail-tab-content dt { color: #748398; font-size: 13px; font-weight: 600; }
.employee-detail-tab-content dd { min-width: 0; margin: 0; color: #334155; font-size: 14px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }

.employee-list {
  display: block;
  max-height: 760px;
  overflow: auto;
  border: 1px solid #d8e4f1;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.employee-search {
  width: 100%;
  min-height: 40px;
  border: 1px solid #c9d9ea;
  border-radius: 12px;
  padding: 7px 38px 7px 12px;
  margin-bottom: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2393a4b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.employee-list-meta {
  margin: 0 0 10px;
  padding: 0 2px;
  color: #526173;
  font-size: 14px;
  font-weight: 700;
}

.employee-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.employee-pagination button {
  min-width: 64px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #c9d9ea;
  border-radius: 8px;
  background: #fff;
  color: #365278;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.employee-pagination button:disabled {
  cursor: default;
  opacity: 0.48;
}

.employee-pagination-status {
  min-width: 42px;
  color: #526173;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.employee-table {
  min-width: 920px;
}

.employee-table-head,
.employee-table-row {
  display: grid;
  grid-template-columns: 50px 120px 64px 135px 120px 120px 100px 76px 110px;
  align-items: center;
}

.employee-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  border-bottom: 1px solid #d8e4f1;
}

.employee-table-head span {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: #526173;
  font-size: 12px;
  font-weight: 800;
  border-right: 1px solid #e4ecf6;
}

.employee-table-head span:last-child {
  border-right: 0;
}

.employee-table-row {
  width: 100%;
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid #edf2f8;
  text-align: left;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.employee-table-row > span,
.employee-table-row > strong {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-right: 1px solid #edf2f8;
}

.employee-table-row > strong {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.employee-table-row > span:last-child {
  border-right: 0;
}

.employee-table-row:hover {
  background: #f8fbff;
}

.employee-table-row.active {
  background: linear-gradient(180deg, #f5f9ff 0%, #edf5ff 100%);
  box-shadow: inset 3px 0 0 #4f8df7;
}

.employee-table-row.active::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid #cfe0fb;
  pointer-events: none;
}

.employee-table-row.resigned {
  background: #fff7f8;
}

.employee-table-row.resigned strong,
.employee-table-row.resigned > span {
  color: #9f1239;
}

.employee-gender-badge,
.employee-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.employee-gender-badge.male {
  background: #dbeafe;
  color: #0f3f8c;
}

.employee-gender-badge.female {
  background: #fce7f3;
  color: #9d174d;
}

.employee-status-badge.active {
  background: #e8f8ee;
  color: #16703c;
}

.employee-status-badge.hold {
  background: #fff4db;
  color: #9a6700;
}

.employee-status-badge.resigned {
  background: #fdecef;
  color: #be123c;
}

.employee-table-manage {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  padding: 0 6px !important;
  flex: 0 0 110px;
  white-space: nowrap;
}

.employee-row-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.employee-row-detail-card {
  display: grid;
  flex: 1 1 240px;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  align-items: start;
  gap: 8px 12px;
  min-width: 0;
  max-width: none;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #d6e3ee;
  border-radius: 8px;
  background: #f8fbfe;
  box-sizing: border-box;
}

.employee-detail-item {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.employee-detail-item.wide {
  grid-column: span 2;
}

.employee-detail-label {
  color: #748398;
  font-size: 11px;
  font-weight: 800;
}

.employee-detail-value {
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-detail-item.wide .employee-detail-value {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.employee-detail-item.empty .employee-detail-value {
  color: #64748b;
  font-weight: 600;
}

@media (max-width: 1150px) {
  .employee-content-grid { grid-template-columns: minmax(0, 1fr); }
  .employee-card { height: auto; min-height: 0; }
  .employee-detail-card { max-width: none; max-height: none; }
  .employee-row-detail-card {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }
}

.employee-table-action {
  min-height: 30px;
  min-width: 48px;
  padding: 0 9px;
  border-radius: 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.employee-table-action.edit {
  border: 1px solid #bfd3f4;
  background: linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
  color: #2563eb;
}

.employee-table-action.delete {
  border: 1px solid #f3bec2;
  background: linear-gradient(180deg, #ffffff 0%, #fff1f2 100%);
  color: #dc2626;
}

.employee-table-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}

.quick-add-window,
.employee-popup-window {
  border: 1px solid #d8e4f1;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.quick-add-head,
.employee-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%);
  border-bottom: 1px solid #dbe6f2;
}

.quick-add-head strong,
.employee-popup-head strong {
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
}

.quick-add-close,
.popup-close {
  min-height: 36px;
  min-width: 68px;
  padding: 0 14px;
  border: 1px solid #c9d9ea;
  border-radius: 12px;
  background: #ffffff;
  color: #526173;
  font: inherit;
  font-weight: 800;
}

.quick-add-close:hover,
.popup-close:hover {
  background: #f8fbff;
  border-color: #bfd3f4;
}

.quick-add-body,
.employee-popup-form {
  padding: 18px;
}

.quick-add-label,
.employee-popup-form label {
  display: grid;
  gap: 6px;
  color: #6b7b8f;
  font-size: 13px;
  font-weight: 700;
}

.quick-add-label input,
.quick-add-label select,
.employee-popup-form input,
.employee-popup-form select,
.employee-popup-form textarea {
  min-height: 42px;
  border: 1px solid #c9d9ea;
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  background: #fff;
}

.employee-popup-form textarea {
  min-height: 124px;
}

.employee-popup-form-title {
  margin: -2px 0 10px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.quick-add-actions,
.employee-popup-form .form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf2f8;
}

.employee-popup-form [data-action="save"],
.quick-add-save {
  min-height: 42px;
  min-width: 88px;
  padding: 0 18px;
  border: 1px solid #2f6df3;
  border-radius: 13px;
  background: linear-gradient(180deg, #4b85ff 0%, #2f6df3 100%);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 12px 22px rgba(47, 109, 243, 0.22);
}

.employee-table-action.detail,
.employee-mobile-role,
.employee-mobile-affiliation,
.employee-mobile-phone,
.employee-mobile-empty { display: none; }

.employee-popup-form [data-action="cancel"] {
  min-height: 42px;
  min-width: 76px;
  padding: 0 16px;
  border: 1px solid #c9d9ea;
  border-radius: 13px;
  background: #ffffff;
  color: #526173;
  font: inherit;
  font-weight: 700;
}

.employee-popup-form [data-action="save"]:hover,
.quick-add-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(47, 109, 243, 0.26);
}

.save-status {
  margin-right: auto;
  color: #2563eb;
  font-size: 13px;
  font-weight: 800;
}

.employee-popup-form input[readonly] {
  background: #f2f7fd;
  color: #526173;
}

/* Employee add/edit popup: keep the header and actions visible while only fields scroll. */
.employee-popup {
  box-sizing: border-box;
  padding: 16px;
}

.employee-popup-window {
  display: flex;
  flex-direction: column;
  width: min(700px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  box-sizing: border-box;
  overflow: hidden;
}

.employee-popup-head {
  flex: 0 0 auto;
}

.employee-popup-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.employee-popup-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
}

.employee-popup-footer.form-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 18px;
  border-top: 1px solid #edf2f8;
  background: #ffffff;
}

@media (max-width: 760px) {
  .employee-popup {
    padding: 12px;
  }

  .employee-popup-window {
    width: min(700px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .employee-popup-body {
    padding: 14px;
  }

  .employee-popup-footer.form-actions {
    padding: 10px 14px;
  }
}

@media (max-width: 420px) {
  .employee-popup-footer.form-actions button {
    flex: 1 1 0;
    min-width: 0;
  }
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #edf2f8;
}


.save-status {
  color: #16703c;
  font-weight: 700;
  margin-right: auto;
}

.print-area {
  display: none;
}

.print-page {
  width: 100%;
  background: #fff;
  color: #000;
  font-size: 12px;
  padding: 8px;
  page-break-after: always;
}

.print-sheet-head {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  align-items: center;
  min-height: 46px;
  background: #fff;
  border: 1px solid #000;
  font-weight: 700;
  margin-bottom: 8px;
}

.print-date,
.print-company-name,
.print-total {
  padding: 8px 10px;
  text-align: center;
}

.print-company-name {
  font-size: 22px;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
}

.print-work-list {
  display: grid;
  gap: 6px;
}

.print-work-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  min-height: 58px;
  border: 1px solid #000;
  break-inside: avoid;
}

.print-work-info {
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 6px 8px;
  background: #fff;
  border-right: 1px solid #000;
  text-align: center;
}

.print-work-info strong {
  font-size: 15px;
}

.print-work-info span,
.print-work-info em {
  font-style: normal;
  font-size: 12px;
}

.print-work-names {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 5px;
  padding: 7px;
}

.print-name,
.print-empty {
  border: 0;
  min-width: 0;
  padding: 1px 10px 1px 0;
  text-align: left;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
}

.print-name.male {
  background: transparent;
  color: #0f3f8c;
}

.print-name.female {
  background: transparent;
  color: #9d174d;
}

.print-empty {
  background: #fff;
  color: #666;
}

.print-check-page {
  padding: 0;
}

.print-check-head {
  display: grid;
  grid-template-columns: 145px 1fr 290px;
  min-height: 62px;
  background: var(--green);
  border: 1px solid #000;
  border-bottom: 0;
}

.print-check-head > div {
  display: grid;
  place-items: center;
  border-right: 1px solid #000;
  font-weight: 700;
  font-size: 18px;
}

.print-check-head > div:last-child {
  border-right: 0;
}

.print-check-date {
  font-size: 20px;
}

.print-check-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: #000;
}

.print-check-table th,
.print-check-table td {
  border: 1px solid #000;
  height: 22px;
  text-align: center;
  vertical-align: middle;
  padding: 1px 3px;
  font-size: 13px;
  line-height: 1.1;
}

.print-check-table th {
  height: 34px;
  background: #fff;
  font-size: 14px;
  font-weight: 400;
}

.print-check-table th:nth-child(1),
.print-check-table td:nth-child(1) {
  width: 56px;
}

.print-check-table th:nth-child(2),
.print-check-table td:nth-child(2) {
  width: 96px;
}

.print-check-table th:nth-child(3),
.print-check-table td:nth-child(3) {
  width: 72px;
}

.print-check-table th:nth-child(4),
.print-check-table td:nth-child(4),
.print-check-table th:nth-child(5),
.print-check-table td:nth-child(5) {
  width: 78px;
}

.print-check-table th:nth-child(6),
.print-check-table td:nth-child(6) {
  width: 150px;
}

.print-check-table th:nth-child(7),
.print-check-table td:nth-child(7) {
  width: 220px;
}

.print-check-gender.male {
  background: #c6efce;
  color: #006100;
}

.print-check-gender.female {
  background: #ffc7ce;
  color: #c00000;
}

.print-check-summary.female td {
  background: #ffc7ce;
  color: #c00000;
}

.print-check-summary.male td {
  background: #c6efce;
  color: #006100;
}

.print-check-summary.total td {
  background: #ffff00;
  color: #000;
  font-weight: 700;
}

.print-page-all {
  padding: 7px;
  page-break-after: always;
}

.print-sheet-head.all {
  min-height: 42px;
  margin-bottom: 8px;
  background: #fff;
}

.print-sheet-head.all .print-company-name {
  font-size: 20px;
}

.print-all-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.print-company-card {
  border: 1px solid #000;
  break-inside: avoid;
  min-height: 0;
}

.print-company-card-head {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #000;
  padding: 5px 8px;
  font-weight: 700;
}

.print-company-card-head strong {
  font-size: 15px;
}

.print-company-card-head span {
  font-size: 12px;
  white-space: nowrap;
}

.print-company-card-groups {
  display: grid;
  gap: 4px;
  padding: 5px;
}

.print-company-card-group {
  display: grid;
  grid-template-columns: 98px 1fr;
  gap: 5px;
  align-items: start;
  border: 1px solid #b8b8b8;
  min-height: 34px;
}

.print-company-card-group b {
  height: 100%;
  background: #fff;
  border-right: 1px solid #b8b8b8;
  padding: 5px 6px;
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.print-company-card-group p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 5px;
}

.print-mini-name,
.print-mini-empty {
  border: 0;
  padding: 1px 6px 1px 0;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 700;
}

.print-mini-name.male {
  background: transparent;
  color: #0f3f8c;
}

.print-mini-name.female {
  background: transparent;
  color: #9d174d;
}

.print-mini-empty {
  background: #fff;
  color: #666;
}

.print-name-bank {
  margin-top: 7px;
  border: 1px solid #000;
  break-inside: avoid;
}

.print-name-bank-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border-bottom: 1px solid #000;
  padding: 5px 7px;
  font-weight: 700;
}

.print-name-bank-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 5px;
}

/* Modern management-system skin */
:root {
  --brand-navy: #071b3a;
  --brand-blue: #2563eb;
  --brand-blue-soft: #eef5ff;
  --brand-line: #d9e2ef;
  --brand-card: #ffffff;
  --brand-page: #f5f8fc;
  --brand-green: #0f9f6e;
  --brand-green-soft: #eaf8f1;
  --brand-red: #dc2626;
  --shadow-card: 0 10px 28px rgba(15, 23, 42, 0.06);
}

body {
  background:
    radial-gradient(circle at 18% -8%, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--brand-page) 100%);
  color: #0f172a;
}

button,
input,
select,
textarea {
  border-radius: 6px;
}

button {
  border-color: #c9d6e6;
  background: #fff;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

button:hover {
  background: var(--brand-blue-soft);
  border-color: #8fb4ff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

button:active {
  transform: translateY(1px);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
  background: #fff;
  border-bottom: 1px solid var(--brand-line);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.topbar > div:first-child {
  background: linear-gradient(135deg, #061a38 0%, #0b2d5e 100%);
  color: #fff;
  padding: 18px 20px;
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 12px;
}

h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

h1::before {
  content: "";
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.date-line {
  margin-top: 0;
  padding: 0;
  background: transparent;
  border: 0;
  gap: 7px;
}

.date-line button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: none;
}

.date-line button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.actions {
  max-width: none;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 16px 18px;
  background: #fff;
}

.topbar button {
  box-shadow: none;
  min-height: 38px;
  border-color: transparent;
  color: #1e293b;
  font-weight: 700;
}

.tab-btn {
  min-width: 88px;
}

.tab-btn.active {
  background: #eaf2ff;
  border-color: #9dbdff;
  color: #1d4ed8;
  box-shadow: inset 0 -3px 0 var(--brand-blue);
}

#saveBtn,
#printMenuBtn {
  border-color: #bcd0ea;
}

#saveBtn {
  background: var(--brand-green-soft);
  color: #057a55;
}

.layout {
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 92px);
}

.sidebar {
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid var(--brand-line);
  padding: 16px 14px;
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.03);
}

.side-head {
  color: #0f172a;
  font-size: 15px;
}

.side-head button {
  border-color: #9dbdff;
  background: #f2f7ff;
  color: var(--brand-blue);
  font-weight: 900;
}

.company-list {
  gap: 8px;
}

.company-item {
  border: 1px solid var(--brand-line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.company-item.active {
  background: #fff;
  border-color: #79a7ff;
  box-shadow: inset 4px 0 0 var(--brand-blue), 0 8px 18px rgba(37, 99, 235, 0.12);
}

.company-toggle {
  background: #f4f8fd;
  min-height: 38px;
  padding: 8px 10px;
}

.company-toggle:hover {
  background: #eaf2ff;
}

.company-group-link {
  border-color: #dce6f2;
  background: #fff;
  min-height: 27px;
  border-radius: 5px;
}

.workspace {
  padding: 18px;
}

.daily-overview,
.quick-bank,
  .metric,
.group-panel,
.time-head,
.time-work-table,
.dispatch-head,
.dispatch-bank,
.dispatch-table,
.employee-list,
.employee-head {
  border: 1px solid var(--brand-line);
  border-radius: 8px;
  background: var(--brand-card);
  box-shadow: var(--shadow-card);
}

.daily-overview,
.quick-bank {
  overflow: hidden;
}

.overview-head,
.quick-bank-head {
  background: linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%);
  border-bottom: 1px solid var(--brand-line);
  padding: 12px 14px;
}

.overview-head h2,
.quick-bank-head h2,
.time-head h2,
.dispatch-head h2,
.employee-head h2 {
  font-size: 17px;
  color: #0f172a;
  font-weight: 800;
}

.overview-total,
.dispatch-total {
  color: #0f172a;
  font-size: 15px;
}

.overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 10px;
  padding: 12px;
}

.overview-card {
  border-color: #d6e1ee;
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
}

.overview-card.active {
  outline: 0;
  border-color: #7ca8ff;
  box-shadow: inset 0 0 0 2px #4f8cff, 0 8px 18px rgba(37, 99, 235, 0.12);
}

.overview-company {
  background: #eaf2ff;
  border-bottom-color: #d6e1ee;
  min-height: 39px;
  padding: 8px 10px;
}

.overview-company strong {
  font-size: 15px;
  color: #0b2d5e;
}

.overview-company span {
  color: #334155;
}

.overview-group {
  border-bottom-color: #edf2f7;
  padding: 7px 9px;
}

.overview-group.active,
.group-panel.active {
  background: #f7fbff;
  outline: 2px solid #5b95ff;
  outline-offset: -2px;
}

.overview-names {
  gap: 5px;
}

.overview-names span,
.quick-name,
.name-cell .employee-chip {
  border-radius: 5px;
  font-weight: 700;
}

.quick-name,
.name-cell .employee-chip {
  min-height: 31px;
  padding: 4px 11px;
  font-size: 13px;
}

.overview-names span {
  min-height: 29px;
  padding: 4px 10px;
  font-size: 13px;
}

.quick-name-bank {
  height: 220px;
  min-height: 220px;
  max-height: 220px;
  overflow-y: scroll;
  padding: 10px 10px 28px;
  align-content: start;
}

.quick-name-bank {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
}

.quick-name-bank__gender-row {
  display: flex;
  align-items: flex-start;
  min-width: 0;
}

.quick-name-bank__gender-buttons {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.quick-bank.active {
  background: #fff;
  outline: 2px solid #75a7ff;
}

.name-search,
.company-search,
.dispatch-name-search,
.employee-search,
.employee-filters select,
.form-row input,
.form-row select input select textarea,
.group-head input {
  border-color: #cbd8e8;
  background-color: #fff;
}

.summary-band {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.employee-layout .employee-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 210px) minmax(190px, 210px);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #d6e3ee;
  border-radius: 10px;
  background: #f8fbfe;
  box-sizing: border-box;
}

.employee-layout .employee-filter-toolbar .employee-search {
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 0 38px 0 12px;
  border-radius: 8px;
  background-position: right 12px center;
}

.employee-layout .employee-filter-toolbar .employee-filters {
  display: contents;
  margin: 0;
}

.employee-layout .employee-filter-toolbar .employee-filter-field {
  display: block;
  min-width: 0;
}

.employee-layout .employee-filter-toolbar .employee-filters select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  line-height: 1.2;
}

@media (max-width: 780px) {
  .employee-list-card { padding: 10px; }
  .employee-detail-card { padding: 14px; }
  .employee-detail-tab-content > div { grid-template-columns: 1fr; gap: 3px; }
  .employee-table-manage {
    align-items: flex-start !important;
  }

  .employee-row-detail-card {
    flex-basis: 100%;
  }

  .employee-layout .employee-filter-toolbar {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }
  .employee-layout .employee-filter-toolbar .employee-search {
    grid-column: 1 / -1;
  }
}

/* Final cascade: compact schedule-only layout at phone and tablet widths. */
@media (max-width: 780px) {
  .layout:has(#attendanceView:not(.hidden)) .summary-band {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px;
  }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric {
    min-height: 64px !important;
    padding: 8px 7px !important;
    overflow: hidden;
    text-align: center;
  }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-full { display: none; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-mobile { display: inline; font-size: 11px !important; line-height: 1.2; white-space: nowrap; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric strong { font-size: 22px !important; }

  #attendanceView .overview-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 8px;
    padding: 12px 14px;
  }
  #attendanceView .overview-head-title { display: contents !important; }
  #attendanceView .overview-head h2 { grid-column: 1 !important; grid-row: 1 !important; margin: 0; min-width: 0; }
  #attendanceView .overview-total { grid-column: 2 !important; grid-row: 1 !important; justify-self: end; min-width: 0; margin: 0; white-space: nowrap; word-break: keep-all; }
  #attendanceView .overview-head-actions { grid-column: 1 / -1; grid-row: 2; }

  #attendanceView .overview-company { grid-template-columns: minmax(0, 1fr) auto 44px; min-height: 64px; }
  #attendanceView .overview-company-copy { display: grid; min-width: 0; gap: 3px; }
  #attendanceView .overview-company-sub { display: block; overflow: hidden; color: #64748b; font-size: 12px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  #attendanceView .overview-company-count { align-self: start; margin-top: 3px; }
}

/* Final dispatch precedence: the 390px header must retain its two-column action grid. */
@media (max-width: 780px) {
  #dispatchView .dispatch-head-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 360px) {
  .layout:has(#attendanceView:not(.hidden)) .summary-band { gap: 5px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric { padding: 7px 4px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-mobile { font-size: 10px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric strong { font-size: 20px !important; }
}

/* Program administrator authentication */
#appRoot[hidden],
#authScreen[hidden] { display: none !important; }
.auth-screen { display: grid; min-height: 100vh; padding: 24px; place-items: center; background: linear-gradient(145deg, #eff6ff, #f8fafc 54%, #e0f2fe); }
.auth-card { width: min(100%, 440px); padding: 32px; border: 1px solid #cfe1f7; border-radius: 18px; background: #fff; box-shadow: 0 18px 55px rgba(15, 74, 142, .15); }
.auth-card__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-card__head h1 { margin: 0; color: #0f3f76; font-size: 22px; }
.auth-card__head p { margin: 4px 0 0; color: #64748b; font-size: 13px; }
.auth-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: #2563eb; color: #fff; font-size: 21px; font-weight: 800; }
.auth-language select { min-height: 38px; padding: 0 8px; }
.auth-field { display: grid; gap: 6px; margin: 14px 0; color: #334155; font-size: 14px; font-weight: 700; }
.auth-field input { width: 100%; min-height: 46px; box-sizing: border-box; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; }
.auth-password-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.auth-password-wrap button { min-height: 42px; padding: 0 10px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 700; }
.auth-message { min-height: 20px; margin: 10px 0 0; color: #475569; font-size: 13px; line-height: 1.4; }
.auth-message--error { color: #b91c1c; font-weight: 700; }
.auth-submit { min-height: 46px; width: 100%; margin-top: 18px; border: 0; border-radius: 9px; background: #2563eb; color: #fff; font-weight: 800; cursor: pointer; }
.auth-submit:hover { background: #1d4ed8; }
.topbar .actions .header-utility {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0;
  margin-left: auto;
}

.topbar .actions .language-picker--header {
  flex: 0 0 auto;
  margin-left: 0;
}

.management-view { display: grid; gap: 14px; min-width: 0; }
.management-view.hidden { display: none !important; }
.management-view__head,
.management-card { border: 1px solid #dbe5f1; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(15,23,42,.05); }
.management-view__head { padding: 20px 22px; }
.management-view__head h2,
.management-card h3 { margin: 0; color: #172554; }
.management-view__head h2 { font-size: 22px; }
.management-view__head p { margin: 6px 0 0; color: #64748b; font-size: 13px; }
.management-view__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.management-card { display: grid; gap: 18px; padding: 20px 22px; }
.management-card h3 { font-size: 16px; }
.management-card header p { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 12px 0 0; color: #64748b; font-size: 13px; }
.management-card header p strong { color: #1e3a5f; font-size: 14px; }
.management-card__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.management-card__actions button { min-height: 44px; border: 1px solid #b9cff0; border-radius: 10px; background: #f4f8ff; color: #1d4ed8; font-weight: 800; }
.management-card__actions button:hover,
.management-card__actions button:focus-visible { border-color: #79a8e5; background: #eaf3ff; outline: none; }
.management-card--users { grid-column: 1 / -1; }
.management-card__title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.management-card__title-row > div { min-width: 0; }
.management-card__title-row header { display: block; }
.management-card--users header p { display: block; margin: 7px 0 0; line-height: 1.5; }
.management-primary-button { min-height: 44px; flex: 0 0 auto; padding: 0 14px; border: 1px solid #2563eb; border-radius: 10px; background: #2563eb; color: #fff; font-weight: 800; white-space: nowrap; }
.management-primary-button:hover,.management-primary-button:focus-visible { background: #1d4ed8; border-color: #1d4ed8; outline: none; }
.management-users-notice { min-height: 1.3em; margin: -8px 0 0; color: #64748b; font-size: 13px; }
.management-users-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.management-user-card { display: grid; gap: 13px; min-width: 0; padding: 16px; border: 1px solid #dbe5f1; border-radius: 12px; background: #fbfdff; }
.management-user-card.is-inactive { background: #fafafa; opacity: .78; }
.management-user-card__identity { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
.management-user-card__identity > div:first-child { display: grid; min-width: 0; gap: 3px; }
.management-user-card__identity strong { overflow: hidden; color: #1e3a5f; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.management-user-card__identity span:not(.management-user-badge) { overflow: hidden; color: #64748b; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.management-user-card__badges { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.management-user-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border: 1px solid #d8e5f6; border-radius: 999px; background: #f2f7ff; color: #28578f; font-size: 11px; font-weight: 800; white-space: nowrap; }
.management-user-badge.role-super_admin { border-color: #c7d8ff; background: #edf3ff; color: #1d4ed8; }
.management-user-badge.status-inactive { border-color: #e5e7eb; background: #f8fafc; color: #64748b; }
.management-user-card dl { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; color: #64748b; font-size: 12px; }
.management-user-card dl div { display: flex; gap: 5px; }
.management-user-card dt,.management-user-card dd { margin: 0; }
.management-user-card dd { color: #334155; }
.management-user-card__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.management-user-card__actions button,.admin-user-modal__tools button { min-height: 44px; border: 1px solid #bfd4f1; border-radius: 9px; background: #f8fbff; color: #1d4ed8; font-weight: 700; word-break: keep-all; }
.management-user-card__actions button:hover,.management-user-card__actions button:focus-visible,.admin-user-modal__tools button:hover,.admin-user-modal__tools button:focus-visible { background: #edf5ff; border-color: #87afe5; outline: none; }
.management-user-card__actions button:disabled { cursor: not-allowed; opacity: .48; }
.management-user-card__actions .management-user-card__danger { border-color: #f2cccc; background: #fff9f9; color: #b54747; }
.management-users-empty { margin: 0; padding: 22px; border: 1px dashed #d7e2ef; border-radius: 10px; color: #64748b; text-align: center; }
.admin-user-modal { width: min(460px, calc(100vw - 24px)); }
.admin-user-modal__tools { display: flex; justify-content: flex-start; }
.admin-user-modal__tools button { padding: 0 12px; }
.admin-user-modal__target { margin: 6px 0 0; color: #64748b; font-size: 13px; }
.management-card__actions .management-card__logout { border-color: #f4d2d2; background: #fff8f8; color: #b54747; }
.management-card__actions .management-card__logout:hover,
.management-card__actions .management-card__logout:focus-visible { border-color: #ecaaaa; background: #fff1f1; }
.management-card--future { background: #fbfdff; }
.management-card--future header p { display: block; margin-top: 8px; line-height: 1.5; }
.management-card__future-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.management-card__future-list li { padding: 10px 12px; border: 1px solid #e2eaf3; border-radius: 9px; color: #52657a; font-size: 14px; }
.auth-modal-overlay { position: fixed; z-index: 1300; inset: 0; display: grid; padding: 24px; place-items: center; background: rgba(15, 23, 42, .48); }
.auth-modal-overlay[hidden] { display: none; }
.auth-modal { width: min(100%, 440px); max-height: calc(100vh - 48px); overflow: auto; padding: 24px; border-radius: 14px; background: #fff; box-shadow: 0 20px 56px rgba(15, 23, 42, .28); }
.auth-modal h2 { margin: 0 0 16px; color: #0f3f76; font-size: 20px; }
.auth-policy { margin: 12px 0; color: #64748b; font-size: 13px; line-height: 1.5; }
.auth-modal__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.auth-modal__actions > button { min-height: 44px; border-radius: 9px; }
.auth-modal__actions > button:first-child { border: 1px solid #cbd5e1; background: #fff; color: #334155; }
.auth-modal__actions .auth-submit { margin: 0; }
body.auth-modal-open { overflow: hidden; }

@media (max-width: 780px) {
  .auth-screen { padding: 12px; }
  .auth-card { padding: 24px 18px; border-radius: 14px; }
  .auth-card__head { margin-bottom: 22px; }
  .management-view__head { padding: 16px; }
  .management-view__grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .management-card { gap: 14px; padding: 16px; }
  .auth-modal-overlay { padding: 12px; }
  .auth-modal { width: calc(100vw - 24px); max-height: calc(100vh - 24px); box-sizing: border-box; padding: 20px; }
}

/* Final company-card mobile precedence: site details and actions occupy full rows. */
@media (max-width: 780px) {
  .companies-view .companies-site-row { display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 10px !important; padding: 14px !important; }
  .companies-view .companies-site-row__name,
  .companies-view .companies-site-row__actions { width: 100% !important; }
  .companies-view .companies-site-row__actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .companies-view .companies-site-row__actions button { width: 100% !important; min-height: 44px !important; }
}

/* Mobile settlement header: preserve the live filter behavior while using less vertical space. */
@media (max-width: 780px) {
  #settlementView.settlement-view { padding: 8px !important; }
  #settlementView .settlement-panel { gap: 10px; padding: 12px !important; border-radius: 12px; }
  #settlementView .settlement-header { padding-bottom: 10px !important; }
  #settlementView .settlement-header h2 { margin-bottom: 3px; font-size: 20px; }
  #settlementView .settlement-header p { font-size: 12px; line-height: 1.35; }
  /* The panel already supplies a 10px row gap; this adds 4px for a calm 14px summary-to-tab separation. */
  #settlementView .settlement-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; margin: 0 0 4px !important; }
  #settlementView .settlement-summary-card { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; min-height: 58px !important; padding: 8px 10px !important; gap: 3px; }
  #settlementView .settlement-summary-card__label { overflow: hidden; font-size: 11px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  #settlementView .settlement-summary-card__value { display: block; overflow: hidden; color: #1e3a5f; font-size: 19px !important; font-variant-numeric: tabular-nums; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
  #settlementView .settlement-summary-card__unit { display: none; }
  #settlementView .settlement-summary-card--employee-count,
  #settlementView .settlement-summary-card--deduction,
  #settlementView .settlement-summary-card--net { display: none; }
  #settlementView .settlement-summary-card--gross { order: 1; }
  #settlementView .settlement-summary-card--paid { order: 2; }
  #settlementView .settlement-summary-card--unpaid { order: 3; }
  #settlementView .settlement-summary-card--review { order: 4; }

  #settlementView .settlement-tabs { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; gap: 8px; margin: 0; padding: 0; }
  #settlementView .settlement-tabs button { min-width: 0; min-height: 44px; padding: 7px 8px; border: 1px solid #93b8e7; border-radius: 9px; background: #fff; color: #1d5f99; font-size: 13px; font-weight: 800; line-height: 1.2; white-space: normal; word-break: keep-all; }
  #settlementView .settlement-tabs button.active { border-color: #2563eb; background: #2563eb; color: #fff; }

  #settlementView .settlement-filter-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; margin-bottom: 10px; padding: 12px !important; }
  #settlementView .settlement-filter-group { grid-template-rows: 17px 17px 42px; row-gap: 4px; }
  #settlementView .settlement-filter-group:not(.settlement-period-range) { grid-template-rows: 17px 42px; }
  #settlementView .settlement-filter-group__title,
  #settlementView .settlement-filter-group__label-row,
  #settlementView .settlement-filter-group__label-slot { height: 17px; line-height: 17px; }
  #settlementView .settlement-filter-group__title { font-size: 12px; }
  #settlementView .settlement-filter-group:not(.settlement-period-range) .settlement-filter-group__label-row { display: none; }
  #settlementView .settlement-filter-search,
  #settlementView .settlement-period-range { grid-column: 1 / -1; }
  #settlementView .settlement-filter-date,
  #settlementView .settlement-filter-confirmation { order: 1; }
  #settlementView .settlement-filter-search { order: 2; }
  #settlementView .settlement-filter-payment { order: 3; }
  #settlementView .settlement-filter-toolbar .settlement-filter-control,
  #settlementView .settlement-period-control,
  #settlementView .settlement-date-separator { height: 42px; min-height: 42px; }
  #settlementView .settlement-filter-toolbar .settlement-filter-control { padding: 0 11px; font-size: 13px; }
  #settlementView .settlement-filter-search__control .settlement-filter-control { padding-right: 38px; }
  #settlementView .settlement-filter-search__icon { right: 12px; width: 18px; height: 18px; }
  #settlementView .settlement-period-control { align-items: stretch; }
  #settlementView .settlement-date-separator { font-size: 14px; }

  /* Keep the employee settlement period as real, independent fields on small screens. */
  #settlementView .settlement-filter-toolbar { height: auto; min-height: 0; overflow: visible; padding-bottom: 14px; }
  #settlementView .settlement-period-range { grid-template-rows: 17px auto !important; row-gap: 6px; }
  #settlementView .settlement-period-range > .settlement-filter-group__label-row { display: none; }
  #settlementView .settlement-period-range > .settlement-filter-group__control { min-width: 0; }
  #settlementView .settlement-period-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); height: auto; min-height: 0; gap: 12px; }
  #settlementView .settlement-period-field { display: grid; grid-template-rows: 17px 42px; gap: 6px; min-width: 0; }
  #settlementView .settlement-period-mobile-label { display: block; height: 17px; color: #64748b; font-size: 11px; font-weight: 700; line-height: 17px; }
  #settlementView .settlement-period-field .settlement-filter-control { width: 100%; min-width: 0; height: 42px; box-sizing: border-box; }
  #settlementView .settlement-period-control .settlement-date-separator { display: none; }

  /* Empty settlement results should not reserve a desktop-sized blank panel on phones. */
  #settlementView .settlement-content:has(.settlement-empty) { min-height: 0; padding: 0; }
  #settlementView .settlement-empty { min-height: 88px; padding: 16px 14px; border: 1px dashed #cbd8e8; border-radius: 12px; background: #f8fbff; }
  #settlementView .settlement-empty strong { font-size: 14px; line-height: 1.4; }
  #settlementView .settlement-empty__detail { display: none; }
}

@media (max-width: 519px) {
  #settlementView .settlement-period-control { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

@media (max-width: 360px) {
  #settlementView .settlement-summary-card { min-height: 54px !important; padding: 8px !important; }
  #settlementView .settlement-summary-card__value { font-size: 17px !important; }
  #settlementView .settlement-tabs button { font-size: 12px; }
}

/* Mobile company and site cards: keep information above the touch actions. */
.companies-management-card__meta,
.companies-status-badge { display: none; }

@media (max-width: 780px) {
  .companies-view__head { gap: 8px; padding: 12px 14px; }
  .companies-view__head h2 { margin: 0; }
  .companies-view__head p { margin: 0; line-height: 1.4; }
  .companies-view__head button { width: 100%; }
  .companies-view__toolbar { gap: 6px; padding: 10px 14px; }
  .companies-view__toolbar input { width: 100%; min-height: 42px; }

  .companies-management-card > header,
  .companies-site-row { gap: 10px; padding: 14px; }
  .companies-site-row { display: flex; flex-direction: column; align-items: stretch; }
  .companies-management-card > header > .companies-management-card__summary,
  .companies-site-row__name { display: grid; width: 100%; min-width: 0; gap: 6px; }
  .companies-management-card > header > .companies-management-card__summary > .companies-management-card__title,
  .companies-site-row__title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; }
  .companies-management-card > header strong,
  .companies-site-row__name strong { display: -webkit-box; overflow: hidden; min-width: 0; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.35; text-overflow: ellipsis; white-space: normal; word-break: keep-all; }
  .companies-management-card > header strong { font-size: 16px; }
  .companies-site-row__name strong { font-size: 15px; }
  .companies-management-card__desktop-count { display: none; }
  .companies-management-card__meta { display: block; color: #64748b; font-size: 12px; font-weight: 700; line-height: 1.35; word-break: keep-all; }
  .companies-status-badge { display: inline-flex; flex: 0 0 auto; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #e8f5ee; color: #177346; font-size: 11px; font-weight: 800; line-height: 1; white-space: nowrap; }
  .companies-status-badge.is-inactive { background: #fff1e9; color: #c2410c; }
  .companies-site-row__time { display: block; margin: 0; overflow: hidden; color: #64748b; font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: normal; word-break: keep-all; }
  .companies-management-card__actions,
  .companies-site-row__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .companies-management-card__actions button,
  .companies-site-row__actions button { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 44px; padding: 8px; line-height: 1.25; text-align: center; white-space: normal; word-break: keep-all; }
  .companies-delete-button { color: #b42318 !important; border-color: #f4c7c3 !important; background: #fff6f5 !important; }
}

/* Compact employee workspace: keep the list first and show details only after selection. */
@media (max-width: 780px) {
  .layout:has(#employeeView:not(.hidden)) .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .layout:has(#employeeView:not(.hidden)) .summary-band .metric {
    min-height: 62px !important;
    padding: 8px 10px !important;
    border-radius: 11px !important;
  }

  .layout:has(#employeeView:not(.hidden)) .summary-band .metric::before {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    flex-basis: 34px !important;
    background-size: 16px 16px !important;
  }

  .layout:has(#employeeView:not(.hidden)) .summary-band .metric .metric-label-full { display: none !important; }
  .layout:has(#employeeView:not(.hidden)) .summary-band .metric .metric-label-mobile { display: inline !important; font-size: 11px !important; line-height: 1.2; white-space: nowrap; }
  .layout:has(#employeeView:not(.hidden)) .summary-band .metric strong { font-size: 20px !important; }

  #employeeView .employee-head { gap: 8px; padding: 10px 12px; }
  #employeeView .employee-head-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #employeeView .employee-head-actions button { min-width: 0; min-height: 44px; white-space: nowrap; }
  #employeeView .employee-layout { padding: 10px; }
  #employeeView .employee-layout .employee-filter-toolbar { gap: 8px; margin-bottom: 10px; padding: 8px; }
  #employeeView .employee-content-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #employeeView .employee-list-card { order: 1; padding: 10px; }
  #employeeView .employee-detail-card { order: 2; padding: 12px; }
  #employeeView .employee-detail-card:has(.employee-detail-guide) { display: none; }

  #employeeView .employee-table-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; margin: 8px 0; padding: 12px; }
  #employeeView .employee-table-row > span:nth-child(1),
  #employeeView .employee-table-row > span:nth-child(3),
  #employeeView .employee-table-row > span:nth-child(4),
  #employeeView .employee-table-row > span:nth-child(5),
  #employeeView .employee-table-row > span:nth-child(6),
  #employeeView .employee-table-row > span:nth-child(7) { display: none !important; }
  #employeeView .employee-table-row > strong { grid-column: 1; grid-row: 1; min-height: 30px; padding: 0; border: 0; }
  #employeeView .employee-table-row > span:nth-child(8) { grid-column: 2; grid-row: 1; min-height: 30px; padding: 0; border: 0; justify-self: end; }
  #employeeView .employee-mobile-role,
  #employeeView .employee-mobile-affiliation,
  #employeeView .employee-mobile-phone { display: block; grid-column: 1 / -1; min-height: 0; padding: 0; border: 0; color: #526173; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  #employeeView .employee-mobile-role::before,
  #employeeView .employee-mobile-affiliation::before,
  #employeeView .employee-mobile-phone::before { display: inline-block; min-width: 42px; margin-right: 6px; color: #748398; font-size: 11px; font-weight: 800; }
  #employeeView .employee-mobile-role::before { content: "역할"; }
  #employeeView .employee-mobile-affiliation::before { content: "소속"; }
  #employeeView .employee-mobile-phone::before { content: "연락처"; }
  #employeeView .employee-table-manage { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-column: 1 / -1; gap: 8px !important; padding: 0 !important; }
  #employeeView .employee-table-action.detail { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #bfd3f4; background: #f8fbff; color: #2563eb; }
  #employeeView .employee-table-manage button { width: 100%; min-width: 0; min-height: 44px; }
  #employeeView .employee-mobile-empty { display: grid; gap: 10px; padding: 18px 12px; text-align: center; color: #64748b; }
  #employeeView .employee-mobile-empty p { margin: 0; font-size: 14px; font-weight: 700; }
  #employeeView .employee-mobile-empty button { min-height: 44px; border: 1px solid #2563eb; border-radius: 10px; background: #2563eb; color: #fff; font: inherit; font-weight: 800; }
  #employeeView .employee-pagination button { min-height: 44px; }
}

@media (max-width: 360px) {
  .layout:has(#employeeView:not(.hidden)) .summary-band .metric { min-height: 54px !important; padding: 8px !important; }
  .layout:has(#employeeView:not(.hidden)) .summary-band .metric .metric-label-mobile { font-size: 10px !important; }
  .layout:has(#employeeView:not(.hidden)) .summary-band .metric strong { font-size: 18px !important; }
}

/* Dispatch mobile layout wins over earlier generic mobile toolbar rules. */
@media (max-width: 780px) {
  #dispatchView .dispatch-head-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Final dispatch precedence: the 390px header must retain its two-column action grid. */
@media (max-width: 780px) {
  #dispatchView .dispatch-head-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Final mobile dispatch layout: keep title, totals, actions, and route cards separate. */
.dispatch-mobile-route-summary,
.dispatch-mobile-passenger-head,
.dispatch-mobile-passenger-add-title,
.dispatch-mobile-passenger-details,
.dispatch-mobile-draft-actions { display: none; }

@media (max-width: 780px) {
  #dispatchView .dispatch-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "title"
      "summary"
      "actions";
    align-items: stretch !important;
    gap: 10px !important;
    padding: 14px 16px !important;
  }

  #dispatchView .dispatch-head h2 {
    grid-area: title !important;
    grid-column: auto !important;
    grid-row: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    overflow: hidden;
    text-align: left !important;
    text-overflow: ellipsis;
    white-space: nowrap !important;
    word-break: keep-all !important;
  }

  #dispatchView .dispatch-total {
    grid-area: summary !important;
    grid-column: auto !important;
    grid-row: auto !important;
    display: block !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    line-height: 1.45 !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: keep-all !important;
  }

  #dispatchView .dispatch-head-actions {
    grid-area: actions !important;
    grid-column: auto !important;
    grid-row: auto !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  #dispatchView .dispatch-head-actions > button,
  #dispatchView .dispatch-head-actions #mobileDispatchShortcutBtn,
  #dispatchView .dispatch-head-actions #addDispatchVehicleBtn {
    grid-column: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding-inline: 8px !important;
    white-space: normal !important;
    word-break: keep-all !important;
  }

  #dispatchView .dispatch-head-actions .time-copy-excel-btn { min-width: 0 !important; }

  #dispatchView .dispatch-bank {
    padding: 12px 14px 14px !important;
  }

  #dispatchView .dispatch-bank-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  #dispatchView .dispatch-bank-head strong,
  #dispatchView .dispatch-bank-head input {
    grid-column: auto !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  #dispatchView .dispatch-bank-head strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: keep-all;
  }

  #dispatchView .dispatch-bank-head input { min-height: 42px !important; }

  #dispatchView .dispatch-name-bank {
    min-height: 40px !important;
    padding: 8px !important;
  }

  #dispatchView .dispatch-sheet {
    overflow: hidden !important;
    padding: 10px !important;
  }

  #dispatchView .dispatch-mobile-route-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid #dbe7f5;
    border-radius: 12px;
    background: #f8fbff;
  }

  #dispatchView .dispatch-mobile-route-summary strong {
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
    color: #0f172a;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: keep-all;
  }

  #dispatchView .dispatch-mobile-route-summary span {
    min-width: 0;
    overflow: hidden;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: keep-all;
  }

  #dispatchView .dispatch-mobile-route-summary .dispatch-mobile-route-identity {
    grid-column: 1 / -1;
  }

  #dispatchView .dispatch-mobile-route-summary.is-dispatch-route-draft {
    border-style: dashed;
    background: #fffbeb;
  }

  #dispatchView .dispatch-mobile-route-summary .dispatch-mobile-route-setup-badge {
    grid-column: 1 / -1;
    color: #92400e;
  }

  #dispatchView .dispatch-mobile-route-settings {
    grid-column: 1 / -1;
    min-height: 40px;
    border: 1px solid #f0c36a;
    border-radius: 9px;
    background: #fff;
    color: #92400e;
    font: inherit;
    font-weight: 800;
  }

  #dispatchView .dispatch-sheet-meta {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    grid-template-areas:
      "select driver"
      ". company"
      ". vehicle"
      "actions actions" !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
    padding: 12px !important;
  }

  #dispatchView .dispatch-sheet-meta-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  #dispatchView .dispatch-sheet-meta-actions button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
  }

  #dispatchView .dispatch-sheet-table {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  #dispatchView.dispatch-view .dispatch-sheet-meta {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "driver"
      "company"
      "vehicle"
      "actions" !important;
  }

  #dispatchView.dispatch-view .dispatch-sheet-select,
  #dispatchView.dispatch-view .dispatch-add-vehicle-button { display: none !important; }

  #dispatchView.dispatch-view .dispatch-sheet-meta-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  #dispatchView.dispatch-view .dispatch-sheet-meta-item span {
    font-size: 12px;
  }

  #dispatchView.dispatch-view .dispatch-sheet-meta-item input {
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
  }

  #dispatchView.dispatch-view .dispatch-sheet-meta-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #dispatchView.dispatch-view .dispatch-delete-vehicle-button {
    border-color: #f3bec2;
    background: #fff5f5;
    color: #c2410c;
  }

  #dispatchView.dispatch-view .dispatch-sheet-table {
    overflow: visible !important;
    border: 0;
    background: transparent;
  }

  #dispatchView.dispatch-view .dispatch-sheet-table table,
  #dispatchView.dispatch-view .dispatch-sheet-table tbody,
  #dispatchView.dispatch-view .dispatch-sheet-table tfoot {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  #dispatchView.dispatch-view .dispatch-sheet-table thead { display: none; }

  #dispatchView.dispatch-view .dispatch-passenger-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 10px;
    margin: 10px 0;
    padding: 13px;
    border: 1px solid #dbe7f5;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 55, 95, .05);
  }

  #dispatchView.dispatch-view .dispatch-passenger-row > td {
    display: none;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
  }

  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-name,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-note,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-row-delete {
    display: block;
    grid-column: 1 / -1;
  }

  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-start,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-group,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-ride-time,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-address {
    display: grid;
    min-width: 0;
    gap: 5px;
  }

  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-start::before,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-group::before,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-note::before,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-ride-time::before,
  #dispatchView.dispatch-view .dispatch-passenger-row > td.dispatch-col-address::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
  }

  #dispatchView.dispatch-view .dispatch-passenger-row .dispatch-row-input {
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
  }

  #dispatchView.dispatch-view .dispatch-passenger-row .dispatch-row-name {
    font-size: 16px;
    font-weight: 800;
  }

  #dispatchView.dispatch-view .dispatch-mobile-passenger-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
  }

  #dispatchView.dispatch-view .dispatch-mobile-passenger-order,
  #dispatchView.dispatch-view .dispatch-mobile-passenger-gender {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef4ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
  }

  #dispatchView.dispatch-view .dispatch-mobile-passenger-gender.female { background: #fff1f5; color: #be185d; }
  #dispatchView.dispatch-view .dispatch-mobile-passenger-gender.neutral { background: #f1f5f9; color: #64748b; }

  #dispatchView.dispatch-view .dispatch-mobile-passenger-details {
    display: grid;
    gap: 4px;
    margin-top: 7px;
  }

  #dispatchView.dispatch-view .dispatch-mobile-passenger-location,
  #dispatchView.dispatch-view .dispatch-mobile-passenger-status {
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: keep-all;
  }

  #dispatchView.dispatch-view .is-dispatch-passenger-draft {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 12px;
    border-style: dashed;
    background: #f8fbff;
  }

  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td { display: none; }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-name,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-note,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-row-delete,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-start,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-ride-time,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-group,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-address {
    width: auto !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-name,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-note,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-row-delete {
    display: block;
    grid-column: 1 / -1;
    width: 100% !important;
  }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-start,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-ride-time,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-group,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-address {
    display: grid;
    min-width: 0;
    gap: 5px;
  }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft .dispatch-mobile-passenger-head,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft .dispatch-mobile-passenger-details { display: none; }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft .dispatch-mobile-passenger-add-title {
    display: block;
    margin-bottom: 5px;
    color: #1d4ed8;
    font-size: 14px;
  }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft .dispatch-row-input {
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
  }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft .dispatch-row-action-stack { display: none; }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft .dispatch-mobile-draft-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
  }
  #dispatchView.dispatch-view .dispatch-cancel-row-button,
  #dispatchView.dispatch-view .dispatch-submit-row-button {
    min-width: 0;
    min-height: 44px;
    border-radius: 10px;
    font: inherit;
    font-weight: 800;
  }
  #dispatchView.dispatch-view .dispatch-cancel-row-button {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
  }
  #dispatchView.dispatch-view .dispatch-submit-row-button {
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #fff;
  }

  #dispatchView.dispatch-view .dispatch-sheet-table tfoot {
    margin-top: 10px;
  }

  #dispatchView.dispatch-view .dispatch-add-row-footer,
  #dispatchView.dispatch-view .dispatch-add-row-footer > td {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
  }

  #dispatchView.dispatch-view .dispatch-add-row-footer td:first-child { display: none; }
  #dispatchView.dispatch-view .dispatch-add-row-footer .dispatch-col-row-delete { display: block; }
  #dispatchView.dispatch-view .dispatch-add-row-button,
  #dispatchView.dispatch-view .dispatch-delete-row-button {
    width: 100%;
    min-height: 44px;
  }

  #dispatchView.dispatch-view tbody:has(.is-dispatch-passenger-draft) + tfoot { display: none; }
}

@media (max-width: 360px) {
  #dispatchView.dispatch-view .is-dispatch-passenger-draft {
    grid-template-columns: minmax(0, 1fr);
  }
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-start,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-ride-time,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-group,
  #dispatchView.dispatch-view .is-dispatch-passenger-draft > td.dispatch-col-address {
    grid-column: 1 / -1;
  }
}

/* Final cascade for the attendance worker cards. */
@media (max-width: 780px) {
  #timeView .time-toolbar { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 8px !important; }
  #timeView .time-toolbar-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; flex-direction: unset !important; gap: 8px !important; width: 100% !important; }
  #timeView .time-toolbar-actions > * { min-width: 0 !important; min-height: 44px !important; }
  #timeView .time-work-table, #timeView .time-work-table table, #timeView .time-work-table tbody { overflow: visible !important; width: 100% !important; min-width: 0 !important; }
  #timeView .time-work-table table, #timeView .time-work-table tbody { display: block !important; }
  #timeView .time-work-table thead { display: none !important; }
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) { position: relative; display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; margin: 10px 0 !important; padding: 14px !important; border: 1px solid #dbe7f5 !important; border-radius: 14px !important; background: #fff !important; box-shadow: 0 3px 12px rgba(15,55,95,.05) !important; }
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td { display: none !important; min-width: 0 !important; padding: 0 !important; border: 0 !important; }
  #timeView .time-work-table .time-name-cell, #timeView .time-work-table .time-company-cell, #timeView .time-work-table .time-start-cell, #timeView .time-work-table .time-end-cell, #timeView .time-work-table .overtime-cell, #timeView .time-work-table .time-memo-cell, #timeView .time-work-table .time-delete-cell { display: flex !important; min-width: 0 !important; }
  #timeView .time-work-table .time-name-cell, #timeView .time-work-table .time-company-cell, #timeView .time-work-table .overtime-cell, #timeView .time-work-table .time-memo-cell, #timeView .time-work-table .time-delete-cell { grid-column: 1 / -1 !important; }
  #timeView .time-work-table .time-name-cell { align-items: center; }
  #timeView .time-work-table .time-mobile-card-head { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; }
  #timeView .time-work-table .time-mobile-worker-name { overflow: hidden; color: #172033; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
  #timeView .time-work-table .time-mobile-status { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: #eef4ff; color: #2563eb; font-size: 12px; font-weight: 800; white-space: nowrap; }
  #timeView .time-work-table .time-mobile-status.pending { background: #fff4e8; color: #c2410c; }
  #timeView .time-work-table .time-name-input, #timeView .time-work-table .attendance-review-badge, #timeView .time-work-table .time-select-cell, #timeView .time-work-table .time-row-number-cell, #timeView .time-work-table .time-gender-cell, #timeView .time-work-table .time-workgroup-cell { display: none !important; }
  #timeView .time-work-table .time-company-cell .time-static-company { display: none !important; }
  #timeView .time-work-table .time-mobile-company-site { display: block !important; overflow: hidden; width: 100%; color: #64748b; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  #timeView .time-work-table .time-start-cell, #timeView .time-work-table .time-end-cell, #timeView .time-work-table .overtime-cell, #timeView .time-work-table .time-memo-cell { flex-direction: column; gap: 5px; }
  #timeView .time-work-table .time-start-cell::before, #timeView .time-work-table .time-end-cell::before, #timeView .time-work-table .overtime-cell::before, #timeView .time-work-table .time-memo-cell::before { color: #64748b; content: attr(data-label); font-size: 12px; font-weight: 800; }
  #timeView .time-work-table .time-start-cell input, #timeView .time-work-table .time-end-cell input, #timeView .time-work-table .overtime-cell input, #timeView .time-work-table .time-memo-cell input { width: 100% !important; max-width: 100% !important; min-height: 42px !important; box-sizing: border-box; }
  #timeView .time-work-table .time-delete-cell { justify-content: flex-end; }
  #timeView .time-work-table .time-delete-row-btn, #timeView .time-work-table .time-add-row-btn { min-height: 42px !important; }
  #timeView .time-work-table .time-add-helper-row { display: block !important; margin: 10px 0 0 !important; }
  #timeView .time-work-table .time-add-helper-row td { display: block !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
  #timeView .time-work-table .time-add-row-btn { width: 100% !important; }
}
@media (max-width: 360px) { #timeView .time-work-table .time-start-cell, #timeView .time-work-table .time-end-cell { grid-column: 1 / -1 !important; } }

/* Mobile attendance cards: preserve the desktop table and make each worker one card. */
@media (max-width: 780px) {
  #timeView .time-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  #timeView .time-toolbar > p { min-width: 0; white-space: normal; word-break: keep-all; }
  #timeView .time-toolbar-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  #timeView .time-toolbar-actions > * { min-width: 0; min-height: 44px; }
  #timeView .time-work-table { overflow: visible !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
  #timeView .time-work-table table, #timeView .time-work-table tbody { display: block !important; width: 100% !important; min-width: 0 !important; }
  #timeView .time-work-table thead { display: none !important; }
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) {
    position: relative;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 10px 0;
    padding: 14px;
    border: 1px solid #dbe7f5;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 55, 95, .05);
  }
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td { display: none !important; min-width: 0; padding: 0 !important; border: 0 !important; }
  #timeView .time-work-table .time-row-number-cell,
  #timeView .time-work-table .time-select-cell,
  #timeView .time-work-table .time-gender-cell,
  #timeView .time-work-table .time-workgroup-cell { display: none !important; }
  #timeView .time-work-table .time-name-cell,
  #timeView .time-work-table .time-company-cell,
  #timeView .time-work-table .time-start-cell,
  #timeView .time-work-table .time-end-cell,
  #timeView .time-work-table .overtime-cell,
  #timeView .time-work-table .time-memo-cell,
  #timeView .time-work-table .time-delete-cell { display: flex !important; min-width: 0; }
  #timeView .time-work-table .time-name-cell { grid-column: 1 / -1; align-items: center; }
  #timeView .time-work-table .time-mobile-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; }
  #timeView .time-work-table .time-mobile-worker-name { overflow: hidden; color: #172033; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
  #timeView .time-work-table .time-mobile-status { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: #eef4ff; color: #2563eb; font-size: 12px; font-weight: 800; white-space: nowrap; }
  #timeView .time-work-table .time-mobile-status.pending { background: #fff4e8; color: #c2410c; }
  #timeView .time-work-table .time-name-input,
  #timeView .time-work-table .attendance-review-badge { display: none !important; }
  #timeView .time-work-table .time-company-cell { grid-column: 1 / -1; }
  #timeView .time-work-table .time-company-cell .time-static-company { display: none !important; }
  #timeView .time-work-table .time-mobile-company-site { display: block; overflow: hidden; width: 100%; color: #64748b; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  #timeView .time-work-table .time-start-cell,
  #timeView .time-work-table .time-end-cell,
  #timeView .time-work-table .overtime-cell,
  #timeView .time-work-table .time-memo-cell { flex-direction: column; gap: 5px; }
  #timeView .time-work-table .time-start-cell::before,
  #timeView .time-work-table .time-end-cell::before,
  #timeView .time-work-table .overtime-cell::before,
  #timeView .time-work-table .time-memo-cell::before { color: #64748b; content: attr(data-label); font-size: 12px; font-weight: 800; }
  #timeView .time-work-table .time-start-cell input,
  #timeView .time-work-table .time-end-cell input,
  #timeView .time-work-table .overtime-cell input,
  #timeView .time-work-table .time-memo-cell input { width: 100% !important; max-width: 100% !important; min-height: 42px !important; box-sizing: border-box; }
  #timeView .time-work-table .overtime-cell,
  #timeView .time-work-table .time-memo-cell,
  #timeView .time-work-table .time-delete-cell { grid-column: 1 / -1; }
  #timeView .time-work-table .time-delete-cell { justify-content: flex-end; }
  #timeView .time-work-table .time-delete-row-btn { min-height: 42px; }
  #timeView .time-work-table .time-add-helper-row { display: block !important; margin: 10px 0 0; }
  #timeView .time-work-table .time-add-helper-row td { display: block !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
  #timeView .time-work-table .time-add-row-btn { width: 100%; min-height: 44px; }
}

@media (max-width: 360px) {
  #timeView .time-work-table .time-start-cell,
  #timeView .time-work-table .time-end-cell { grid-column: 1 / -1; }
}

/* Keep the schedule-specific overrides after every earlier mobile rule. */
@media (max-width: 780px) {
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-full { display: none !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-mobile { display: inline !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric { gap: 4px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric::before { width: 30px !important; height: 30px !important; min-width: 30px !important; flex-basis: 30px !important; background-size: 16px 16px !important; }
  #attendanceView .overview-head-title { display: contents !important; }
  #attendanceView .overview-head h2 { grid-column: 1 !important; grid-row: 1 !important; }
  #attendanceView .overview-total { grid-column: 2 !important; grid-row: 1 !important; justify-self: end !important; }
}

/* Mobile schedule compact refinement, deliberately scoped to the schedule view. */
@media (max-width: 780px) {
  .layout:has(#attendanceView:not(.hidden)) .summary-band {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px;
  }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric {
    min-height: 64px !important;
    padding: 8px 7px !important;
    text-align: center;
  }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric span { font-size: 11px !important; white-space: nowrap; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric strong { font-size: 22px !important; }

  #attendanceView .overview-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 8px;
    padding: 12px 14px;
  }
  #attendanceView .overview-head-title { display: contents !important; }
  #attendanceView .overview-head h2 { grid-column: 1; grid-row: 1; margin: 0; min-width: 0; }
  #attendanceView .overview-total { grid-column: 2; grid-row: 1; min-width: 0; margin: 0; white-space: nowrap; word-break: keep-all; }
  #attendanceView .overview-head-actions { grid-column: 1 / -1; grid-row: 2; }

  #attendanceView .overview-company { grid-template-columns: minmax(0, 1fr) auto 44px; min-height: 64px; }
  #attendanceView .overview-company-copy { min-width: 0; display: grid; gap: 3px; }
  #attendanceView .overview-company-sub { display: block; overflow: hidden; color: #64748b; font-size: 12px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  #attendanceView .overview-company-count { align-self: start; margin-top: 3px; }
}

/* Dispatch mobile layout final precedence. */
@media (max-width: 780px) {
  #dispatchView.dispatch-view .dispatch-head-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 360px) {
  .layout:has(#attendanceView:not(.hidden)) .summary-band { gap: 5px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric { padding: 7px 4px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric span { font-size: 10px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric strong { font-size: 20px !important; }
}

/* 390px first-pass refinement: compact summaries and prevent Korean character wrapping. */
@media (max-width: 780px) {
  .summary-band, .time-summary-grid, .settlement-summary-grid { gap: 8px; }
  .summary-band .metric, .time-summary-card, .settlement-summary-card {
    min-height: 58px;
    padding: 9px 10px;
    border-radius: 11px;
  }
  .summary-band .metric span, .time-summary-card .summary-card__label, .settlement-summary-card__label { font-size: 11px; line-height: 1.2; }
  .summary-band .metric strong, .time-summary-card strong, .settlement-summary-card strong { font-size: 19px; line-height: 1.1; }
  .summary-band .metric, .time-summary-card, .settlement-summary-card { min-width: 0; overflow: hidden; }

  .overview-head-actions, .attendance-overview-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100%;
  }
  #attendanceView .overview-head-actions button,
  #attendanceView .attendance-overview-filter button,
  .time-toolbar-actions button,
  .dispatch-head-actions button,
  .employee-head-actions button,
  .companies-management-card__actions button,
  .companies-site-row__actions button {
    min-width: 0;
    min-height: 44px;
    overflow-wrap: normal;
    white-space: normal;
    word-break: keep-all;
  }
  #attendanceView .overview-head-actions > *, #attendanceView .attendance-overview-filter > * { width: 100%; }

  .layout:has(#timeView:not(.hidden)) { grid-template-columns: minmax(0, 1fr); }
  .layout:has(#timeView:not(.hidden)) > .sidebar { display: none; }
  .layout:has(#dispatchView:not(.hidden)) { grid-template-columns: minmax(0, 1fr); }
  .layout:has(#dispatchView:not(.hidden)) > .sidebar { display: none; }
  #timeView .time-toolbar-actions { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  #timeView .time-toolbar { gap: 8px; }

  #dispatchView .dispatch-head { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  #dispatchView .dispatch-head h2, #dispatchView .dispatch-total, #dispatchView .dispatch-head-actions { grid-column: auto; grid-row: auto; width: auto; text-align: left; justify-self: stretch; }
  #dispatchView .dispatch-total { display: block; padding: 9px 10px; border-radius: 9px; background: rgba(255,255,255,.58); font-size: 13px; line-height: 1.35; white-space: normal; word-break: keep-all; }
  #dispatchView .dispatch-head-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dispatchView .dispatch-head-actions #mobileDispatchShortcutBtn { grid-column: 1 / -1; }
  #dispatchView .dispatch-head-actions #addDispatchVehicleBtn { grid-column: 1 / -1; width: 100%; }

  .companies-site-row__name { display: block; width: 100%; min-width: 0; }
  .companies-site-row__name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  .companies-site-row__time { display: block; margin-top: 4px; white-space: normal; word-break: keep-all; }
  .companies-site-row__actions { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .employee-head { align-items: stretch; flex-direction: column; }
  .employee-head-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .employee-detail-card:has(.employee-detail-guide) { order: 2; min-height: 0; max-height: none; padding: 10px 12px; }
  .employee-detail-card:has(.employee-detail-guide) .employee-detail-card-header { display: none; }
  .employee-detail-card:has(.employee-detail-guide) .employee-detail-guide { margin: 0; font-size: 12px; }
  .employee-list-card { order: 1; }

  .settlement-panel { gap: 10px; }
  .settlement-summary-grid { margin: 0; }
  .settlement-summary-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 6px; }
  .settlement-summary-card__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .settlement-summary-card__unit { font-size: 11px; }

  .workspace, .workspace * { min-width: 0; }
  .workspace button, .workspace .settlement-status-badge { word-break: keep-all; }
}

@media (max-width: 390px) {
  .summary-band .metric, .time-summary-card, .settlement-summary-card { min-height: 54px; padding: 8px; }
  .summary-band .metric strong, .time-summary-card strong, .settlement-summary-card strong { font-size: 18px; }
}

/* Mobile dispatch summary: use the same compact card scale as attendance. */
@media (max-width: 780px) {
  .layout:has(#dispatchView:not(.hidden)) .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .layout:has(#dispatchView:not(.hidden)) .summary-band .metric {
    min-height: 62px !important;
    padding: 8px 10px !important;
    border-radius: 11px !important;
  }

  .layout:has(#dispatchView:not(.hidden)) .summary-band .metric::before {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    flex-basis: 34px !important;
    background-size: 16px 16px !important;
  }

  .layout:has(#dispatchView:not(.hidden)) .summary-band .metric .metric-label-full { display: none !important; }
  .layout:has(#dispatchView:not(.hidden)) .summary-band .metric .metric-label-mobile {
    display: inline !important;
    font-size: 11px !important;
    line-height: 1.2;
    white-space: nowrap;
  }

  .layout:has(#dispatchView:not(.hidden)) .summary-band .metric strong { font-size: 20px !important; }
}

@media (max-width: 360px) {
  .layout:has(#dispatchView:not(.hidden)) .summary-band .metric { min-height: 54px !important; padding: 8px !important; }
  .layout:has(#dispatchView:not(.hidden)) .summary-band .metric .metric-label-mobile { font-size: 10px !important; }
  .layout:has(#dispatchView:not(.hidden)) .summary-band .metric strong { font-size: 18px !important; }
}

/* Strengthen the 390px visual hierarchy against older summary and toolbar rules. */
@media (max-width: 780px) {
  .summary-band .metric,
  .time-summary-grid .summary-card,
  .settlement-summary-grid .settlement-summary-card {
    min-height: 62px !important;
    padding: 8px 10px !important;
  }
  .summary-band .metric .summary-card__icon,
  .time-summary-grid .summary-card__icon { width: 34px; height: 34px; }
  .time-summary-grid .summary-card__number { gap: 3px; }
  .time-summary-grid .summary-card__value { font-size: 20px !important; }

  #attendanceView .overview-head-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch;
    width: 100% !important;
    gap: 8px !important;
  }
  #attendanceView .attendance-overview-filter { display: contents !important; }
  #attendanceView .overview-head-actions button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 7px 9px !important;
    text-align: center;
    white-space: normal !important;
    word-break: keep-all !important;
  }

  #dispatchView .dispatch-head-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    gap: 8px;
  }
  #dispatchView .dispatch-head-actions > button,
  #dispatchView .dispatch-head-actions #addDispatchVehicleBtn {
    grid-column: auto !important;
    width: 100% !important;
    min-height: 44px;
  }
}

.metric {
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.metric strong {
  color: #0f172a;
  font-size: 25px;
}

.metric.total {
  background: var(--brand-green-soft);
  border-color: #b7ead3;
}

.group-panel {
  overflow: hidden;
}

.group-head {
  background: #fff7ed;
  border-bottom-color: var(--brand-line);
  padding: 10px;
}

.gender-head.male,
.gender-head.female,
.gender-head.mixed {
  background: #fff9e7;
  color: #b91c1c;
}

.name-list {
  background: #fff;
}

.name-cell {
  border-color: #e3ebf5;
}

.time-head,
.dispatch-head,
.employee-head {
  padding: 14px;
}

.dispatch-bank,
.dispatch-table,
.time-work-table,
.employee-list {
  overflow: hidden;
}

table {
  border-collapse: collapse;
}

th {
  background: #f4f8fd;
  color: #334155;
}

td,
th {
  border-color: #e3ebf5;
}

/* Compact topbar repair */
.topbar {
  grid-template-columns: minmax(620px, 760px) minmax(460px, 1fr);
  align-items: stretch;
  min-height: 104px;
}

.topbar > div:first-child {
  min-height: 104px;
  padding: 14px 18px;
  align-content: center;
}

.date-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-line button {
  width: 100%;
  padding: 0 8px;
  white-space: nowrap;
}

.actions {
  min-height: 104px;
  align-content: center;
  align-items: center;
}

.topbar .actions button {
  min-height: 36px;
  padding: 0 14px;
}

/* Topbar polish pass */
.topbar {
  grid-template-columns: minmax(720px, 760px) minmax(520px, 1fr);
  min-height: 126px;
  background: #ffffff;
  border-bottom: 1px solid #dce7f3;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.topbar > div:first-child {
  min-height: 126px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #061a38 0%, #0b2d5e 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

h1 {
  gap: 12px;
  font-size: 24px;
  letter-spacing: 0;
}

h1::before {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border-color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
}

.date-line {
  gap: 12px;
}

.date-line button {
  min-height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(191, 219, 254, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
  box-shadow: none;
  font-weight: 700;
}

.date-line button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(191, 219, 254, 0.65);
}

.actions {
  min-height: 126px;
  padding: 0 22px;
  align-items: center;
  align-content: center;
  gap: 10px;
}

.topbar .actions button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #0f172a;
  box-shadow: none;
  font-weight: 800;
}

.topbar .actions button:hover {
  background: #f3f7ff;
  border-color: #c7d8ff;
}

.topbar .actions .tab-btn.active {
  background: #eaf2ff;
  border-color: #8db4ff;
  color: #1d4ed8;
  box-shadow: inset 0 -3px 0 #2563eb;
}

#saveBtn {
  background: #ecfdf5;
  border-color: #b7ead3;
  color: #047857;
}

#printMenuBtn {
  background: #ffffff;
  border-color: #bcd0ea;
}

/* White dashboard topbar only */
.topbar {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) auto;
  align-items: start;
  gap: 22px;
  min-height: 138px;
  padding: 26px 30px 22px;
  background: #ffffff;
  border-bottom: 1px solid #dde7f2;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.topbar > div:first-child {
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: #0f172a;
  display: block;
}

h1 {
  margin: 0 0 18px;
  color: #0f172a;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.15;
  gap: 12px;
  display: flex;
  align-items: center;
}

h1::before {
  content: "";
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 88 88'%3E%3Cdefs%3E%3ClinearGradient id='b' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%231a84d8'/%3E%3Cstop offset='1' stop-color='%230f67b3'/%3E%3C/linearGradient%3E%3ClinearGradient id='p' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%23ff77ba'/%3E%3Cstop offset='1' stop-color='%23e95ca2'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='28' cy='23' r='12' fill='url(%23b)'/%3E%3Ccircle cx='56' cy='30' r='11' fill='url(%23p)'/%3E%3Cpath d='M11 69c2-18 7-25 17-25h12c10 0 15 7 17 25 1 4-2 8-7 8H18c-5 0-8-4-7-8Z' fill='url(%23b)'/%3E%3Cpath d='M34 73c2-16 7-22 16-22h13c9 0 15 6 17 22 1 4-2 8-7 8H41c-5 0-8-4-7-8Z' fill='url(%23p)'/%3E%3C/svg%3E");
}

.date-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  flex-wrap: wrap;
}

.work-date-picker {
  position: relative;
  width: 260px;
  min-width: 260px;
  height: 48px;
  min-height: 48px;
}

#workDateDisplay {
  box-sizing: border-box;
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 46px 0 14px;
  border: 1px solid #cbd8e8;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

#workDateDisplay:focus {
  border-color: #6b9fea;
  outline: 3px solid rgba(59, 130, 246, 0.16);
}

#workDatePickerBtn {
  position: absolute;
  top: 1px;
  right: 1px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border: 0;
  border-left: 1px solid #e2e8f0;
  border-radius: 0 7px 7px 0;
  background: transparent;
  box-shadow: none;
  font-size: 19px;
  cursor: pointer;
}

#workDatePickerBtn:hover {
  background: #f3f7ff;
}

#workDate.work-date-native {
  position: absolute;
  right: 42px;
  bottom: 1px;
  width: 1px;
  min-width: 1px;
  height: 1px;
  min-height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.date-move-notice {
  display: none;
  flex: 1 1 260px;
  align-items: flex-start;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.date-move-notice.show {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.date-move-notice.is-past {
  border-color: #fdba74;
  background: #fff7ed;
  color: #c2410c;
}

.date-move-notice__title {
  font-size: 13px;
  font-weight: 800;
}

.date-move-notice__message {
  color: inherit;
  font-size: 12px;
  font-weight: 600;
}

/* Keep date controls stable while the work-date notice changes. */
.date-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: min(100%, 860px);
  min-width: 0;
}

.date-toolbar__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: visible;
}

.date-tool-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  flex: 0 0 auto;
  width: 150px;
  min-width: 0;
  padding: 9px;
  border: 1px solid #d8e3ef;
  border-radius: 10px;
  background: #f8fbff;
  box-sizing: border-box;
}

.import-tools-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 142px;
}

.import-tools-undo-badge {
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff0e5;
  color: #c2410c;
  font-size: 10px;
  font-weight: 800;
}

.import-tools-panel {
  width: min(100%, 360px);
  padding: 11px;
  border: 1px solid #d8e3ef;
  border-radius: 10px;
  background: #f8fbff;
  box-sizing: border-box;
}

.import-tools-panel[hidden] { display: none; }
.import-tools-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; color: #334155; font-size: 13px; }
.import-tools-panel__head button { min-height: 30px; min-width: 0; padding: 0 10px; font-size: 12px; }
.import-tools-panel__cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.import-tools-panel .date-tool-group { width: 100%; padding: 8px; background: #fff; }

.date-tool-group__title {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.date-toolbar .date-tool-button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
}

.date-toolbar .date-tool-button--import {
  border-color: #93bdf8;
  background: #eff6ff;
  color: #1d4ed8;
}

.date-toolbar .date-tool-button--import:hover {
  border-color: #5b8def;
  background: #dbeafe;
}

.date-toolbar .date-tool-button--undo {
  border-color: #fdba74;
  background: #fff7ed;
  color: #c2410c;
}

.date-toolbar .date-tool-button--undo:hover:not(:disabled) {
  border-color: #f97316;
  background: #ffedd5;
}

.date-toolbar .date-tool-button:disabled {
  border-color: #d7dee8;
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 1;
}

.date-toolbar .date-move-notice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 44px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.date-toolbar .date-move-notice.show {
  visibility: visible;
  opacity: 1;
}

.date-toolbar__controls .date-move-notice {
  display: inline-flex;
  flex: 0 1 260px;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  visibility: hidden;
  opacity: 0;
}

.date-toolbar__controls .date-move-notice.show { visibility: visible; opacity: 1; }
.date-toolbar__controls .date-move-notice.is-future { border-color: #93bdf8; background: #eff6ff; color: #1d4ed8; }
.date-toolbar__controls .date-move-notice.is-past { border-color: #fdba74; background: #fff7ed; color: #c2410c; }

@media (max-width: 1180px) {
  .date-toolbar__controls {
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .date-toolbar {
    width: 100%;
    gap: 8px;
  }

  .date-toolbar__controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .date-toolbar .work-date-picker {
    width: 100%;
    min-width: 0;
  }

  .date-toolbar .date-tool-group {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  .date-toolbar .date-tool-group button {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
    white-space: normal;
  }

  .import-tools-panel { width: 100%; }
  .import-tools-panel__cards { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .date-toolbar .date-tool-group {
    grid-template-columns: 1fr;
  }

  .date-toolbar .date-move-notice {
    min-height: 58px;
  }

  .date-toolbar__controls .date-move-notice {
    min-height: 42px;
    max-width: 100%;
  }
}

/* Keep the company/site management and vertical schedule overview last. */
.layout.companies-mode .sidebar { display: none; }
.companies-view { display: grid; gap: 14px; min-width: 0; }
.companies-view.hidden { display: none !important; }
.companies-view__head, .companies-view__toolbar, .companies-management-card { border: 1px solid #dbe5f1; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(15,23,42,.05); }
.companies-view__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; }
.companies-view__head h2 { margin: 0; color: #172554; font-size: 22px; }
.companies-view__head p { margin: 6px 0 0; color: #64748b; font-size: 13px; }
.companies-view__head button, .companies-site-row__actions button, .companies-management-card__actions button { min-height: 36px; border: 1px solid #b9cff0; border-radius: 8px; background: #f4f8ff; color: #1d4ed8; font-size: 12px; font-weight: 800; }
.companies-view .companies-delete-button { border-color: #fecaca; background: #fff7f7; color: #b91c1c; }
.companies-view .companies-delete-button:hover { border-color: #f87171; background: #fff1f2; }
.companies-view__toolbar { padding: 14px 18px; }
.companies-search-field { display: grid; gap: 6px; max-width: 440px; color: #475569; font-size: 12px; font-weight: 800; }
.companies-search-field input { width: 100%; min-height: 42px; box-sizing: border-box; }
.companies-management-list { display: grid; gap: 12px; }
.companies-management-card { overflow: hidden; }
.companies-management-card.is-inactive, .companies-site-row.is-inactive { opacity: .62; }
.companies-management-card > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid #e4edf7; background: #f8fbff; }
.companies-management-card > header > div:first-child { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.companies-management-card > header strong { overflow-wrap: anywhere; color: #173b70; font-size: 16px; }
.companies-management-card > header span { flex: 0 0 auto; color: #64748b; font-size: 12px; font-weight: 800; }
.companies-management-card__actions, .companies-site-row__actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.companies-management-card ul { margin: 0; padding: 0; list-style: none; }
.companies-site-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid #edf2f7; }
.companies-site-row:last-child { border-bottom: 0; }
.companies-site-row__name { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.companies-site-row__name strong { overflow-wrap: anywhere; color: #334155; }
.companies-site-row__time { color: #475569; font-size: 12px; font-weight: 700; white-space: nowrap; }
.companies-site-row__time.is-unset { color: #b45309; }
.companies-management-empty { margin: 0; padding: 22px; color: #64748b; text-align: center; }
.attendance-overview-filter { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid #dbe5f1; border-radius: 9px; background: #f8fbff; }
.attendance-overview-filter button { min-height: 30px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: #64748b; font-size: 12px; font-weight: 800; }
.attendance-overview-filter button.active { background: #eaf2ff; color: #1d4ed8; box-shadow: inset 0 0 0 1px #b9d0f7; }
#attendanceView .overview-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
#attendanceView .overview-card { border-radius: 12px; }
#attendanceView .overview-company { min-height: 44px; padding: 10px 14px; }
#attendanceView .overview-company strong { overflow-wrap: anywhere; }
#attendanceView .overview-groups { padding: 2px 0; }
#attendanceView .overview-group { padding: 0; }
#attendanceView .overview-group-title { grid-template-columns: minmax(190px, 1fr) minmax(126px, auto) auto auto; align-items: center; gap: 10px; min-height: 48px; padding: 7px 14px; }
#attendanceView .overview-group-title > b { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
#attendanceView .overview-group-title > b > span { overflow-wrap: anywhere; color: #1e293b; text-align: left; }
#attendanceView .overview-group-title > b small { flex: 0 0 auto; }
#attendanceView .overview-group-summary { min-width: 120px; }
#attendanceView .overview-group-toggle { width: 30px; min-height: 30px; padding: 0; border: 1px solid #cbd8e7; border-radius: 7px; background: #fff; color: #475569; }
#attendanceView .overview-group-toggle::before { content: "⌃"; font-size: 16px; font-weight: 900; }
#attendanceView .overview-group.collapsed .overview-group-toggle::before { content: "⌄"; }
#attendanceView .overview-names { margin: 0; padding: 8px 14px 12px; border-top: 1px solid #f0f4f8; }
@media (max-width: 780px) {
  .companies-view__head, .companies-management-card > header, .companies-site-row { align-items: flex-start; flex-direction: column; }
  .companies-view__head, .companies-management-card > header { display: flex; }
  .companies-management-card__actions, .companies-site-row__actions { justify-content: flex-start; }
  #attendanceView .overview-head-title { align-items: flex-start; flex-direction: column; }
  #attendanceView .overview-head-actions { justify-content: flex-start; }
  #attendanceView .overview-group-title { grid-template-columns: minmax(0,1fr) auto; gap: 7px; align-items: start; }
  #attendanceView .overview-group-title > b { grid-column: 1 / -1; }
  #attendanceView .overview-group-summary { min-width: 0; justify-self: start; }
  #attendanceView .overview-add-person { justify-self: end; }
  #attendanceView .overview-group-toggle { grid-column: 2; grid-row: 2; }
}

.separate-import-date-label {
  display: grid;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.separate-import-date-label input {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  border: 1px solid #cbd8e8;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: #1e293b;
  font: inherit;
}

.separate-import-start {
  display: grid;
  gap: 12px;
}

.separate-import-start p {
  margin: 0;
}

.separate-import-start-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.separate-import-start-actions button {
  min-height: 42px;
  border: 1px solid #9dbdff;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font: inherit;
  font-weight: 800;
}

.separate-import-start-actions button:hover {
  border-color: #5b8def;
  background: #dbeafe;
}

@media (max-width: 480px) {
  .separate-import-start-actions {
    grid-template-columns: 1fr;
  }
}

.date-line button {
  width: auto;
  min-width: 128px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #cbd8e8;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  font-weight: 800;
  white-space: nowrap;
}

.date-line button:hover {
  background: #f3f7ff;
  border-color: #9dbdff;
}

.actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  align-content: center;
  gap: 12px;
  min-height: 0;
  padding: 47px 0 0;
  background: transparent;
  white-space: nowrap;
}

.topbar .actions button {
  min-width: 88px;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid #cbd8e8;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  font-weight: 900;
}

.topbar .actions button:hover {
  background: #f3f7ff;
  border-color: #9dbdff;
}

.topbar .actions .tab-btn.active {
  background: linear-gradient(180deg, #2f7df4 0%, #1d4ed8 100%);
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 9px 20px rgba(37, 99, 235, 0.24);
}

#saveBtn {
  background: linear-gradient(180deg, #19c96f 0%, #0ca75a 100%);
  border-color: #0ca75a;
  color: #ffffff;
  box-shadow: 0 9px 20px rgba(22, 163, 74, 0.22);
}

#printMenuBtn {
  background: #ffffff;
  border-color: #cbd8e8;
  color: #0f172a;
}

.layout {
  min-height: calc(100vh - 138px);
}

/* Company and work-group hierarchy */
.company-list {
  gap: 9px;
}

.company-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.company-item.active {
  border-color: #8fb4ff;
  background: #eef5ff;
  box-shadow: inset 4px 0 0 #2563eb;
}

.company-item.contains-active-group {
  border-color: #e2e8f0;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.company-toggle {
  min-height: 52px;
  padding: 10px 12px 10px 14px;
  background: #fff;
  gap: 9px;
}

.company-toggle:hover {
  background: #f8fbff;
}

.company-toggle strong {
  gap: 0;
  font-size: 15px;
  font-weight: 800;
}

.company-item.empty-company .company-toggle {
  background: #fff;
  color: #64748b;
}

.company-item.empty-company .company-toggle:hover {
  background: #f8fafc;
}

.company-item.active .company-toggle,
.company-item.active.empty-company .company-toggle {
  background: #eef5ff;
}

.company-people-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px !important;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e8f1ff;
  color: #2563eb !important;
  font-size: 13px !important;
  font-weight: 800;
  line-height: 1;
}

.company-item.empty-company .company-people-badge {
  background: #f1f5f9;
  color: #64748b !important;
}

.company-groups {
  margin: 0 8px 9px 28px;
  padding: 6px 0 0 14px;
  border-left: 2px solid #dbe5f1;
  gap: 6px;
}

.company-group-link {
  position: relative;
  min-height: 34px;
  padding: 4px 8px 4px 15px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfcfe;
  font-size: 12px;
  font-weight: 700;
}

.company-item.empty-company .company-group-link {
  border-color: #e2e8f0;
  background: #fbfcfe;
  color: var(--ink);
}

.company-group-link::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: #aebed0;
}

.company-group-link.active {
  border-color: #f4c36a;
  background: #fff8e8;
  box-shadow: inset 4px 0 0 #f59e0b;
}

.company-item.empty-company .company-group-link.active {
  border-color: #f4c36a;
  background: #fff8e8;
  box-shadow: inset 4px 0 0 #f59e0b;
}

.group-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px !important;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 800;
  line-height: 1;
}

.company-group-link.active .group-count-badge {
  background: #fff0c7;
  color: #d97706 !important;
}

.company-toggle.search-match {
  outline-color: #8fb4ff;
  background: #eef5ff;
  box-shadow: none;
}

.company-search-status strong {
  color: #2563eb;
  font-weight: 800;
}

.company-group-link.search-match {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
  background: linear-gradient(180deg, #fff8dc 0%, #fff1bd 100%);
  border-color: #e4b84b;
}

.overview-card.active {
  box-shadow: 0 0 0 1px #8eb5ff inset, 0 6px 16px rgba(37, 99, 235, 0.06) !important;
}

.overview-group.active {
  background: #ffffff !important;
}

.quick-name.selected {
  font-weight: 800 !important;
}

/* Summary cards match */
.summary-band {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 14px !important;
  margin: 0 0 18px !important;
}

.summary-band .metric {
  position: relative;
  min-height: 92px !important;
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 18px 22px !important;
  border: 1px solid #dfe7f2 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04) !important;
}

.summary-band .metric::before {
  width: 54px !important;
  height: 54px !important;
  min-width: 54px;
  margin: 0 !important;
  border-radius: 999px !important;
  flex: 0 0 54px;
  display: block !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 26px 26px !important;
  content: "" !important;
}

.summary-band .metric-total::before {
  background-color: #eaf2ff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E") !important;
}

.summary-band .metric-attended::before {
  background-color: #eaf8f1 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.5 2.5 2.5 5-5'/%3E%3C/svg%3E") !important;
}

.summary-band .metric-remaining::before {
  background-color: #fff7ed !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21a8 8 0 0 0-16 0'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") !important;
}

.summary-band .metric::after {
  content: "›";
  margin-left: auto;
  color: #64748b;
  font-size: 24px;
  line-height: 1;
  font-weight: 400;
}

.summary-band .metric span {
  display: block !important;
  margin: 0 0 6px !important;
  color: #64748b !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

.summary-band .metric strong {
  display: block;
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 28px !important;
  line-height: 1.1 !important;
  font-weight: 900 !important;
}

.summary-band .metric strong::after {
  content: "명";
  margin-left: 6px;
  color: #64748b;
  font-size: 16px;
  font-weight: 700;
}

/* Shared summary cards across all pages */
#attendanceView {
  display: flex;
  flex-direction: column;
  min-height: fit-content;
  height: auto;
  overflow: visible;
}

.workspace > .summary-band {
  margin: 0 0 14px !important;
  position: sticky;
  top: 0;
  z-index: 11;
  background: var(--bg);
  padding-bottom: 10px;
  isolation: isolate;
}

.workspace > .summary-band::before {
  content: "";
  position: absolute;
  top: -18px;
  left: -18px;
  right: -18px;
  bottom: 0;
  background: var(--bg);
  z-index: -1;
}
.time-view .time-work-table {
  border: 0 !important;
  border-radius: 0 0 10px 10px !important;
  background: #fff !important;
  box-shadow: none !important;
  margin-top: 0 !important;
}

.time-view .time-head h2 {
  grid-column: 1 !important;
  grid-row: 1 !important;
  margin: 0 !important;
  font-size: 17px !important;
  color: #0f172a !important;
  font-weight: 800 !important;
}

.time-view .time-head-actions {
  grid-column: 3 !important;
  grid-row: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
}

.time-view .time-head-actions button {
  min-height: 28px !important;
  padding: 0 12px !important;
  border: 1px solid #c9d7e6 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.time-view .time-head-actions button:hover {
  background: #f8fbff !important;
  border-color: #9ab8d9 !important;
}

.time-view .time-head p {
  grid-column: 2 !important;
  grid-row: 1 !important;
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.time-view .time-work-table th {
  background: linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%) !important;
  color: #334155 !important;
  font-weight: 800 !important;
}

.dispatch-view .dispatch-head {
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 14px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--brand-line) !important;
  border-radius: 10px 10px 0 0 !important;
  background: linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%) !important;
  box-shadow: none !important;
}

.dispatch-view .dispatch-head h2 {
  grid-column: 1 !important;
  grid-row: 1 !important;
  margin: 0 !important;
  font-size: 17px !important;
  color: #0f172a !important;
  font-weight: 800 !important;
}

.dispatch-view .dispatch-total {
  grid-column: 2 !important;
  grid-row: 1 !important;
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.dispatch-view .dispatch-head-actions {
  grid-column: 3 !important;
  grid-row: 1 !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
}

.dispatch-view .dispatch-head-actions .time-copy-excel-btn {
  min-width: 176px !important;
}

.dispatch-view .dispatch-global-add-vehicle {
  min-width: 112px;
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid #1d4ed8;
  border-radius: 10px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

.dispatch-view .dispatch-global-add-vehicle:hover {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
}

.dispatch-view {
  overflow: hidden !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
}

.dispatch-view .dispatch-head,
.dispatch-view .dispatch-bank,
.dispatch-view .dispatch-workspace {
  margin: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.dispatch-view .dispatch-head {
  grid-template-columns: 180px minmax(0, 1fr) auto !important;
  gap: 12px !important;
  border-top: 0 !important;
  border-radius: 14px 14px 0 0 !important;
  padding: 14px 18px !important;
}

.dispatch-view .dispatch-bank {
  padding: 14px 18px 16px !important;
  border-top: 0 !important;
  border-bottom: 1px solid var(--brand-line) !important;
  background: linear-gradient(180deg, #fbfdff 0%, #f6faff 100%) !important;
}

.dispatch-view .dispatch-bank-head {
  align-items: center !important;
  gap: 12px !important;
  margin-bottom: 12px !important;
}

.dispatch-view .dispatch-bank-head strong {
  color: #0f172a !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
}

.dispatch-view .dispatch-name-search {
  min-height: 38px !important;
  border: 1px solid #d6e2f0 !important;
  border-radius: 11px !important;
  padding: 6px 12px !important;
  background: #ffffff !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03), 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}
.dispatch-view .dispatch-name-search:not([disabled]):not([readonly]):focus,
.dispatch-view .dispatch-name-search:not([disabled]):not([readonly]):focus-visible {
  border-color: #3b82f6 !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14) !important;
}

/* Company/site management and the schedule overview share the existing company data. */
.layout.companies-mode .sidebar { display: none; }
.companies-view { display: grid; gap: 14px; min-width: 0; }
.companies-view.hidden { display: none !important; }
.companies-view__head, .companies-view__toolbar, .companies-management-card { border: 1px solid #dbe5f1; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(15,23,42,.05); }
.companies-view__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; }
.companies-view__head h2 { margin: 0; color: #172554; font-size: 22px; }
.companies-view__head p { margin: 6px 0 0; color: #64748b; font-size: 13px; }
.companies-view__head button, .companies-site-row__actions button, .companies-management-card__actions button { min-height: 36px; border: 1px solid #b9cff0; border-radius: 8px; background: #f4f8ff; color: #1d4ed8; font-size: 12px; font-weight: 800; }
.companies-view__toolbar { padding: 14px 18px; }
.companies-search-field { display: grid; gap: 6px; max-width: 440px; color: #475569; font-size: 12px; font-weight: 800; }
.companies-search-field input { width: 100%; min-height: 42px; box-sizing: border-box; }
.companies-management-list { display: grid; gap: 12px; }
.companies-management-card { overflow: hidden; }
.companies-management-card.is-inactive, .companies-site-row.is-inactive { opacity: .62; }
.companies-management-card > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid #e4edf7; background: #f8fbff; }
.companies-management-card > header > div:first-child { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.companies-management-card > header strong { overflow-wrap: anywhere; color: #173b70; font-size: 16px; }
.companies-management-card > header span { flex: 0 0 auto; color: #64748b; font-size: 12px; font-weight: 800; }
.companies-management-card__actions, .companies-site-row__actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.companies-management-card ul { margin: 0; padding: 0; list-style: none; }
.companies-site-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid #edf2f7; }
.companies-site-row:last-child { border-bottom: 0; }
.companies-site-row__name { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.companies-site-row__name strong { overflow-wrap: anywhere; color: #334155; }
.companies-site-row__time { color: #475569; font-size: 12px; font-weight: 700; white-space: nowrap; }
.companies-site-row__time.is-unset { color: #b45309; }
.companies-management-empty { margin: 0; padding: 22px; color: #64748b; text-align: center; }

.attendance-overview-filter { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid #dbe5f1; border-radius: 9px; background: #f8fbff; }
.attendance-overview-filter button { min-height: 30px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: #64748b; font-size: 12px; font-weight: 800; }
.attendance-overview-filter button.active { background: #eaf2ff; color: #1d4ed8; box-shadow: inset 0 0 0 1px #b9d0f7; }
.overview-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.overview-card { border-radius: 12px; }
.overview-company { min-height: 44px; padding: 10px 14px; }
.overview-company strong { overflow-wrap: anywhere; }
.overview-groups { padding: 2px 0; }
.overview-group { padding: 0; }
.overview-group-title { grid-template-columns: minmax(190px, 1fr) minmax(126px, auto) auto auto; align-items: center; gap: 10px; min-height: 48px; padding: 7px 14px; }
.overview-group-title > b { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.overview-group-title > b > span { overflow-wrap: anywhere; color: #1e293b; text-align: left; }
.overview-group-title > b small { flex: 0 0 auto; }
.overview-group-summary { min-width: 120px; }
.overview-group-toggle { width: 30px; min-height: 30px; padding: 0; border: 1px solid #cbd8e7; border-radius: 7px; background: #fff; color: #475569; }
.overview-group-toggle::before { content: "⌃"; font-size: 16px; font-weight: 900; }
.overview-group.collapsed .overview-group-toggle::before { content: "⌄"; }
.overview-names { margin: 0; padding: 8px 14px 12px; border-top: 1px solid #f0f4f8; }

@media (max-width: 780px) {
  .companies-view__head, .companies-management-card > header, .companies-site-row { align-items: flex-start; flex-direction: column; }
  .companies-view__head, .companies-management-card > header { display: flex; }
  .companies-management-card__actions, .companies-site-row__actions { justify-content: flex-start; }
  .overview-head-title { align-items: flex-start; flex-direction: column; }
  .overview-head-actions { justify-content: flex-start; }
  .overview-group-title { grid-template-columns: minmax(0,1fr) auto; gap: 7px; align-items: start; }
  .overview-group-title > b { grid-column: 1 / -1; }
  .overview-group-summary { min-width: 0; justify-self: start; }
  .overview-add-person { justify-self: end; }
  .overview-group-toggle { grid-column: 2; grid-row: 2; }
}

.dispatch-view .dispatch-name-bank {
  min-height: 52px !important;
  padding: 12px !important;
  border: 1px solid #d8e4f2 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
}

.dispatch-view .dispatch-workspace {
  min-height: 280px !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
  background: linear-gradient(180deg, #f9fbff 0%, #f5f9ff 100%) !important;
  border-radius: 0 0 14px 14px !important;
}

.dispatch-view .dispatch-person {
  min-height: 30px !important;
  border-radius: 9px !important;
  padding: 4px 10px !important;
  border-width: 1px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

.dispatch-sheet {
  padding: 16px 18px 18px;
}

.dispatch-sheet + .dispatch-sheet {
  margin-top: 16px;
}

.dispatch-sheet-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 20px 24px;
  border: 1px solid #d7e3f1;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffef7 0%, #fff9e8 100%);
}

.dispatch-sheet-select {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 36px;
  flex: 0 0 28px;
}

.dispatch-sheet-select input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.dispatch-sheet-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dispatch-sheet-meta-item span {
  color: #9a6700;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.dispatch-sheet-meta-item input {
  width: 180px;
  min-height: 48px;
  padding: 6px 12px;
  border: 1px solid #c9d9ea;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  text-align: center;
}

.dispatch-add-vehicle-button {
  min-height: 48px;
  min-width: 116px;
  padding: 0 16px;
  border: 1px solid #2563eb;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
}

.dispatch-add-vehicle-button:hover {
  background: #1d4ed8;
}

.dispatch-sheet-meta-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dispatch-move-vehicle-button {
  min-height: 48px;
  min-width: 64px;
  min-width: 54px;
  padding: 0 12px;
  border: 1px solid #c9d9ea;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
  color: #475569;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.dispatch-move-vehicle-button:hover {
  background: linear-gradient(180deg, #fbfdff 0%, #eef5ff 100%);
}

.dispatch-delete-vehicle-button {
  min-height: 48px;
  min-width: 104px;
  padding: 0 16px;
  border: 1px solid #f2b4b8;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fff4f4 100%);
  color: #dc2626;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.06);
}

.dispatch-delete-vehicle-button:hover {
  background: linear-gradient(180deg, #fff8f8 0%, #ffe9e9 100%);
}

.dispatch-sort-vehicle-button {
  min-height: 48px;
  min-width: 84px;
  padding: 0 16px;
  border: 1px solid #c9d9ea;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
  color: #475569;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.dispatch-sort-vehicle-button:hover {
  background: linear-gradient(180deg, #fbfdff 0%, #eef5ff 100%);
}

.dispatch-sheet-table {
  overflow-x: auto;
  border: 1px solid #d7e3f1;
  border-radius: 12px;
  background: #ffffff;
}

.dispatch-sheet-table table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  table-layout: fixed;
}

.dispatch-sheet-table th {
  padding: 12px 10px;
  border-right: 1px solid #d7e3f1;
  border-bottom: 1px solid #d7e3f1;
  background: linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%);
  color: #0f172a;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.dispatch-sheet-table td {
  padding: 10px 8px;
  border-right: 1px solid #e0e8f2;
  border-bottom: 1px solid #e0e8f2;
  background: #ffffff;
  text-align: center;
  vertical-align: middle;
}

.dispatch-sheet-table th:last-child {
  border-right: 0;
}

.dispatch-sheet-table td:last-child {
  border-right: 0;
}

.dispatch-sheet-table tbody tr:last-child td {
  border-bottom: 1px solid #e0e8f2;
}

.dispatch-sheet-table tfoot td {
  padding: 8px 8px;
  border-right: 1px solid #e0e8f2;
  border-top: 0;
  background: #ffffff;
  text-align: center;
  vertical-align: middle;
}

.dispatch-sheet-table tfoot td:last-child {
  border-right: 0;
}

.dispatch-add-row-footer td:first-child {
  background: #ffffff;
}

.dispatch-add-row-footer .dispatch-col-row-delete {
  padding-left: 0;
  padding-right: 0;
}

.dispatch-add-row-button {
  height: 34px;
  width: 62px;
  min-width: 62px;
  padding: 0 8px;
  border: 1px solid #bfd3f4;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f2f7ff 100%);
  color: #2563eb;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 7px rgba(37, 99, 235, 0.06);
}

.dispatch-add-row-button:hover {
  background: linear-gradient(180deg, #f8fbff 0%, #eaf2ff 100%);
}

.dispatch-delete-row-button {
  height: 34px;
  width: 62px;
  min-width: 62px;
  padding: 0 8px;
  border: 1px solid #f3bec2;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fff4f4 100%);
  color: #dc2626;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 7px rgba(220, 38, 38, 0.05);
}

.dispatch-delete-row-button:hover {
  background: linear-gradient(180deg, #fff8f8 0%, #ffe9e9 100%);
}

.dispatch-row-action-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
}

.dispatch-row-action-single {
  min-height: 54px;
}

.dispatch-sheet-table .dispatch-col-order {
  width: 72px;
}

.dispatch-sheet-table .dispatch-col-name {
  width: 168px;
}

.dispatch-sheet-table .dispatch-col-gender {
  width: 86px;
}

.dispatch-sheet-table .dispatch-col-start {
  width: 138px;
}

.dispatch-sheet-table .dispatch-col-group {
  width: 170px;
}

.dispatch-sheet-table .dispatch-col-note {
  width: 220px;
}

.dispatch-sheet-table .dispatch-col-ride-time {
  width: 138px;
}

.dispatch-sheet-table .dispatch-col-address {
  width: 220px;
}

.dispatch-sheet-table .dispatch-col-row-delete {
  width: 92px;
  padding-left: 0;
  padding-right: 0;
}

.dispatch-row-input {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #c9d9ea;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  text-align: center;
}

.dispatch-row-input::placeholder {
  color: #94a3b8;
}

/* Phase 1: dashboard, language selector, and unified typography */
.actions {
  max-width: none !important;
}

.actions .tab-btn,
.actions > button {
  font-family: "Malgun Gothic", "Microsoft YaHei", "Segoe UI", Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

.language-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 9px 0 12px;
  border: 1px solid #cbd8e8;
  border-radius: 9px;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.language-picker select {
  min-height: 30px;
  padding: 0 26px 0 8px;
  border: 0;
  outline: 0;
  background-color: transparent;
  color: #0f172a;
  cursor: pointer;
}

.summary-band.hidden {
  display: none !important;
}

.layout.dashboard-mode {
  grid-template-columns: minmax(0, 1fr) !important;
}

.layout.dashboard-mode .sidebar {
  display: none !important;
}

.dashboard-view {
  min-height: 100%;
  padding: 4px;
}

.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid #d9e4f2;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #eef6ff 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.dashboard-heading h2 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 25px;
}

.dashboard-heading p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

.dashboard-heading > strong {
  color: #2563eb;
  font-size: 15px;
  white-space: nowrap;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.dashboard-metric {
  position: relative;
  min-height: 138px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid #d9e4f2;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.dashboard-metric::after {
  content: "";
  position: absolute;
  top: -28px;
  right: -28px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.10);
}

.dashboard-metric span {
  display: block;
  margin-bottom: 12px;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
}

.dashboard-metric strong {
  color: #0f172a;
  font-size: 38px;
  line-height: 1;
}

.dashboard-metric-attended::after { background: rgba(16, 185, 129, 0.12); }
.dashboard-metric-remaining::after { background: rgba(245, 158, 11, 0.14); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(520px, 1.6fr);
  gap: 16px;
}

.dashboard-panel {
  min-height: 330px;
  padding: 20px;
  border: 1px solid #d9e4f2;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.dashboard-panel-head {
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid #e5edf6;
}

.dashboard-panel-head h3 {
  margin: 0;
  color: #1e293b;
  font-size: 17px;
}

.dashboard-company-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.dashboard-company-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.dashboard-company-row strong {
  overflow: hidden;
  color: #334155;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-company-row span {
  color: #2563eb;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(48px, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 255px;
  padding: 12px 10px 0;
}

.dashboard-chart-item {
  display: grid;
  grid-template-rows: 24px 180px 24px;
  align-items: end;
  min-width: 0;
  text-align: center;
}

.dashboard-chart-item > strong {
  align-self: center;
  color: #334155;
  font-size: 13px;
}

.dashboard-chart-track {
  position: relative;
  height: 180px;
  overflow: hidden;
  border-radius: 8px 8px 3px 3px;
  background: #eff4f9;
}

.dashboard-chart-track span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 3px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
}

.dashboard-chart-item small {
  align-self: center;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-empty {
  display: grid;
  min-height: 160px;
  place-items: center;
  color: #94a3b8;
  text-align: center;
}

.settlement-view {
  display: grid;
  min-height: calc(100vh - 220px);
  place-items: center;
}

.settlement-card {
  width: min(560px, 100%);
  padding: 48px;
  border: 1px solid #d9e4f2;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.settlement-icon {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 20px;
  background: #eef6ff;
  color: #2563eb;
  font-size: 32px;
  font-weight: 900;
}

.settlement-card h2 { margin: 0 0 12px; font-size: 25px; }
.settlement-card p { margin: 0; color: #64748b; line-height: 1.7; }

@media (max-width: 1180px) {
  .summary-band { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-metrics { grid-template-columns: 1fr; }
  .dashboard-chart { overflow-x: auto; }
}

.dispatch-row-name {
  font-weight: 700;
}

.dispatch-row-name.selected {
  border-color: #4f8cff;
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.18);
  background: #f8fbff;
}

.dispatch-row-name.drop-ready {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  background: #eef6ff;
}

.dispatch-row-time {
  letter-spacing: 0;
}

.dispatch-gender-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1;
}

.dispatch-gender-badge.neutral {
  background: #f1f5f9;
  color: #64748b;
}

.dispatch-gender-badge.male {
  background: #dbeafe;
  color: #0f3f8c;
}

.dispatch-gender-badge.female {
  background: #fce7f3;
  color: #be185d;
}

/* Full phase 1: attendance, settlement and mobile role views */
.connection-banner { position: sticky; top: 0; z-index: 1200; padding: 9px 16px; background: #b42318; color: #fff; text-align: center; font-size: 13px; font-weight: 700; }
.time-work-table { overflow-x: auto; }
.time-work-table table { min-width: 1580px; }
.time-work-table select { min-width: 105px; }
.auto-overtime-value { display: block; font-weight: 800; color: #176b45; }
.auto-overtime-value + small { display: block; color: #667085; font-size: 11px; }
.driver-check-badge { display: inline-flex; min-width: 42px; justify-content: center; padding: 5px 7px; border-radius: 999px; background: #f2f4f7; color: #667085; font-size: 12px; }
.driver-check-badge.checked { background: #dcfae6; color: #067647; }
.dashboard-company-table { display: grid; gap: 0; }
.dashboard-company-row { display: grid; grid-template-columns: minmax(140px, 1fr) repeat(3, 72px); align-items: center; gap: 8px; padding: 10px 8px; border-bottom: 1px solid #e4e7ec; }
.dashboard-company-row span { text-align: center; }
.dashboard-company-row-head { background: #f8fafc; color: #475467; font-size: 12px; }
.dashboard-company-total { background: #eff8ff; border-bottom: 0; }
.dashboard-line-chart { width: 100%; min-height: 230px; overflow: visible; }
.chart-axis { stroke: #d0d5dd; stroke-width: 2; }
.chart-line { fill: none; stroke: #2563eb; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-point circle { fill: #fff; stroke: #2563eb; stroke-width: 4; }
.chart-point text { fill: #344054; font-size: 13px; font-weight: 700; text-anchor: middle; }
.chart-point .chart-date { font-size: 12px; font-weight: 600; }
.chart-point:focus circle, .chart-point:hover circle { fill: #dbeafe; r: 8px; }
.employee-role-fieldset { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0; padding: 12px; border: 1px solid #d0d5dd; border-radius: 10px; }
.employee-role-fieldset legend { padding: 0 6px; font-weight: 700; }
.employee-role-fieldset label { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; }
.employee-role-fieldset input[type="checkbox"] { width: 16px; height: 16px; }
.settlement-view { padding: 20px; min-width: 0; }
.settlement-panel { width: 100%; min-width: 0; box-sizing: border-box; padding: 20px; border: 1px solid #d8e4f1; border-radius: 14px; background: #fff; }
.settlement-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid #e8eef5; }
.settlement-header h2 { margin: 0 0 5px; color: #0f172a; font-size: 23px; }
.settlement-header p { margin: 0; color: #64748b; font-size: 14px; }
.settlement-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.settlement-summary-card { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 8px; min-height: 92px; padding: 16px; border: 1px solid #dbe7f4; border-radius: 12px; background: #fbfdff; box-sizing: border-box; }
.settlement-summary-card__label { grid-column: 1 / -1; color: #64748b; font-size: 13px; font-weight: 700; }
.settlement-summary-card strong { color: #1e3a5f; font-size: 25px; line-height: 1; }
.settlement-summary-card__unit { padding-bottom: 2px; color: #64748b; font-size: 12px; font-weight: 700; }
.settlement-summary-card--paid { background: #f4fbf7; border-color: #c9ead6; }
.settlement-summary-card--paid strong { color: #137547; }
.settlement-summary-card--unpaid { background: #fffaf0; border-color: #f3dfb7; }
.settlement-summary-card--unpaid strong { color: #a16207; }
.settlement-summary-card--review { background: #fff7f7; border-color: #f2d2d2; }
.settlement-summary-card--review strong { color: #b42318; }
.settlement-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.settlement-tabs button { min-height: 40px; padding: 0 16px; border-radius: 8px; background: #fff; color: #475569; }
.settlement-tabs button.active { border-color: #73aee1; background: #eaf4ff; color: #1d5f99; }
.settlement-filter-toolbar { display: grid; grid-template-columns: minmax(0, 32fr) minmax(0, 34fr) minmax(0, 17fr) minmax(0, 17fr); gap: 16px; margin-bottom: 16px; padding: 18px 20px; border: 1px solid #cfe0f2; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(30, 81, 122, .05); }
.settlement-filter-group { display: grid; grid-template-rows: 18px 18px 54px; min-width: 0; row-gap: 6px; color: #52657a; font-size: 12px; font-weight: 700; }
.settlement-filter-group__title { height: 18px; color: #334e68; font-size: 13px; font-weight: 800; line-height: 18px; }
.settlement-filter-group__label-row { display: block; height: 18px; min-width: 0; line-height: 18px; }
.settlement-filter-group__control { min-width: 0; }
.settlement-filter-group__label-slot { display: block; height: 18px; line-height: 18px; }
.settlement-filter-toolbar .settlement-filter-control { width: 100%; min-width: 0; height: 54px; min-height: 54px; box-sizing: border-box; padding: 0 16px; border: 1px solid #c9d8e7; border-radius: 9px; background: #fff; color: #1e293b; font-size: 14px; }
.settlement-filter-toolbar .settlement-filter-control:focus { border-color: #3b82f6; outline: 0; box-shadow: 0 0 0 3px rgba(59, 130, 246, .14); }
.settlement-filter-search__control { position: relative; display: block; min-width: 0; }
.settlement-filter-search__control .settlement-filter-control { padding-right: 48px; }
.settlement-filter-search__icon { position: absolute; top: 50%; right: 16px; width: 20px; height: 20px; color: #7890a6; pointer-events: none; transform: translateY(-50%); }
.settlement-period-label-row, .settlement-period-control { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
.settlement-period-label-row { height: 18px; align-items: center; }
.settlement-date-label { height: 18px; color: #64748b; font-size: 11px; font-weight: 700; line-height: 18px; }
.settlement-period-control { height: 54px; align-items: stretch; }
.settlement-period-field { display: contents; min-width: 0; }
.settlement-period-mobile-label { display: none; }
.settlement-date-separator { display: flex; height: 54px; align-items: center; justify-content: center; color: #7890a6; font-size: 16px; font-weight: 700; }
.settlement-content-card { min-width: 0; overflow: hidden; border: 1px solid #d8e4f1; border-radius: 12px; background: #fff; }
.settlement-content { min-height: 280px; padding: 14px; }
.settlement-table-wrap { max-width: 100%; overflow-x: auto; }
.settlement-table { width: 100%; min-width: 1040px; border-collapse: collapse; }
.settlement-table th, .settlement-table td { padding: 11px 10px; border-bottom: 1px solid #e8eef5; text-align: center; white-space: nowrap; }
.settlement-table th { background: #f4f8fc; color: #475569; font-size: 12px; font-weight: 800; }
.settlement-table tbody tr:hover td { background: #fbfdff; }
.settlement-daily-table .settlement-row-targeted td { background: #eff6ff; }
.settlement-daily-table .settlement-row-targeted td:first-child { box-shadow: inset 3px 0 0 #4f8fd1; }
.settlement-daily-table .settlement-row-targeted { scroll-margin-top: 84px; }
.settlement-daily-table { min-width: 1520px; table-layout: fixed; }
.settlement-daily-table col.settlement-daily-col--date { width: 110px; }
.settlement-daily-table col.settlement-daily-col--employee { width: 160px; }
.settlement-daily-table col.settlement-daily-col--company { width: 150px; }
.settlement-daily-table col.settlement-daily-col--basic-pay { width: 140px; }
.settlement-daily-table col.settlement-daily-col--overtime-hours { width: 110px; }
.settlement-daily-table col.settlement-daily-col--overtime-rate { width: 140px; }
.settlement-daily-table col.settlement-daily-col--overtime-pay { width: 130px; }
.settlement-daily-table col.settlement-daily-col--other-allowance { width: 140px; }
.settlement-daily-table col.settlement-daily-col--total { width: 130px; }
.settlement-daily-table col.settlement-daily-col--confirmation, .settlement-daily-table col.settlement-daily-col--payment { width: 110px; }
.settlement-daily-table col.settlement-daily-col--save { width: 90px; }
.settlement-daily-table th, .settlement-daily-table td { box-sizing: border-box; overflow: hidden; padding: 11px 10px; text-overflow: ellipsis; vertical-align: middle; }
.settlement-daily-table .settlement-daily-col--employee, .settlement-daily-table .settlement-daily-col--company { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settlement-table input { width: 120px; }
.settlement-table .settlement-inline-input { width: 94px; min-height: 34px; padding: 5px 7px; text-align: right; font-variant-numeric: tabular-nums; }
.settlement-daily-table .settlement-inline-input { min-width: 0; box-sizing: border-box; margin: 0 auto; }
.settlement-daily-table .settlement-daily-col--employee, .settlement-daily-table .settlement-daily-col--company { text-align: left; }
.settlement-daily-table .settlement-daily-col--date, .settlement-daily-table .settlement-daily-col--overtime-hours, .settlement-daily-table .settlement-daily-col--confirmation, .settlement-daily-table .settlement-daily-col--payment, .settlement-daily-table .settlement-daily-col--save { text-align: center; }
.settlement-daily-table .settlement-daily-col--basic-pay, .settlement-daily-table .settlement-daily-col--overtime-hours, .settlement-daily-table .settlement-daily-col--overtime-rate, .settlement-daily-table .settlement-daily-col--overtime-pay, .settlement-daily-table .settlement-daily-col--other-allowance, .settlement-daily-table .settlement-daily-col--total { text-align: center; }
.settlement-daily-table .settlement-daily-input--amount { width: 110px; max-width: 100%; text-align: center; }
.settlement-daily-table .settlement-daily-input--hours { width: 90px; max-width: 100%; text-align: center; }
.settlement-daily-table .settlement-daily-read-money { display: block; width: 100%; box-sizing: border-box; padding: 0; text-align: center; font-variant-numeric: tabular-nums; }
.settlement-daily-table .settlement-daily-col--total { font-weight: 800; }
.settlement-daily-table .settlement-daily-col--save button { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; min-height: 34px; }
.settlement-table button[disabled] { opacity: .52; cursor: not-allowed; }
.settlement-candidates, .settlement-employee-summary { margin-bottom: 18px; }
.settlement-candidates h3, .settlement-employee-summary h3 { margin: 0 0 9px; color: #1e3a5f; font-size: 15px; }
.settlement-payment-confirm { display: grid; gap: 12px; }
.settlement-payment-confirm dl { display: grid; gap: 7px; margin: 0; }
.settlement-payment-confirm dl > div { display: grid; grid-template-columns: minmax(126px, .72fr) minmax(0, 1.28fr); gap: 10px; padding-bottom: 7px; border-bottom: 1px solid #edf2f7; }
.settlement-payment-confirm dt { color: #64748b; font-size: 12px; font-weight: 700; }
.settlement-payment-confirm dd { margin: 0; color: #1e293b; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.settlement-payment-confirm > label { display: grid; gap: 5px; color: #475569; font-size: 12px; font-weight: 700; }
.settlement-payment-confirm input { min-height: 38px; box-sizing: border-box; }
.settlement-advance-form { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(130px, .9fr) minmax(120px, .75fr) minmax(140px, .9fr) minmax(150px, 1fr) minmax(145px, .8fr) auto; align-items: end; gap: 10px; margin-bottom: 14px; padding: 12px; border: 1px solid #dbe7f4; border-radius: 10px; background: #f8fbff; }
.settlement-advance-form label { display: grid; gap: 5px; min-width: 0; color: #64748b; font-size: 12px; font-weight: 700; }
.settlement-advance-form input, .settlement-advance-form select { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; border-radius: 8px; background: #fff; }
.settlement-advance-form button { min-height: 40px; white-space: nowrap; }
.settlement-advance-employee-search { position: relative; }
.settlement-advance-candidates { position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 8; display: grid; max-height: 220px; overflow-y: auto; border: 1px solid #bfd2e6; border-radius: 8px; background: #fff; box-shadow: 0 10px 24px rgba(15, 23, 42, .14); }
.settlement-advance-candidates:empty { display: none; }
.settlement-advance-candidates button { min-height: 38px; padding: 8px 10px; border: 0; border-bottom: 1px solid #edf2f7; border-radius: 0; background: #fff; color: #334155; font-size: 12px; font-weight: 600; text-align: left; white-space: normal; }
.settlement-advance-candidates button:hover { background: #eff6ff; }
.settlement-advance-candidates em { color: #c2410c; font-style: normal; }
.settlement-advance-balance { display: grid; gap: 5px; min-width: 0; color: #64748b; font-size: 12px; font-weight: 700; }
.settlement-advance-balance strong { display: flex; align-items: center; min-height: 40px; padding: 0 10px; border: 1px solid #cfe0f2; border-radius: 8px; background: #fff; color: #1d4f80; font-size: 14px; }
.settlement-advance-positive { color: #1d4f80; }
.settlement-advance-negative { color: #15803d; }
.settlement-table .needs-recheck { background: #fff1f3; border-color: #fda29b; color: #b42318; }
.settlement-amount { text-align: right !important; font-variant-numeric: tabular-nums; }
.settlement-employee-layout { min-width: 0; }
.settlement-employee-summary { min-width: 0; }
.settlement-employee-name { text-align: center !important; font-weight: 600; }
.settlement-employee-workspace-table { width: 100%; min-width: 760px; table-layout: fixed; border-collapse: collapse; }
.settlement-employee-workspace-table .settlement-col-select { width: 8%; }
.settlement-employee-workspace-table .settlement-col-name { width: 20%; }
.settlement-employee-workspace-table .settlement-col-work, .settlement-employee-workspace-table .settlement-col-overtime { width: 15%; }
.settlement-employee-workspace-table .settlement-col-payment { width: 23%; }
.settlement-employee-workspace-table .settlement-col-status { width: 10%; }
.settlement-employee-workspace-table .settlement-col-detail { width: 9%; }
.settlement-employee-workspace-table th, .settlement-employee-workspace-table td { box-sizing: border-box; padding: 8px 10px; border-bottom-color: #edf2f7; text-align: center; vertical-align: middle; }
.settlement-employee-workspace-table tbody tr.is-selected td { background: #eef6ff; }
.settlement-employee-workspace-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 #5b9bea; }
.settlement-employee-workspace-table tbody tr.is-payment-selected td { background: #f0f7ff; }
.settlement-employee-workspace-table input[type="checkbox"] { cursor: pointer; pointer-events: auto; }
.settlement-employee-workspace-table input[type="checkbox"]:disabled { cursor: not-allowed; }
.settlement-employee-workspace-table tr { display: table-row; }
.settlement-employee-workspace-table th, .settlement-employee-workspace-table td { display: table-cell; vertical-align: middle; }
.settlement-cell-stack { display: grid; grid-template-rows: 18px 16px 18px; align-content: center; align-items: center; width: 100%; min-height: 56px; margin: 0; row-gap: 2px; text-align: center; }
.settlement-cell-stack__main, .settlement-cell-stack__sub, .settlement-cell-placeholder, .settlement-cell-stack .settlement-net-pay { display: block; overflow: hidden; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
.settlement-cell-stack__main { color: #1f2937; font-size: 13px; font-weight: 400; }
.settlement-cell-stack__sub { color: #64748b; font-size: 11px; line-height: 16px; }
.settlement-cell-placeholder { line-height: 18px; visibility: hidden; }
.settlement-cell-stack .settlement-net-pay { color: #0f4c81; font-size: 13px; font-weight: 800; }
.settlement-payment-details strong, .settlement-net-pay { color: #0f4c81; font-weight: 800; }
.settlement-employee-workspace-table .settlement-status-badge { min-width: 68px; padding: 5px 9px; }
.settlement-employee-workspace-table .settlement-status--unpaid { border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.settlement-employee-workspace-table .settlement-status--review { border: 1px solid #fed7aa; background: #fff7ed; color: #c2410c; }
.settlement-employee-workspace-table .settlement-status--paid { border: 1px solid #bbf7d0; background: #f0fdf4; color: #15803d; }
.settlement-employee-workspace-table button[data-settlement-employee-detail] { min-width: 76px; padding: 7px 12px; border-color: #bed3ea; background: #f8fbff; color: #245b91; font-weight: 700; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.settlement-employee-workspace-table button[data-settlement-employee-detail]:hover { border-color: #77a8da; background: #eaf4ff; transform: translateY(-1px); }
.settlement-employee-pagination { gap: 6px; flex-wrap: wrap; }
.settlement-employee-pagination button { min-width: 34px; padding: 0 9px; }
.settlement-employee-pagination button[data-settlement-employee-page] { min-width: 64px; }
.settlement-employee-pagination .settlement-page-number { background: #fff; border-color: #cbd5e1; color: #334155; }
.settlement-employee-pagination .settlement-page-number:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.settlement-employee-pagination .settlement-page-number[aria-current="page"] { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 700; }
.settlement-pagination-ellipsis { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; color: #64748b; }
.settlement-detail-modal { position: fixed; inset: 0; z-index: var(--z-settlement-detail); display: grid; place-items: center; padding: 24px; background: rgba(15, 23, 42, .58); }
.settlement-detail-modal__dialog { display: flex; flex-direction: column; width: min(90vw, 1500px); height: 85vh; min-width: 0; overflow: hidden; border: 1px solid #c8d9eb; border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgba(15, 23, 42, .28); }
.settlement-detail-modal__head { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 12px; border-bottom: 1px solid #e1eaf3; background: #fff; }
.settlement-detail-modal__head h3 { margin: 0; color: #1e3a5f; font-size: 21px; }
.settlement-detail-modal__head p { margin: 5px 0 0; color: #64748b; font-size: 13px; }
.settlement-detail-modal__head button { min-width: 38px; min-height: 38px; padding: 0; font-size: 24px; line-height: 1; }
.settlement-detail-modal__summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #e8eef5; background: #fbfdff; }
.settlement-detail-modal__summary dl { display: grid; flex: 1; grid-template-columns: repeat(7, minmax(100px, 1fr)); gap: 8px; margin: 0; }
.settlement-detail-modal__summary dl > div { min-width: 0; padding: 8px; border: 1px solid #e4edf6; border-radius: 8px; background: #fff; }
.settlement-detail-modal dt { color: #64748b; font-size: 11px; font-weight: 700; }
.settlement-detail-modal dd { margin: 3px 0 0; color: #1e293b; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.settlement-detail-modal__table { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 20px; }
.settlement-detail-modal__table .settlement-table-wrap { overflow: visible; }
.settlement-detail-modal__footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e1eaf3; background: #fff; }
.settlement-detail-table { min-width: 980px; font-size: 12px; }
.settlement-detail-table th { position: sticky; top: 0; z-index: 1; }
.settlement-detail-table .settlement-detail-company { min-width: 150px; white-space: normal; text-align: left; }
.settlement-detail-table .settlement-amount small { display: block; margin-top: 3px; color: #64748b; font-size: 11px; }
.settlement-status-badge { display: inline-flex; justify-content: center; min-width: 58px; padding: 5px 8px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 700; }
.settlement-empty { display: grid; place-items: center; align-content: center; gap: 8px; min-height: 250px; padding: 24px; color: #64748b; text-align: center; }
.settlement-empty strong { color: #475569; font-size: 15px; }
.settlement-empty span { font-size: 13px; }

@media (max-width: 520px) {
  .settlement-view { padding: 8px; }
  .settlement-panel { padding: 14px; border-radius: 12px; }
  .settlement-header { gap: 12px; padding-bottom: 12px; }
  .settlement-summary-grid, .settlement-filter-toolbar { grid-template-columns: 1fr; gap: 8px; }
  .settlement-summary-card { min-height: 76px; padding: 13px; }
  .settlement-summary-card strong { font-size: 22px; }
  .settlement-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settlement-tabs button { min-width: 0; padding: 0 8px; font-size: 12px; }
  .settlement-content { padding: 10px; }
  .settlement-advance-form { grid-template-columns: 1fr; gap: 8px; }
  .settlement-advance-form button { width: 100%; }
  .settlement-payment-confirm dl > div { grid-template-columns: 1fr; gap: 3px; }
}
.mobile-portal { position: fixed; inset: 0; z-index: 1400; display: grid; place-items: center; padding: 18px; background: rgba(15, 23, 42, .58); }
.mobile-portal.hidden { display: none !important; }
.mobile-shell { width: min(100%, 430px); max-height: calc(100vh - 28px); overflow-y: auto; border-radius: 22px; background: #f8fafc; box-shadow: 0 28px 80px rgba(15,23,42,.32); }
.mobile-shell-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #e4e7ec; background: #fff; }
.mobile-shell-head strong { font-size: 18px; }
#mobilePortalBody { display: grid; gap: 14px; padding: 16px; }
.mobile-select-label, .mobile-field { display: grid; gap: 6px; color: #475467; font-size: 13px; font-weight: 700; }
.mobile-select-label select, .mobile-field select, .mobile-field input { width: 100%; min-height: 44px; }
.mobile-date { padding: 12px; border-radius: 12px; background: #eaf2ff; color: #194185; text-align: center; font-weight: 800; }
.mobile-info-grid { display: grid; grid-template-columns: 110px 1fr; gap: 0; overflow: hidden; border: 1px solid #e4e7ec; border-radius: 14px; background: #fff; }
.mobile-info-grid > * { padding: 10px 12px; border-bottom: 1px solid #f0f2f5; }
.mobile-info-grid span { color: #667085; }
.mobile-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mobile-action-grid button { min-height: 54px; background: #2563eb; color: #fff; border-color: #2563eb; }
.mobile-action-grid button:last-child { background: #0f766e; border-color: #0f766e; }
.mobile-status-card { display: grid; gap: 5px; padding: 16px; border-radius: 14px; background: #fff; border: 1px solid #d0d5dd; }
.mobile-status-card strong { color: #175cd3; font-size: 18px; }
.mobile-status-card small { color: #667085; }
.driver-route-card { display: grid; gap: 10px; padding: 14px; border: 1px solid #d0d5dd; border-radius: 14px; background: #fff; }
.driver-route-card header { display: flex; justify-content: space-between; gap: 10px; }
.driver-passenger-row { display: flex; flex-direction: row; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; background: #f8fafc; }
.driver-passenger-row input { width: 22px; height: 22px; }
.driver-passenger-row span { display: grid; gap: 3px; }
.driver-passenger-info { flex: 1 1 auto; min-width: 0; }
.driver-passenger-checks { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.driver-passenger-checks label { display: inline-flex; align-items: center; gap: 5px; color: #475569; font-size: 12px; font-weight: 700; white-space: nowrap; }
.driver-passenger-checks label span { display: inline; }
.driver-route-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.driver-route-actions button { flex: 1 1 160px; min-height: 38px; }
.driver-passenger-row small { color: #667085; }
.mobile-empty { padding: 24px; text-align: center; color: #667085; }
@media (max-width: 900px) {
  .summary-band { grid-template-columns: 1fr !important; }
  .time-head, .settlement-header { align-items: stretch; flex-direction: column; }
  .time-head-actions { align-items: stretch; flex-direction: column; }
  .dashboard-company-row { grid-template-columns: minmax(100px, 1fr) repeat(3, 52px); font-size: 12px; }
  .settlement-view { padding: 12px; }
  .settlement-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settlement-filter-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settlement-detail-modal { padding: 14px; }
  .settlement-detail-modal__dialog { width: min(94vw, 1500px); height: 88vh; }
  .settlement-detail-modal__summary dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .settlement-filter-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 16px; }
  .settlement-advance-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .settlement-filter-toolbar { grid-template-columns: 1fr; gap: 12px; padding: 14px; }
}
@media (max-width: 480px) {
  .settlement-period-range { grid-template-rows: 18px 18px auto; }
  .settlement-period-label-row, .settlement-period-control { grid-template-columns: 1fr; height: auto; }
  .settlement-period-label-row > span:nth-child(3) { margin-top: 6px; }
  .settlement-date-separator { display: none; }
}
@media (max-width: 520px) {
  .mobile-portal { padding: 0; }
  .mobile-shell { width: 100%; height: 100vh; max-height: none; border-radius: 0; }
  .driver-passenger-row { align-items: flex-start; flex-direction: column; }
  .driver-passenger-checks { justify-content: flex-start; }
  .mobile-info-grid { grid-template-columns: 96px 1fr; }
  .mobile-action-grid { grid-template-columns: 1fr; }
  .settlement-detail-modal { padding: 0; }
  .settlement-detail-modal__dialog { width: 100vw; height: 100vh; border-radius: 0; }
  .settlement-detail-modal__head, .settlement-detail-modal__summary, .settlement-detail-modal__footer { padding-left: 12px; padding-right: 12px; }
  .settlement-detail-modal__summary dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settlement-detail-modal__table { padding: 0 12px; }
}

/* Attendance overview and name board final clean UI */
.daily-overview,
.quick-bank {
  border: 1px solid #dbe5f1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.overview-head {
  min-height: 56px;
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid #dbe5f1;
}

.overview-head-title {
  gap: 12px;
  flex-wrap: wrap;
}

.overview-head h2 {
  font-size: 18px;
  font-weight: 800;
}

.overview-head-actions button {
  min-height: 32px;
  padding: 0 11px;
  border-color: #d6e2f0;
  border-radius: 7px;
  background: #ffffff;
  color: #334155;
}

.overview-total,
.gender-summary,
.overview-group-summary {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: #334155;
  font-style: normal;
  white-space: nowrap;
}

.gender-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
}

.gender-stat.male,
.gender-stat.male strong {
  color: #2563eb;
}

.gender-stat.female,
.gender-stat.female strong {
  color: #db2777;
}

.gender-stat.total,
.gender-stat.total strong {
  color: #1f2937;
}

.overview-total i,
.overview-group-summary i {
  color: #94a3b8;
  font-style: normal;
}

.overview-grid {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 12px;
  padding: 12px;
}

.overview-card {
  align-self: start;
  min-height: 0;
  height: auto;
  border: 1px solid #dbe5f1;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.04);
}

.overview-card.active {
  outline: 0;
  border-color: #8fb4ff;
  background: #eef5ff;
  box-shadow: inset 4px 0 0 #2563eb !important;
}

.overview-card.contains-active-group {
  border-color: #dbe5f1;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.04);
}

.overview-company,
.overview-card.empty-company .overview-company {
  min-height: 50px;
  padding: 9px 12px 9px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e8eef5;
}

.overview-card.active .overview-company,
.overview-card.active.empty-company .overview-company {
  background: #eef5ff;
}

.overview-card.collapsed .overview-company,
.overview-card.empty-company .overview-company {
  border-bottom-color: transparent;
}

.overview-company strong {
  flex: 1 1 auto;
  min-width: 0;
  gap: 0;
  overflow: hidden;
  color: #172033;
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-company-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e8f1ff;
  color: #2563eb !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1;
}

.overview-card.empty-company .overview-company-count {
  background: #f1f5f9;
  color: #64748b !important;
}

.overview-card.empty-company .overview-groups:empty {
  display: none;
}

.overview-group {
  padding: 0;
  border: 1px solid transparent;
  border-bottom: 1px solid #e8eef5;
  background: #ffffff;
}

.overview-group:last-child {
  border-bottom: 0;
}

.overview-group.active,
.group-panel.active {
  outline: 0;
}

.overview-group.active {
  border-color: #f4c36a;
  background: #fff8e8 !important;
  box-shadow: inset 4px 0 0 #f59e0b;
}

.overview-group-title {
  grid-template-columns: minmax(100px, 1fr) minmax(150px, auto) auto;
  gap: 10px;
  min-height: 38px;
  padding: 5px 8px 5px 12px;
  font-size: 12px;
}

.overview-group-title b {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: #1f2937;
  font-size: 13px;
  font-weight: 800;
}

.overview-group-title b > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-group-title b small {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 11px;
}

.overview-add-person {
  min-height: 28px;
  padding: 0 9px;
  border-color: #bfd3ed;
  border-radius: 6px;
  background: #ffffff;
  color: #2563eb;
  font-size: 12px;
}

.overview-names {
  gap: 6px;
  margin: 0;
  padding: 2px 10px 10px 12px;
}

.overview-names .person-pill,
.quick-name {
  display: inline-flex;
  align-items: center;
  max-width: 190px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 6px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-names .person-pill.male,
.quick-name.male {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.overview-names .person-pill.female,
.quick-name.female {
  border-color: #f9a8d4;
  background: #fce7f3;
  color: #be185d;
}

.overview-names .person-pill.selected,
.quick-name.selected {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  box-shadow: none;
}

/* Dispatch uses the schedule worker-button rules; long names keep their full text. */
.dispatch-name.quick-name {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

.quick-bank-head {
  min-height: 58px;
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid #dbe5f1;
  flex-wrap: wrap;
}

.quick-bank-title-row {
  flex: 1 1 280px;
  flex-wrap: wrap;
}

.quick-bank-target-label {
  min-height: 30px;
  border-color: #b9cef0;
  border-radius: 999px;
  background: #eef5ff;
  color: #1d4ed8;
  font-weight: 800;
}

.quick-bank-actions {
  justify-content: flex-end;
  flex: 1 1 500px;
}

.quick-bank-actions button,
.quick-bank-actions .name-search {
  min-height: 34px;
  border-radius: 7px;
}

#addQuickMaleBtn {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

#addQuickFemaleBtn {
  border-color: #f9a8d4;
  background: #fdf2f8;
  color: #be185d;
}

#cleanNameBankBtn {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #334155;
}

.quick-bank-actions .name-search {
  width: 180px;
  border-color: #cbd5e1;
  background-color: #ffffff;
}

.quick-bank-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  min-height: 180px;
}

.quick-name-bank {
  align-content: start;
  height: 180px;
  min-height: 180px;
  max-height: 180px;
  padding: 12px;
  overflow-y: auto;
}

.quick-bank-instruction {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  margin: 0;
  padding: 18px;
  border-left: 1px solid #e2e8f0;
  background: #fbfdff;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}

@media (min-width: 1600px) {
  .overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) and (max-width: 1599px) {
  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .overview-head,
  .quick-bank-head {
    align-items: flex-start;
  }

  .overview-total {
    width: 100%;
    justify-content: flex-end;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .quick-bank-actions {
    justify-content: flex-start;
  }

  .quick-bank-body {
    grid-template-columns: 1fr;
  }

  .quick-bank-instruction {
    min-height: 58px;
    border-top: 1px solid #e2e8f0;
    border-left: 0;
  }
}

/* Employee button interaction: selection, assignment notice, and precise drag insertion. */
.quick-name.selected,
.overview-names .person-pill.selected {
  background: #ffffff !important;
  font-weight: 800;
  min-height: 30px;
  padding: 4px 10px;
  border-width: 1px;
  border-style: solid;
  border-radius: 6px;
  box-sizing: border-box;
  outline: 0;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.16);
}

.quick-name.male.selected,
.overview-names .person-pill.male.selected {
  border-color: #2563eb;
  color: #1d4ed8;
}

.quick-name.female.selected,
.overview-names .person-pill.female.selected {
  border-color: #db2777;
  color: #be185d;
}

.quick-name:focus,
.overview-names .person-pill:focus {
  outline: 0;
}

.quick-name:not(.selected):focus-visible,
.overview-names .person-pill:not(.selected):focus-visible {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.24);
}

.quick-name.selected:hover,
.quick-name.selected:focus,
.quick-name.selected:focus-visible,
.quick-name.selected:active,
.overview-names .person-pill.selected:hover,
.overview-names .person-pill.selected:focus,
.overview-names .person-pill.selected:focus-visible,
.overview-names .person-pill.selected:active {
  outline: 0;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.16);
  transform: none;
}

.overview-names .person-pill.dragging,
.quick-name.dragging {
  position: relative;
  z-index: 10;
  opacity: 0.94;
  background: #ffffff !important;
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
  transform: translateY(-2px) scale(1.02);
  cursor: grabbing;
}

.overview-names .person-pill.insert-before-pill,
.overview-names .person-pill.insert-after-pill {
  position: relative;
  outline: 0;
}

.overview-names .person-pill.insert-before-pill {
  margin-left: 12px;
  box-shadow: none;
}

.overview-names .person-pill.insert-after-pill {
  margin-right: 12px;
  box-shadow: none;
}

.overview-names .person-pill.insert-before-pill::before,
.overview-names .person-pill.insert-after-pill::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 2px #dbeafe;
}

.overview-names .person-pill.insert-before-pill::before {
  left: -9px;
}

.overview-names .person-pill.insert-after-pill::after {
  right: -9px;
}

.assignment-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 4000;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid #86efac;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  box-shadow: 0 8px 24px rgba(22, 101, 52, 0.16);
}

.assignment-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* Keep the attendance redesign last so legacy time-table rules cannot override it. */
.time-view.attendance-management-view { display: grid; gap: 14px; overflow: visible; border: 0; background: transparent; }
.time-view.attendance-management-view.hidden { display: none !important; }
.attendance-management-view .time-head { display: flex !important; align-items: center !important; justify-content: space-between; gap: 20px !important; padding: 20px 22px !important; border: 1px solid #dbe5f1 !important; border-radius: 14px !important; background: #fff !important; box-shadow: 0 3px 12px rgba(15,23,42,.05) !important; }
.attendance-management-view .time-head-copy { display: grid !important; gap: 6px; min-width: 0; }
.attendance-management-view .time-head h2 { grid-column: auto !important; grid-row: auto !important; font-size: 22px !important; line-height: 1.25; }
.attendance-management-view .time-head-copy p { grid-column: auto !important; grid-row: auto !important; margin: 0 !important; color: #64748b !important; font-size: 13px !important; font-weight: 600 !important; text-align: left !important; white-space: normal !important; }
.attendance-management-view .time-head-actions { grid-column: auto !important; grid-row: auto !important; flex: 0 0 auto; flex-wrap: wrap; }
.attendance-management-view .time-head-actions button { min-height: 42px !important; padding: 0 16px !important; border-color: #cbd8e7 !important; border-radius: 10px !important; font-size: 13px !important; font-weight: 800 !important; }
.attendance-management-view .time-head-actions .time-date-action { min-width: 210px; color: #1d4ed8 !important; background: #f8fbff !important; }
.attendance-management-view .time-head-actions .time-primary-action { border-color: #2563eb !important; background: #2563eb !important; color: #fff !important; }
.time-summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.time-summary-card { display: flex; align-items: center; justify-content: space-between; min-height: 92px; padding: 18px 20px; border: 1px solid #dbe5f1; border-radius: 14px; background: #fff; box-shadow: 0 2px 9px rgba(15,23,42,.04); }
.time-summary-card span { color: #64748b; font-size: 14px; font-weight: 800; }
.time-summary-card strong { color: #0f172a; font-size: 25px; font-weight: 800; }
.time-summary-attended { border-top: 3px solid #3b82f6; }
.time-summary-working { border-top: 3px solid #10b981; }
.time-summary-completed { border-top: 3px solid #64748b; }
.time-summary-attended strong { color: #2563eb; }
.time-summary-working strong { color: #059669; }
.time-summary-completed strong { color: #475569; }
.time-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid #dbe5f1; border-radius: 12px; background: #fff; }
.time-toolbar > p { margin: 0; color: #334155; font-size: 14px; font-weight: 800; white-space: nowrap; }
.time-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.attendance-management-view .time-work-table { overflow-x: auto !important; border: 1px solid #dbe5f1 !important; border-radius: 14px !important; background: #fff !important; box-shadow: 0 3px 12px rgba(15,23,42,.05) !important; }
.attendance-management-view .time-work-table table { width: 100%; min-width: 1120px !important; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.attendance-management-view .time-work-table th,.attendance-management-view .time-work-table td { padding: 8px; border: 0; border-bottom: 1px solid #e6edf5; color: #334155; text-align: center; vertical-align: middle; }
.attendance-management-view .time-work-table th { height: 46px; background: #f1f6fc !important; color: #475569 !important; font-size: 12px; font-weight: 800 !important; white-space: nowrap; }
.attendance-management-view .time-work-table th:first-child { border-radius: 13px 0 0 0; }
.attendance-management-view .time-work-table th:last-child { border-radius: 0 13px 0 0; }
.attendance-management-view .time-work-table tbody tr:not(.time-add-helper-row):hover td { background: #f8fbff; }
.attendance-management-view .time-work-table tbody tr.checked-row td,.attendance-management-view .time-work-table tbody tr.selected-row td { background: #eef5ff !important; }
.attendance-management-view .time-work-table th:nth-child(1),.attendance-management-view .time-work-table td:nth-child(1) { width: 44px; }
.attendance-management-view .time-work-table th:nth-child(2),.attendance-management-view .time-work-table td:nth-child(2) { width: 60px; }
.attendance-management-view .time-work-table th:nth-child(3),.attendance-management-view .time-work-table td:nth-child(3) { width: 160px; }
.attendance-management-view .time-work-table th:nth-child(4),.attendance-management-view .time-work-table td:nth-child(4) { width: 70px; }
.attendance-management-view .time-work-table th:nth-child(5),.attendance-management-view .time-work-table td:nth-child(5) { width: 110px; }
.attendance-management-view .time-work-table th:nth-child(6),.attendance-management-view .time-work-table td:nth-child(6) { width: 130px; }
.attendance-management-view .time-work-table th:nth-child(7),.attendance-management-view .time-work-table td:nth-child(7),.attendance-management-view .time-work-table th:nth-child(8),.attendance-management-view .time-work-table td:nth-child(8),.attendance-management-view .time-work-table th:nth-child(9),.attendance-management-view .time-work-table td:nth-child(9) { width: 100px; }
.attendance-management-view .time-work-table th:nth-child(10),.attendance-management-view .time-work-table td:nth-child(10) { width: auto; min-width: 180px; }
.attendance-management-view .time-work-table th:nth-child(11),.attendance-management-view .time-work-table td:nth-child(11) { width: 80px; }
.attendance-management-view .time-work-table input[type="text"] { width: 100%; height: 38px; min-height: 38px; padding: 6px 9px; border: 1px solid #cbd8e7; border-radius: 8px; box-sizing: border-box; background: #fff; color: #1e293b; font-size: 13px; line-height: 1; text-align: center; }
.attendance-management-view .time-work-table .attendance-time-like-field { display: block; width: 100%; max-width: 100%; height: 38px; min-height: 38px; margin: 0; padding: 6px 9px; border: 1px solid #cbd8e7; border-radius: 8px; box-sizing: border-box; font-size: 13px; line-height: 1; text-align: center; }
.attendance-management-view .time-work-table .attendance-time-like-field::placeholder { text-align: center; }
.attendance-management-view .time-work-table input:focus { border-color: #6b9df4; outline: 0; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.attendance-management-view .time-static-text { display: block; width: 100%; overflow: hidden; color: #334155; font-size: 13px; font-weight: 700; line-height: 1.35; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.attendance-management-view .time-delete-cell { padding: 8px 6px !important; }
.attendance-management-view .time-delete-row-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 60px; height: 36px; min-height: 36px; gap: 5px; padding: 0 8px; border: 1px solid #fecaca; border-radius: 8px; background: #fff7f7; color: #dc2626; font-size: 12px; font-weight: 700; white-space: nowrap; }
.attendance-management-view .time-delete-row-btn::before { width: 13px; height: 13px; flex: 0 0 13px; content: ""; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v5M14 11v5'/%3E%3C/svg%3E"); }
.attendance-management-view .time-gender { min-width: 38px; min-height: 26px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 800; }
.attendance-management-view .time-gender.male { border-color: #bfdbfe; background: #eaf3ff; color: #1d4ed8; }
.attendance-management-view .time-gender.female { border-color: #fbcfe8; background: #fdf0f7; color: #be185d; }
.attendance-management-view .time-add-helper-row td { padding: 9px 12px; border-bottom: 0; text-align: right; background: #fbfdff; }
.attendance-management-view .time-add-row-btn { min-width: 76px; min-height: 34px; border-color: #b9cff0; border-radius: 9px; background: #f4f8ff; color: #2563eb; }
@media (max-width:1200px) { .time-toolbar { align-items:flex-start; flex-direction:column; } .time-toolbar-actions { justify-content:flex-start; width:100%; } }
@media (max-width:900px) { .attendance-management-view .time-head { align-items:flex-start !important; flex-direction:column; } .attendance-management-view .time-head-actions { justify-content:flex-start !important; width:100%; } .time-summary-grid { grid-template-columns:repeat(3,minmax(150px,1fr)); overflow-x:auto; } .time-toolbar-actions { align-items:flex-start; flex-direction:column; } }
@media (max-width:620px) { .time-summary-grid { grid-template-columns:1fr; overflow:visible; } .attendance-management-view .time-head-actions .time-date-action,.attendance-management-view .time-head-actions button { width:100%; } }

.time-view.attendance-management-view {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
}

.attendance-management-view .time-work-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  contain: inline-size;
}

@media (max-width: 900px) {
  .attendance-management-view .time-head-actions {
    flex-direction: row !important;
  }

  .time-summary-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }
}

/* Attendance-only summary-card structure. Dashboard keeps its original cards. */
.summary-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.summary-card {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 112px;
  gap: 16px;
  padding: 20px 22px;
  overflow: hidden;
  border: 1px solid #dbe5f1;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.summary-card > .summary-card__icon {
  display: block;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  margin: 0;
  border-radius: 999px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 25px 25px;
}

.summary-card > .summary-card__body {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 6px;
  margin: 0;
}

.summary-card .summary-card__label {
  display: block;
  margin: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card .summary-card__number {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 0;
}

.summary-card .summary-card__value {
  display: block;
  margin: 0;
  color: #0f172a;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.summary-card .summary-card__unit {
  display: block;
  margin: 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.summary-card > .summary-card__arrow {
  display: block;
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  color: #94a3b8;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.summary-card--blue > .summary-card__icon {
  background-color: #eaf2ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}

.summary-card--green > .summary-card__icon {
  background-color: #eaf8f1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 24 24' fill='none' stroke='%23059669' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

.summary-card--orange > .summary-card__icon {
  background-color: #fff5e6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21a8 8 0 0 0-16 0'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}

.summary-card--blue .summary-card__value { color: #1d4ed8; }
.summary-card--green .summary-card__value { color: #047857; }
.summary-card--orange .summary-card__value { color: #c2410c; }

.attendance-management-view .time-summary-grid {
  margin: 0;
}

.time-view.attendance-management-view {
  width: 100%;
  max-width: 100%;
  padding: 0;
  box-sizing: border-box;
}

.time-summary-grid.summary-card-grid {
  width: 100%;
  max-width: 100%;
  margin: 0;
  align-items: stretch;
}

.attendance-management-view .time-summary-grid.summary-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.attendance-management-view .attendance-summary-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 92px;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid #dfe7f2;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.attendance-management-view .attendance-summary-card > .summary-card__icon {
  flex-basis: 54px;
  width: 54px;
  height: 54px;
  background-size: 26px 26px;
}

.attendance-management-view .attendance-summary-card .summary-card__label {
  flex: 0 0 auto;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.attendance-management-view .attendance-summary-card .summary-card__number {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  flex-wrap: nowrap;
  width: max-content;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}

.attendance-management-view .attendance-summary-card .summary-card__value {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.attendance-management-view .attendance-summary-card .summary-card__unit {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  color: #64748b;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.attendance-management-view .attendance-summary-card > .summary-card__arrow {
  font-size: 24px;
  font-weight: 400;
}

@media (max-width: 900px) {
  .summary-card-grid {
    grid-template-columns: 1fr;
  }

  .attendance-management-view .time-summary-grid.summary-card-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar > div:first-child,
  .topbar .actions {
    width: 100%;
    min-width: 0;
  }

  .topbar .actions {
    justify-content: flex-start;
    padding: 0;
    white-space: normal;
  }

  .topbar .actions button {
    min-width: 0;
    padding-right: 12px;
    padding-left: 12px;
  }

}

/* Unified focus treatment for text-entry controls. Buttons, checks, radios, disabled, readonly, and invalid fields keep their own states. */
:where(
  input[type="text"],
  input[type="search"],
  input[type="date"],
  input[type="month"],
  input[type="number"],
  input[type="tel"],
  input[type="time"],
  select,
  textarea
):not([disabled]):not([readonly]):not([aria-invalid="true"]):not(.time-input-error):focus,
:where(
  input[type="text"],
  input[type="search"],
  input[type="date"],
  input[type="month"],
  input[type="number"],
  input[type="tel"],
  input[type="time"],
  select,
  textarea
):not([disabled]):not([readonly]):not([aria-invalid="true"]):not(.time-input-error):focus-visible {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

/* Mobile phase 1: shared top navigation, touch sizing, and dashboard cards. */
.mobile-topbar,
.mobile-nav-overlay {
  display: none;
}

@media (max-width: 780px), (pointer: coarse) and (max-width: 900px) {
  button:not(.tab-btn),
  .topbar button,
  .mobile-nav-list button {
    min-height: 44px;
  }

  :where(input[type="text"], input[type="search"], input[type="date"], input[type="month"], input[type="number"], input[type="tel"], input[type="time"], select, textarea) {
    min-height: 42px;
  }

  .app,
  .layout,
  .workspace,
  .dashboard-view {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 780px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.mobile-navigation-open {
    overflow: hidden;
  }

  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1450;
    display: grid;
    gap: 10px;
    padding: 10px 12px 12px;
    border-bottom: 1px solid #dbe7f5;
    background: #ffffff;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.08);
  }

  .mobile-topbar__main {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .mobile-nav-toggle,
  .mobile-nav-panel__head button {
    display: grid;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border-color: #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 22px;
    line-height: 1;
  }

  .mobile-topbar__title {
    min-width: 0;
    overflow: hidden;
    color: #172554;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-language-picker select {
    width: 82px;
    min-height: 44px;
    padding: 0 8px;
    border-color: #cbd8e8;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
  }

  .mobile-date-toolbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: center;
  }

  .mobile-date-toolbar button {
    min-width: 0;
    min-height: 44px;
    padding: 0 8px;
    border-color: #cbd8e8;
    border-radius: 10px;
    background: #fff;
    color: #1e3a5f;
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-date-toolbar #mobileDatePreviousBtn,
  .mobile-date-toolbar #mobileDateNextBtn {
    overflow: hidden;
    font-size: 0;
  }

  .mobile-date-toolbar #mobileDatePreviousBtn::before { content: "‹"; font-size: 26px; }
  .mobile-date-toolbar #mobileDateNextBtn::before { content: "›"; font-size: 26px; }

  .mobile-date-toolbar .mobile-date-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
    font-size: 14px;
    white-space: nowrap;
  }

  .mobile-date-toolbar #mobileDateTodayBtn {
    grid-column: 1 / -1;
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
  }

  .mobile-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: block;
    background: rgba(15, 23, 42, 0.48);
  }

  .mobile-nav-overlay.hidden { display: none; }

  .mobile-nav-panel {
    display: flex;
    width: min(320px, calc(100vw - 24px));
    height: 100%;
    max-height: calc(100vh - 24px);
    flex-direction: column;
    overflow: hidden auto;
    border-radius: 0 16px 16px 0;
    background: #fff;
    box-shadow: 18px 0 42px rgba(15, 23, 42, 0.24);
  }

  .mobile-nav-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 10px;
    border-bottom: 1px solid #e2e8f0;
  }

  .mobile-nav-panel__head strong { color: #172554; font-size: 18px; }

  .mobile-nav-list {
    display: grid;
    gap: 6px;
    padding: 12px;
  }

  .mobile-nav-list button {
    width: 100%;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #334155;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
  }

  .mobile-nav-list button.active {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
  }

  .topbar { display: none !important; }

  .dashboard-heading {
    align-items: flex-start;
    gap: 6px;
  }

  .dashboard-heading h2 { font-size: 21px; }
  .dashboard-heading p { font-size: 13px; }

  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .dashboard-metric {
    min-height: 112px;
    padding: 16px;
    border-radius: 14px;
  }

  .dashboard-metric span {
    min-width: 0;
    margin-bottom: 10px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-metric strong { font-size: 30px; }

  .app-dialog-overlay,
  .mobile-portal,
  .settlement-detail-modal {
    padding: 12px;
  }

  .app-dialog,
  .mobile-shell,
  .settlement-detail-modal__dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .app-dialog { overflow: auto; }
  .mobile-shell { height: auto; }
  .settlement-detail-modal__dialog { height: calc(100vh - 24px); border-radius: 14px; }
}

@media (min-width: 481px) and (max-width: 780px) {
  .mobile-topbar {
    gap: 12px;
    padding: 14px 18px;
  }

  .mobile-topbar__main {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 14px;
  }

  .mobile-nav-toggle,
  .mobile-nav-panel__head button {
    width: 48px;
    min-width: 48px;
    height: 48px;
  }

  .mobile-topbar__title { font-size: 18px; }

  .mobile-language-picker select {
    width: 96px;
    min-height: 48px;
    font-size: 14px;
  }

  .mobile-date-toolbar {
    grid-template-columns: 78px minmax(0, 1fr) 78px 84px;
    gap: 10px;
  }

  .mobile-date-toolbar button {
    min-height: 48px;
    font-size: 13px;
  }

  .mobile-date-toolbar #mobileDatePreviousBtn,
  .mobile-date-toolbar #mobileDateNextBtn {
    overflow: visible;
    font-size: 13px;
  }

  .mobile-date-toolbar #mobileDatePreviousBtn::before,
  .mobile-date-toolbar #mobileDateNextBtn::before { content: none; }

  .mobile-date-toolbar #mobileDateTodayBtn {
    grid-column: auto;
  }

  .mobile-nav-panel { width: min(380px, calc(100vw - 36px)); }
  .mobile-nav-list button { min-height: 48px; font-size: 16px; }

  /* Keep the existing tablet dashboard density; only the common header changes here. */
  .dashboard-metrics { grid-template-columns: 1fr !important; }
  .dashboard-metric { min-height: 138px; padding: 24px; }
  .dashboard-metric span { margin-bottom: 12px; font-size: 14px; }
  .dashboard-metric strong { font-size: 38px; }
}

@media (max-width: 360px) {
  .dashboard-metrics { grid-template-columns: 1fr !important; }
  .mobile-language-picker select { width: 72px; }
  .mobile-topbar__main { gap: 6px; }
}

/* Dispatch vehicle editor: keep the metadata controls inside the viewport on narrow screens. */
@media (max-width: 780px) {
  .layout > .workspace:has(.dispatch-view) {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .dispatch-sheet,
  .dispatch-sheet-meta,
  .dispatch-sheet-meta-item,
  .dispatch-sheet-meta-actions {
    min-width: 0;
  }

  .dispatch-sheet {
    padding: 12px;
  }

  .dispatch-sheet-meta {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "select driver company"
      ". vehicle vehicle"
      ". actions actions";
    gap: 10px;
    padding: 14px;
  }

  .dispatch-sheet-select { grid-area: select; }
  .dispatch-sheet-meta-item:nth-child(2) { grid-area: driver; }
  .dispatch-sheet-meta-item:nth-child(3) { grid-area: company; }
  .dispatch-sheet-meta-item:nth-child(4) { grid-area: vehicle; }
  .dispatch-sheet-meta-actions { grid-area: actions; flex-wrap: wrap; }

  .dispatch-sheet-meta-item input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .dispatch-sheet-table {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .dispatch-sheet {
    padding: 10px;
  }

  .dispatch-sheet-meta {
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-areas:
      "select driver"
      ". company"
      ". vehicle"
      "actions actions";
    gap: 10px;
    padding: 12px;
  }

  .dispatch-sheet-meta-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .dispatch-sheet-meta-actions {
    gap: 8px;
  }

  .dispatch-sheet-meta-actions button {
    flex: 1 1 96px;
    min-width: 0;
  }
}

/* Keep every shared modal inside the mobile viewport, including the existing driver portal. */
@media (max-width: 480px) {
  .mobile-portal { padding: 12px; }
  .mobile-shell {
    width: calc(100vw - 24px);
    height: auto;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 14px;
  }
}

/* Mobile schedule phase 2: keep the desktop schedule intact and reshape only the attendance view. */
.mobile-schedule-shortcut,
.mobile-schedule-drawer { display: none; }

@media (max-width: 780px) {
  .layout:has(#attendanceView:not(.hidden)) {
    grid-template-columns: minmax(0, 1fr);
  }

  .layout:has(#attendanceView:not(.hidden)) > .sidebar {
    display: none;
  }

  .mobile-schedule-shortcut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }

  .mobile-schedule-drawer {
    position: fixed;
    inset: 0;
    z-index: 1510;
    display: block;
    padding: 12px;
    background: rgba(15, 23, 42, 0.48);
  }

  .mobile-schedule-drawer.hidden { display: none; }

  .mobile-schedule-drawer__panel {
    display: flex;
    width: min(420px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.28);
  }

  .mobile-schedule-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
  }

  .mobile-schedule-drawer__head strong { color: #172554; font-size: 18px; }

  .mobile-schedule-drawer__head button {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-color: #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 22px;
  }

  .mobile-schedule-drawer__search { padding: 12px 16px; }
  .mobile-schedule-drawer__search input { width: 100%; min-height: 44px; }

  .mobile-schedule-company-list {
    display: grid;
    gap: 8px;
    min-height: 0;
    overflow: auto;
    padding: 0 16px 16px;
  }

  .mobile-schedule-company-item {
    overflow: hidden;
    border: 1px solid #d8e5f2;
    border-radius: 12px;
    background: #fff;
  }

  .mobile-schedule-company-item > button,
  .mobile-schedule-company-item > div > button {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    border: 0;
    border-bottom: 1px solid #edf2f7;
    border-radius: 0;
    background: #f8fbff;
    color: #1e3a5f;
    text-align: left;
  }

  .mobile-schedule-company-item > button strong,
  .mobile-schedule-company-item > div > button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-schedule-company-item > button span,
  .mobile-schedule-company-item > div > button strong {
    flex: 0 0 auto;
    color: #475569;
    font-size: 12px;
  }

  .mobile-schedule-company-item > div > button { background: #fff; color: #334155; }
  .mobile-schedule-company-item > div > button:last-child { border-bottom: 0; }
  .mobile-schedule-company-list__empty { margin: 0; padding: 28px 12px; color: #64748b; text-align: center; }

  #attendanceView .overview-head-title { align-items: stretch; }
  #attendanceView .overview-head-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  #attendanceView .attendance-overview-filter { display: contents; }
  #attendanceView .overview-head-actions button,
  #attendanceView .attendance-overview-filter button { width: 100%; min-width: 0; min-height: 44px; padding: 0 10px; }

  #attendanceView .overview-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  #attendanceView .overview-card {
    border-radius: 12px;
    cursor: default;
  }

  #attendanceView .overview-company {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 44px;
    gap: 8px;
    min-height: 52px;
    padding: 8px 10px;
  }

  #attendanceView .overview-company::after { display: none; }
  #attendanceView .overview-company strong { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #attendanceView .overview-company-count { align-self: center; }

  #attendanceView .overview-company-toggle {
    display: grid;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    place-items: center;
    border-color: #bfdbfe;
    border-radius: 9px;
    background: #fff;
    color: #1d4ed8;
  }

  #attendanceView .overview-company-toggle::before { content: "⌃"; font-size: 18px; font-weight: 900; }
  #attendanceView .overview-card.collapsed .overview-company-toggle::before { content: "⌄"; }

  #attendanceView .overview-group {
    padding: 10px;
    border-bottom-color: #e8eef5;
  }

  #attendanceView .overview-group-title {
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-areas:
      "name toggle"
      "summary add";
    gap: 8px;
  }

  #attendanceView .overview-group-title > b {
    display: grid;
    grid-area: name;
    min-width: 0;
    gap: 2px;
  }

  #attendanceView .overview-group-title > b span {
    overflow: hidden;
    color: #1e293b;
    font-size: 15px;
    font-weight: 800;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #attendanceView .overview-group-title > b small { font-size: 12px; }
  #attendanceView .overview-group-summary { grid-area: summary; justify-self: start; text-align: left; }
  #attendanceView .overview-add-person { grid-area: add; min-height: 44px; font-size: 13px; }
  #attendanceView .overview-group-toggle { grid-area: toggle; width: 44px; min-width: 44px; min-height: 44px; }

  #attendanceView .overview-names { gap: 6px; margin-top: 10px; }
  #attendanceView .overview-names .person-pill {
    display: inline-flex;
    max-width: 100%;
    min-height: 40px;
    align-items: center;
    overflow: hidden;
    padding: 6px 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #attendanceView .quick-bank-head,
  #attendanceView .quick-bank-title-row { align-items: stretch; flex-direction: column; }
  #attendanceView .quick-bank-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  #attendanceView .quick-bank-actions input { grid-column: 1 / -1; min-width: 0; }
  #attendanceView .quick-bank-actions button { width: 100%; min-width: 0; min-height: 44px; }
}

/* Mobile UI completion: reuse existing data and actions while changing only presentation. */
@media (max-width: 780px) {
  .time-view, .dispatch-view, .employee-view, .companies-view, .settlement-view { min-width: 0; overflow-x: clip; }
  .time-view button, .dispatch-view button, .employee-view button, .companies-view button, .settlement-view button { min-height: 44px; }
  .time-view input, .dispatch-view input, .employee-view input, .companies-view input, .settlement-view input, .settlement-view select { min-height: 42px; box-sizing: border-box; }

  /* Attendance: each existing table row becomes one touch-friendly employee card. */
  .time-work-table { overflow: visible; }
  .time-work-table table, .time-work-table tbody { display: block; width: 100%; }
  .time-work-table thead { display: none; }
  .time-work-table tr:not(.time-add-helper-row) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin: 10px 0; padding: 14px; border: 1px solid #dbe7f5; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(15, 55, 95, .05); }
  .time-work-table td { display: grid; min-width: 0; padding: 0; border: 0; }
  .time-work-table td:nth-child(1), .time-work-table td:nth-child(2), .time-work-table td:nth-child(4), .time-work-table td:nth-child(11) { grid-column: auto; }
  .time-work-table .time-name-cell { grid-column: 1 / -1; }
  .time-work-table .time-name-input { min-height: 44px; font-size: 16px; font-weight: 700; }
  .time-work-table .time-static-text, .time-work-table .time-gender { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .time-work-table .overtime-cell { grid-template-columns: minmax(0, 1fr) 44px; gap: 6px; }
  .time-work-table .time-delete-cell { align-self: end; }
  .time-work-table .time-add-helper-row { display: block; margin-top: 10px; }
  .time-work-table .time-add-helper-row td { display: block; padding: 0; }
  .time-work-table .time-add-row-btn { width: 100%; }
  .time-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .time-toolbar, .time-toolbar-actions { align-items: stretch; flex-direction: column; }

  /* Dispatch: route sheets stay editable, but their toolbar and rows stack safely. */
  .dispatch-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .dispatch-head-actions, .dispatch-bank-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dispatch-head-actions > *, .dispatch-bank-head > * { min-width: 0; }
  .dispatch-bank-head strong, .dispatch-bank-head input { grid-column: 1 / -1; }
  .dispatch-sheet { overflow: hidden; border-radius: 14px; }
  .dispatch-sheet-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dispatch-sheet-select, .dispatch-sheet-meta-actions { grid-column: 1 / -1; }
  .dispatch-sheet-meta-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dispatch-sheet-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dispatch-sheet-table table { min-width: 760px; }

  /* Employee and company lists already use semantic cards; collapse the desktop grids. */
  .employee-content-grid { grid-template-columns: minmax(0, 1fr); }
  .employee-detail-card { order: -1; }
  .employee-table-head { display: none; }
  .employee-table-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; margin: 10px 0; padding: 14px; border: 1px solid #dbe7f5; border-radius: 14px; background: #fff; }
  .employee-table-row > span { min-width: 0; }
  .employee-table-row > span:nth-child(1), .employee-table-row > span:nth-child(3), .employee-table-row > span:nth-child(7) { display: none; }
  .employee-table-row > strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
  .employee-table-row > span:nth-child(4), .employee-table-row > span:nth-child(5), .employee-table-row > span:nth-child(6) { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .employee-table-manage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; grid-column: 1 / -1; }
  .employee-pagination { flex-wrap: wrap; gap: 8px; }
  .employee-pagination button { min-height: 44px; }
  .companies-view__head, .companies-view__toolbar { align-items: stretch; flex-direction: column; }
  .companies-management-card { border-radius: 14px; }
  .companies-management-card > header, .companies-site-row { align-items: stretch; flex-direction: column; gap: 10px; }
  .companies-management-card__actions, .companies-site-row__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .companies-management-card__actions button, .companies-site-row__actions button { min-width: 0; }
  .companies-delete-button { color: #b42318; border-color: #f4c7c3; background: #fff6f5; }

  /* Settlement: keep the editable desktop tables, transform rows into concise cards. */
  .settlement-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settlement-tabs { overflow-x: auto; padding-bottom: 4px; }
  .settlement-tabs button { flex: 0 0 auto; }
  .settlement-filter-card, .settlement-filter-toolbar { grid-template-columns: minmax(0, 1fr); }
  .settlement-table-wrap { overflow: visible; }
  .settlement-table { display: block; width: 100%; }
  .settlement-table thead, .settlement-table colgroup { display: none; }
  .settlement-table tbody { display: block; }
  .settlement-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin: 10px 0; padding: 14px; border: 1px solid #dbe7f5; border-radius: 14px; background: #fff; }
  .settlement-table td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; }
  .settlement-table input { width: 100%; max-width: 100%; }
  .settlement-daily-table td:nth-child(1), .settlement-daily-table td:nth-child(2), .settlement-daily-table td:nth-child(3), .settlement-employee-workspace-table td:nth-child(2) { grid-column: 1 / -1; }
  .settlement-daily-table td:nth-child(2), .settlement-employee-workspace-table .settlement-employee-name { font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .settlement-daily-table td:nth-child(12), .settlement-employee-workspace-table td:last-child { grid-column: 1 / -1; }
  .settlement-daily-table [data-save-settlement], .settlement-employee-workspace-table [data-settlement-employee-detail] { width: 100%; }
  .settlement-employee-workspace-table td:first-child { display: none; }
  .settlement-advance-form { grid-template-columns: minmax(0, 1fr); }
  .settlement-advance-form > * { min-width: 0; }
  .settlement-detail-modal { width: calc(100vw - 24px); max-width: none; height: calc(100vh - 24px); max-height: none; }
  .settlement-detail-modal .settlement-detail-table-wrap { overflow: auto; }

  .management-view__grid,
  .management-users-list { grid-template-columns: 1fr; }
  .management-view__head,
  .management-card { padding: 16px; }
  .management-card__title-row { align-items: stretch; flex-direction: column; }
  .management-primary-button { width: 100%; }
  .management-user-card__identity { align-items: stretch; flex-direction: column; }
  .management-user-card__badges { justify-content: flex-start; }
  /* Shared modal limits for every existing dialog. */
  .app-dialog, .mobile-shell, .overtime-detail-window, .settlement-payment-dialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow: auto; }
}

/* Final cascade position for the real 390px refinement. */
@media (max-width: 780px) {
  .attendance-management-view .time-summary-grid.summary-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .attendance-management-view .attendance-summary-card,
  .summary-band .metric,
  .settlement-summary-grid .settlement-summary-card { min-height: 62px !important; padding: 8px 10px !important; gap: 8px !important; }
  .attendance-management-view .attendance-summary-card > .summary-card__icon { flex-basis: 34px !important; width: 34px !important; height: 34px !important; background-size: 18px 18px !important; }
  .attendance-management-view .attendance-summary-card .summary-card__label { margin: 0 !important; font-size: 11px !important; white-space: normal !important; word-break: keep-all; }
  .attendance-management-view .attendance-summary-card .summary-card__value { font-size: 20px !important; }
  .attendance-management-view .attendance-summary-card .summary-card__arrow { font-size: 18px !important; }
  #attendanceView .overview-head-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; width: 100% !important; gap: 8px !important; }
  #attendanceView .overview-head-title { grid-column: 1 / -1 !important; width: 100% !important; min-width: 0 !important; }
  #attendanceView .overview-total { grid-column: 1 / -1 !important; justify-self: start; }
  #attendanceView .overview-head { flex-direction: column !important; align-items: stretch !important; }
  #attendanceView .attendance-overview-filter { display: contents !important; }
  #attendanceView .overview-head-actions button { width: 100% !important; min-width: 0 !important; min-height: 44px !important; padding: 7px 8px !important; word-break: keep-all !important; white-space: normal !important; }
  #dispatchView .dispatch-head { grid-template-columns: minmax(0, 1fr) !important; }
  #dispatchView .dispatch-head-actions { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; width: 100% !important; gap: 8px !important; }
  #dispatchView .dispatch-head-actions > button { grid-column: auto !important; width: 100% !important; min-height: 44px !important; }
}

/* Final attendance-card precedence. */
@media (max-width: 780px) {
  #timeView .time-toolbar { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 8px !important; }
  #timeView .time-toolbar-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; flex-direction: unset !important; gap: 8px !important; width: 100% !important; }
  #timeView .time-toolbar-actions > * { min-width: 0 !important; min-height: 44px !important; }
  #timeView .time-work-table, #timeView .time-work-table table, #timeView .time-work-table tbody { overflow: visible !important; width: 100% !important; min-width: 0 !important; }
  #timeView .time-work-table table, #timeView .time-work-table tbody { display: block !important; }
  #timeView .time-work-table thead { display: none !important; }
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) { position: relative; display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; margin: 10px 0 !important; padding: 14px !important; border: 1px solid #dbe7f5 !important; border-radius: 14px !important; background: #fff !important; box-shadow: 0 3px 12px rgba(15,55,95,.05) !important; }
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td { display: none !important; min-width: 0 !important; padding: 0 !important; border: 0 !important; }
  #timeView .time-work-table .time-name-cell, #timeView .time-work-table .time-company-cell, #timeView .time-work-table .time-start-cell, #timeView .time-work-table .time-end-cell, #timeView .time-work-table .overtime-cell, #timeView .time-work-table .time-memo-cell, #timeView .time-work-table .time-delete-cell { display: flex !important; min-width: 0 !important; }
  #timeView .time-work-table .time-name-cell, #timeView .time-work-table .time-company-cell, #timeView .time-work-table .overtime-cell, #timeView .time-work-table .time-memo-cell, #timeView .time-work-table .time-delete-cell { grid-column: 1 / -1 !important; }
  #timeView .time-work-table .time-name-cell { align-items: center; }
  #timeView .time-work-table .time-mobile-card-head { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; }
  #timeView .time-work-table .time-mobile-worker-name { overflow: hidden; color: #172033; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
  #timeView .time-work-table .time-mobile-status { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: #eef4ff; color: #2563eb; font-size: 12px; font-weight: 800; white-space: nowrap; }
  #timeView .time-work-table .time-mobile-status.pending { background: #fff4e8; color: #c2410c; }
  #timeView .time-work-table .time-name-input, #timeView .time-work-table .attendance-review-badge, #timeView .time-work-table .time-select-cell, #timeView .time-work-table .time-row-number-cell, #timeView .time-work-table .time-gender-cell, #timeView .time-work-table .time-workgroup-cell { display: none !important; }
  #timeView .time-work-table .time-company-cell .time-static-company { display: none !important; }
  #timeView .time-work-table .time-mobile-company-site { display: block !important; overflow: hidden; width: 100%; color: #64748b; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  #timeView .time-work-table .time-start-cell, #timeView .time-work-table .time-end-cell, #timeView .time-work-table .overtime-cell, #timeView .time-work-table .time-memo-cell { flex-direction: column; gap: 5px; }
  #timeView .time-work-table .time-start-cell::before, #timeView .time-work-table .time-end-cell::before, #timeView .time-work-table .overtime-cell::before, #timeView .time-work-table .time-memo-cell::before { color: #64748b; content: attr(data-label); font-size: 12px; font-weight: 800; }
  #timeView .time-work-table .time-start-cell input, #timeView .time-work-table .time-end-cell input, #timeView .time-work-table .overtime-cell input, #timeView .time-work-table .time-memo-cell input { width: 100% !important; max-width: 100% !important; min-height: 42px !important; box-sizing: border-box; }
  #timeView .time-work-table .time-delete-cell { justify-content: flex-end; }
  #timeView .time-work-table .time-delete-row-btn, #timeView .time-work-table .time-add-row-btn { min-height: 42px !important; }
  #timeView .time-work-table .time-add-helper-row { display: block !important; margin: 10px 0 0 !important; }
  #timeView .time-work-table .time-add-helper-row td { display: block !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
  #timeView .time-work-table .time-add-row-btn { width: 100% !important; }
}

/* Match the table-cell rule's specificity so card cells cannot be hidden. */
@media (max-width: 780px) {
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.time-name-cell,
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.time-company-cell,
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.time-start-cell,
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.time-end-cell,
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.overtime-cell,
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.time-memo-cell,
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.time-delete-cell { display: flex !important; }
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.overtime-cell:has(input[value=""]),
  #timeView .time-work-table tbody > tr:not(.time-add-helper-row) > td.time-memo-cell:has(input[value=""]) { display: none !important; }
}
@media (max-width: 360px) { #timeView .time-work-table .time-start-cell, #timeView .time-work-table .time-end-cell { grid-column: 1 / -1 !important; } }

/* Highest-priority compact schedule correction. */
@media (max-width: 780px) {
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-full { display: none !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-mobile { display: inline !important; }
  #attendanceView .overview-head-title { display: contents !important; }
  #attendanceView .overview-head h2 { grid-column: 1 !important; grid-row: 1 !important; }
  #attendanceView .overview-total { grid-column: 2 !important; grid-row: 1 !important; justify-self: end !important; }
}

/* Final cascade: compact schedule-only layout at phone and tablet widths. */
.metric-label-mobile,
.summary-band .metric .metric-label-mobile { display: none !important; }
@media (max-width: 780px) {
  .layout:has(#attendanceView:not(.hidden)) .summary-band {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px;
  }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric {
    min-height: 64px !important;
    padding: 8px 7px !important;
    overflow: hidden;
    text-align: center;
  }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-full { display: none; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-mobile { display: inline; font-size: 11px !important; line-height: 1.2; white-space: nowrap; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric strong { font-size: 22px !important; }

  #attendanceView .overview-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 8px;
    padding: 12px 14px;
  }
  #attendanceView .overview-head-title { display: contents !important; }
  #attendanceView .overview-head h2 { grid-column: 1; grid-row: 1; margin: 0; min-width: 0; }
  #attendanceView .overview-total { grid-column: 2; grid-row: 1; justify-self: end; min-width: 0; margin: 0; white-space: nowrap; word-break: keep-all; }
  #attendanceView .overview-head-actions { grid-column: 1 / -1; grid-row: 2; }

  #attendanceView .overview-company { grid-template-columns: minmax(0, 1fr) auto 44px; min-height: 64px; }
  #attendanceView .overview-company-copy { display: grid; min-width: 0; gap: 3px; }
  #attendanceView .overview-company-sub { display: block; overflow: hidden; color: #64748b; font-size: 12px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; }
  #attendanceView .overview-company-count { align-self: start; margin-top: 3px; }
}

@media (max-width: 360px) {
  .layout:has(#attendanceView:not(.hidden)) .summary-band { gap: 5px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric { padding: 7px 4px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric .metric-label-mobile { font-size: 10px !important; }
  .layout:has(#attendanceView:not(.hidden)) .summary-band .metric strong { font-size: 20px !important; }
}










