:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #eef8f6;
  --ink: #111827;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #dce4ee;
  --line-strong: #c6d2df;
  --sidebar: #071829;
  --sidebar-2: #0c2237;
  --accent: #0f766e;
  --accent-strong: #0b5f5a;
  --accent-soft: #e8f7f4;
  --blue: #2563eb;
  --blue-soft: #eef4ff;
  --violet: #6d5bd0;
  --violet-soft: #f2efff;
  --amber: #b7791f;
  --amber-soft: #fff7e8;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #157347;
  --success-soft: #eaf8ef;
  --shadow: 0 14px 36px rgba(17, 24, 39, 0.07);
  --shadow-soft: 0 8px 22px rgba(17, 24, 39, 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled) {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18);
}

button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus {
  border-color: rgba(15, 118, 110, 0.58);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.11);
}

input[type="color"] {
  padding: 5px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: 0;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fbfcfe;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #f8fbff;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
}

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, #e6f1f2 0, #f6f8fb 320px, #f7f9fc 100%),
    var(--bg);
}

.login-card {
  width: min(390px, 100%);
  display: grid;
  gap: 22px;
  border: 1px solid rgba(216, 225, 236, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-card h1 {
  color: var(--accent-strong);
  font-size: 2.2rem;
  text-align: center;
}

.captcha-row {
  display: flex;
  justify-content: center;
  min-height: 65px;
}

.turnstile-widget {
  min-height: 65px;
}

.captcha-warning {
  width: 100%;
  margin: 0;
  border: 1px solid rgba(180, 35, 24, 0.25);
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 12px;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  background: var(--bg);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #e5eef8;
  padding: 22px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #11b7a8, #0f766e);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(17, 183, 168, 0.28);
}

.sidebar-brand strong {
  display: block;
  color: #ffffff;
  line-height: 1.08;
}

.sidebar-brand span:not(.brand-mark) {
  display: block;
  margin-top: 4px;
  color: #91a4ba;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 14px;
}

.main-workspace {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 22px 26px 30px;
}

.topbar {
  min-height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  margin: -22px -26px 4px;
  background: rgba(255, 255, 255, 0.86);
  padding: 14px 26px;
}

.topbar-actions,
.toolbar,
.demo-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 150px;
}

.toolbar input[type="month"] {
  min-width: 180px;
}

.topbar-actions {
  justify-content: flex-end;
}

.user-chip {
  min-height: 42px;
  display: grid;
  align-content: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
}

.user-chip span,
.user-chip strong {
  line-height: 1.08;
}

.user-chip span {
  color: #ffffff;
}

.user-chip strong {
  color: #9fb1c5;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.tabs {
  display: grid;
  align-content: start;
  gap: 7px;
}

.tabs button {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  color: #dbe7f3;
  text-align: left;
  white-space: nowrap;
}

.tabs button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.tabs button.active {
  background: linear-gradient(90deg, #0f766e, #12a394);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.26);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel,
.report-command {
  border: 1px solid rgba(216, 225, 236, 0.94);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
}

.metric {
  position: relative;
  min-height: 92px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
  padding: 16px 17px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--metric-color, var(--accent));
}

.metric span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.metric strong {
  color: var(--ink);
  font-size: 1.9rem;
  line-height: 1;
}

.metric-present {
  --metric-color: var(--success);
}

.metric-late {
  --metric-color: var(--amber);
}

.metric-absent {
  --metric-color: var(--danger);
}

.metric-active {
  --metric-color: var(--blue);
}

.dashboard-grid,
.workbench {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.report-stack {
  display: grid;
  gap: 14px;
}

.report-command {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.report-filterbar {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) minmax(220px, 1.4fr);
  gap: 12px;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.report-kpi {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
  padding: 14px;
}

.report-kpi span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.report-kpi strong {
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
}

.report-kpi small {
  color: var(--muted);
  font-weight: 750;
}

.report-kpi.good {
  background: linear-gradient(180deg, #ffffff, var(--success-soft));
}

.report-kpi.warn {
  background: linear-gradient(180deg, #ffffff, var(--amber-soft));
}

.report-kpi.idle {
  background: linear-gradient(180deg, #ffffff, #eff6ff);
}

.report-kpi.danger {
  background: linear-gradient(180deg, #ffffff, var(--danger-soft));
}

.report-kpi.pay {
  background: linear-gradient(180deg, #ffffff, var(--accent-soft));
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.report-side {
  display: grid;
  gap: 14px;
}

.report-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-controls {
  min-width: min(100%, 620px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.payroll-table .number-cell,
.compact-table .number-cell {
  text-align: right;
}

.payroll-table {
  min-width: 980px;
}

.strong-cell {
  color: var(--accent-strong);
  font-size: 1.02rem;
  font-weight: 950;
}

.compact-table {
  min-width: 540px;
}

.compact-table th,
.compact-table td {
  padding: 10px 12px;
}

.staff-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.staff-cell strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-chip {
  width: 32px;
  height: 32px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #e7f4f1;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 950;
}

.compliance {
  color: var(--accent-strong);
  font-weight: 950;
}

.payroll-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.7rem;
  font-weight: 950;
}

.payroll-badge.ready {
  background: var(--success-soft);
  color: var(--success);
}

.payroll-badge.review {
  background: var(--amber-soft);
  color: var(--amber);
}

.payroll-badge.check {
  background: var(--danger-soft);
  color: var(--danger);
}

.payroll-badge.neutral {
  background: #f1f5f9;
  color: var(--muted);
}

.roster-board {
  display: grid;
  grid-template-columns: minmax(240px, 0.66fr) minmax(0, 2.35fr);
  gap: 14px;
  align-items: start;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: 1 / -1;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.month-panel {
  overflow-x: auto;
}

.section-title {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
  padding: 14px 18px;
}

.section-title.wrap {
  align-items: center;
  flex-wrap: wrap;
}

.section-title .muted {
  margin-bottom: 0;
}

.padded {
  padding: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.workbench .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workbench .form-grid button,
.workbench .form-grid .check-row,
.workbench .form-grid .weekday-picker,
.workbench .form-grid .captcha-row,
.workbench .form-grid .form-message,
.workbench .form-grid p {
  grid-column: 1 / -1;
}

.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

.weekday-picker legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  padding: 0 6px;
}

.weekday-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 6px 10px;
  color: var(--ink);
}

.weekday-picker input {
  width: auto;
  min-height: auto;
}

.palette-controls {
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  padding: 16px 18px;
}

.time-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.worker-list {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
}

.worker-token {
  height: auto;
  min-height: 56px;
  display: grid;
  justify-items: start;
  gap: 4px;
  border-color: #cbd8e7;
  background: linear-gradient(180deg, #ffffff, #f6f9fc);
  text-align: left;
}

.worker-token span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.worker-token:active {
  cursor: grabbing;
}

.month-calendar {
  min-width: 920px;
  display: grid;
  grid-template-columns: repeat(7, minmax(128px, 1fr));
}

.mobile-week-timetable {
  display: none;
}

.weekday {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 950;
  padding: 10px 12px;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 7px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 8px;
  min-width: 0;
}

.calendar-day:nth-child(7n),
.calendar-day:nth-child(7n + 1) {
  background: #fbfcff;
}

.calendar-day.empty {
  background: #f2f5f9;
}

.calendar-day.today {
  background: #f0fdfa;
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.24);
}

.calendar-day.drag-over {
  outline: 3px solid rgba(15, 118, 110, 0.3);
  outline-offset: -3px;
  background: #ecfdf5;
}

.cs-shift-grid {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.shift-slot {
  position: relative;
  min-height: 56px;
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0;
  min-width: 0;
  overflow: hidden;
}

.shift-slot.morning {
  border-color: #0b63ce;
  background: linear-gradient(180deg, #f3f8ff, #ffffff);
}

.shift-slot.night {
  border-color: #312e81;
  background: linear-gradient(180deg, #f7f5ff, #ffffff);
  margin-top: 0;
}

.shift-slot.night::before {
  display: none;
}

.shift-slot.night::after {
  display: none;
}

.shift-slot.drag-over {
  border-color: var(--accent);
  background: #ecfdf5;
}

.slot-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  min-width: 0;
  padding: 6px 7px;
  color: #ffffff;
}

.shift-slot.morning .slot-title {
  background: #075dbd;
}

.shift-slot.night .slot-title {
  background: #29246d;
}

.slot-title div {
  display: grid;
  min-width: 0;
}

.slot-title strong {
  overflow: hidden;
  color: inherit;
  font-size: 0.67rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}

.slot-title span {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.56rem;
  font-weight: 950;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-title em {
  min-height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 0.5rem;
  font-style: normal;
  font-weight: 950;
  line-height: 18px;
  padding: 0 6px;
  white-space: nowrap;
}

.slot-workers {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 6px;
}

.day-head {
  min-height: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.day-head strong {
  font-size: 0.98rem;
  line-height: 1;
}

.day-head span,
.drop-hint {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 950;
}

.day-shifts {
  display: grid;
  gap: 7px;
}

.calendar-shift {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #ffffff;
  padding: 5px 25px 5px 6px;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.05);
}

.shift-slot .calendar-shift {
  min-height: 29px;
  grid-template-columns: auto minmax(0, 1fr);
  padding-top: 4px;
  padding-right: 20px;
  padding-bottom: 4px;
}

.calendar-shift.morning {
  border-left: 3px solid #075dbd;
}

.calendar-shift.night {
  border-left: 3px solid #29246d;
}

.worker-calendar .calendar-shift {
  padding-right: 7px;
}

.worker-day {
  min-height: 118px;
}

.calendar-shift div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.calendar-shift strong,
.calendar-shift span {
  min-width: 0;
}

.calendar-shift strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.67rem;
  line-height: 1.08;
}

.calendar-shift span:not(.status):not(.shift-dot) {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.54rem;
  font-weight: 850;
  line-height: 1;
}

.shift-slot .calendar-shift .shift-time {
  display: none;
}

.shift-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.calendar-shift.on_time .shift-dot,
.calendar-shift.checked_out .shift-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(21, 115, 71, 0.12);
}

.calendar-shift.late .shift-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}

.calendar-shift.absent .shift-dot,
.calendar-shift.cancelled .shift-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.calendar-shift button {
  position: absolute;
  top: 6px;
  right: 5px;
  width: 15px;
  min-height: 15px;
  border-color: transparent;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font-size: 0.58rem;
  line-height: 1;
  padding: 0;
  box-shadow: none;
}

.calendar-shift button:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
  box-shadow: none;
  transform: none;
}

.calendar-shift .status {
  min-height: 16px;
  max-width: 46px;
  overflow: hidden;
  padding: 1px 5px;
  font-size: 0.48rem;
  line-height: 1;
  text-overflow: ellipsis;
}

.shift-slot .calendar-shift .status {
  display: none;
}

.shift-slot .drop-hint {
  min-height: 29px;
  display: grid;
  place-items: center;
  border: 1px dashed #9aa9bd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: #56657a;
  font-size: 0.58rem;
  text-align: center;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.demo-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.notice {
  border: 1px solid #bdeccc;
  border-radius: 8px;
  background: var(--success-soft);
  color: #166534;
  font-weight: 850;
  padding: 12px 14px;
}

.notice.warning {
  border-color: #f4d19b;
  background: var(--amber-soft);
  color: #9a3412;
}

.notice.danger {
  border-color: #ffc9c3;
  background: var(--danger-soft);
  color: var(--danger);
}

.form-message {
  margin-bottom: 0;
}

.pill,
.status,
.department-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 25px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 950;
  white-space: nowrap;
}

.pill.neutral {
  background: #eaf0ff;
  color: #3730a3;
}

.sidebar-footer .pill.neutral {
  background: rgba(255, 255, 255, 0.12);
  color: #dce7ff;
}

.role-superadmin {
  background: #f4e8ff !important;
  color: #6d28d9 !important;
}

.role-admin {
  background: #eaf2ff !important;
  color: #1d4ed8 !important;
}

.role-worker {
  background: #ecfdf5 !important;
  color: #047857 !important;
}

.department-pill {
  border: 1px solid color-mix(in srgb, var(--dept, #64748b) 36%, white);
  background: color-mix(in srgb, var(--dept, #64748b) 12%, white);
  color: color-mix(in srgb, var(--dept, #64748b) 80%, #111827);
}

.status.scheduled {
  background: var(--blue-soft);
  color: var(--blue);
}

.status.on_time,
.status.checked_out {
  background: var(--success-soft);
  color: var(--success);
}

.status.late {
  background: var(--amber-soft);
  color: var(--amber);
}

.status.absent,
.status.cancelled {
  background: var(--danger-soft);
  color: var(--danger);
}

.muted {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.table-wrap {
  overflow-x: auto;
}

.worker-hero {
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(37, 99, 235, 0.05)),
    rgba(255, 255, 255, 0.96);
}

.worker-hero h2 {
  font-size: 1.85rem;
}

.hero-time {
  margin: 10px 0 6px;
  color: var(--ink-soft);
  font-size: 1.08rem;
  font-weight: 950;
}

.check-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 18px;
}

.detail-grid span {
  color: var(--muted);
  font-weight: 850;
}

.activity-card {
  border-color: rgba(15, 118, 110, 0.18);
  background:
    linear-gradient(180deg, rgba(232, 247, 244, 0.62), rgba(255, 255, 255, 0.96)),
    #ffffff;
}

.activity-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  background: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 950;
}

.activity-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.activity-status.active {
  color: var(--success);
  background: var(--success-soft);
}

.activity-status.idle {
  color: var(--danger);
  background: var(--danger-soft);
}

.activity-status.standby {
  color: var(--amber);
  background: var(--amber-soft);
}

.stack-list {
  display: grid;
}

.stack-list.compact {
  border-top: 1px solid var(--line);
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.list-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.list-row .right {
  text-align: right;
}

.color-dot {
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: 999px;
  background: var(--dot);
  box-shadow: 0 0 0 1px var(--line);
}

.empty-state {
  color: var(--muted);
  font-weight: 850;
  padding: 18px;
}

@media (max-width: 1180px) {
  .app-view {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
  }

  .tabs {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
  }

  .tabs button {
    width: auto;
  }

  .sidebar-footer {
    justify-self: end;
    border-top: 0;
    padding-top: 0;
  }

  .topbar {
    margin-top: 0;
  }

  .report-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .report-layout,
  .dashboard-grid,
  .workbench,
  .roster-board,
  .report-detail-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3,
  .worker-hero {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  :root {
    --bg: #f7faf9;
    --surface-tint: #eefbf6;
    --accent: #0f8a74;
    --accent-strong: #06695d;
    --accent-soft: #e7f8f2;
    --line: #e5edf3;
    --shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 8px 18px rgba(15, 23, 42, 0.05);
  }

  body {
    background: var(--bg);
  }

  .login-card {
    width: min(360px, 100%);
    gap: 18px;
    border-radius: 18px;
    padding: 28px 22px;
  }

  .login-card h1 {
    font-size: 2.4rem;
    letter-spacing: 0;
  }

  .login-card label {
    gap: 8px;
    font-size: 0.74rem;
  }

  .login-card input,
  .login-card button {
    min-height: 52px;
    border-radius: 14px;
  }

  .app-view {
    min-height: 100dvh;
    background: transparent;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 24;
    height: auto;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: visible;
    border-bottom: 1px solid rgba(213, 224, 235, 0.94);
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
    padding: 10px 12px;
  }

  .sidebar-brand {
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 42px;
    gap: 10px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: #0f8a74;
    box-shadow: none;
  }

  .sidebar-brand strong {
    color: var(--ink);
    font-size: 1rem;
    line-height: 1;
  }

  .sidebar-brand span:not(.brand-mark) {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.62rem;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 0;
    padding-top: 0;
  }

  .sidebar-footer .pill.neutral {
    display: none;
  }

  .user-chip {
    min-height: 38px;
    max-width: 118px;
    border-color: rgba(15, 138, 116, 0.16);
    background: var(--accent-soft);
    padding: 5px 9px;
  }

  .user-chip span {
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
  }

  .user-chip strong {
    color: var(--accent-strong);
    font-size: 0.55rem;
  }

  .tabs {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    gap: 0;
    grid-column: auto;
    overflow-x: hidden;
    border: 0;
    border-top: 1px solid rgba(213, 224, 235, 0.94);
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.08);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    backdrop-filter: none;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs button {
    flex: 1 1 58px;
    min-width: 0;
    min-height: 48px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 0.58rem;
    line-height: 1.05;
    padding: 7px 2px;
    position: relative;
    text-align: center;
    white-space: normal;
  }

  .tabs button::before {
    display: none;
  }

  .tabs button:hover:not(:disabled) {
    background: var(--accent-soft);
    border-color: transparent;
    color: var(--accent-strong);
  }

  .tabs button.active {
    background: #eefbf6;
    color: var(--accent-strong);
    box-shadow: none;
  }

  .tabs:has(button:only-child) {
    display: none;
  }

  .main-workspace {
    gap: 10px;
    padding: 0 0 72px;
  }

  .topbar {
    position: static;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 60px;
    border-bottom: 1px solid rgba(213, 224, 235, 0.94);
    margin: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
    padding: 10px 12px;
  }

  .topbar h1 {
    font-size: 1.08rem;
    text-align: left;
  }

  .eyebrow {
    display: none;
  }

  .page-subtitle {
    display: none;
  }

  .topbar-actions,
  .demo-buttons,
  .toolbar {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar,
  .toolbar::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions > *,
  .demo-buttons button,
  .toolbar input,
  .toolbar select {
    width: auto;
    min-width: max-content;
  }

  .topbar-actions button {
    min-height: 36px;
    border-radius: 999px;
    padding: 0 11px;
    font-size: 0.72rem;
  }

  #resetDemo {
    display: none;
  }

  .month-panel .toolbar {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr) 68px;
    width: 100%;
    overflow: visible;
  }

  .month-panel .toolbar button,
  .month-panel .toolbar input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    border-radius: 13px;
    font-size: 0.8rem;
  }

  .metrics,
  .report-filterbar,
  .workbench .form-grid,
  .time-controls {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 0 0 18px 18px;
    margin: 0 12px 2px;
    overflow: hidden;
    background: #ffffff;
  }

  .metric,
  .panel,
  .report-command {
    border-radius: 16px;
  }

  .metric {
    min-height: 70px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    padding: 10px 6px;
    text-align: center;
  }

  .metric:last-child {
    border-right: 0;
  }

  .metric::before {
    display: none;
  }

  .metric span {
    font-size: 0.55rem;
    line-height: 1.1;
  }

  .metric strong {
    font-size: 1.18rem;
  }

  .section-title {
    min-height: auto;
    padding: 14px 15px;
  }

  .section-title h2 {
    font-size: 0.96rem;
  }

  .padded {
    padding: 15px;
  }

  .report-command {
    padding: 14px;
  }

  .report-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .report-kpi {
    min-height: 82px;
    padding: 12px;
  }

  .report-kpi span {
    font-size: 0.66rem;
  }

  .report-kpi strong {
    font-size: 1.34rem;
  }

  .report-kpi small {
    font-size: 0.66rem;
  }

  .roster-board {
    gap: 12px;
  }

  #screenRoot {
    padding: 0 12px 8px;
  }

  .worker-palette .worker-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .worker-token {
    min-height: 50px;
    border-radius: 14px;
  }

  .month-panel {
    overflow-x: auto;
  }

  .desktop-month-calendar {
    display: none;
  }

  .mobile-week-timetable {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--line);
    background: #f8fbfa;
    padding: 12px;
  }

  .mobile-week-controls {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) 86px;
    align-items: center;
    gap: 8px;
  }

  .mobile-week-controls button {
    min-height: 42px;
    border-radius: 13px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .mobile-week-controls div {
    min-width: 0;
    display: grid;
    gap: 2px;
    text-align: center;
  }

  .mobile-week-controls strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-week-controls span,
  .mobile-scroll-note {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 850;
  }

  .mobile-scroll-note {
    margin: -2px 0 0;
    text-align: center;
  }

  .mobile-week-days {
    display: grid;
    gap: 12px;
  }

  .mobile-week-day {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    padding: 12px;
  }

  .mobile-week-day.today {
    border-color: rgba(15, 138, 116, 0.36);
    box-shadow: 0 10px 26px rgba(15, 138, 116, 0.1);
  }

  .mobile-day-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }

  .mobile-day-heading div {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .mobile-day-heading strong {
    color: var(--ink);
    font-size: 1rem;
  }

  .mobile-day-heading span {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 850;
  }

  .mobile-day-heading em {
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 950;
    padding: 5px 9px;
  }

  .mobile-week-day .cs-shift-grid {
    gap: 9px;
  }

  .mobile-week-day .shift-slot {
    border-width: 2px;
    border-radius: 15px;
  }

  .mobile-week-day .slot-title {
    min-height: 40px;
    padding: 8px 11px;
  }

  .mobile-week-day .slot-title strong {
    font-size: 0.85rem;
  }

  .mobile-week-day .slot-title span {
    font-size: 0.72rem;
  }

  .mobile-week-day .slot-title em {
    min-height: 24px;
    line-height: 24px;
    font-size: 0.64rem;
    padding: 0 9px;
  }

  .mobile-week-day .slot-workers {
    gap: 7px;
    padding: 10px;
  }

  .mobile-week-day .calendar-shift {
    min-height: 42px;
    border-radius: 12px;
    padding: 8px 28px 8px 9px;
  }

  .mobile-week-day .calendar-shift strong {
    font-size: 0.85rem;
  }

  .mobile-week-day .shift-dot {
    width: 11px;
    height: 11px;
  }

  .mobile-week-day .drop-hint {
    min-height: 42px;
    border-radius: 12px;
    font-size: 0.8rem;
  }

  .mobile-other-shifts {
    display: grid;
    gap: 8px;
    border: 1px dashed #b8c7d8;
    border-radius: 15px;
    padding: 10px;
  }

  .worker-hero {
    display: grid;
    gap: 14px;
    border-color: #d8eee7;
    background: #ffffff;
    padding: 16px;
  }

  .worker-hero h2 {
    font-size: 1.25rem;
  }

  .hero-time {
    margin: 8px 0 5px;
    color: var(--accent-strong);
    font-size: 1.35rem;
  }

  .check-actions {
    justify-content: stretch;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .check-actions button {
    min-height: 50px;
    border-radius: 14px;
  }

  .check-actions button.primary {
    background: linear-gradient(180deg, #0f9a84, #087464);
  }

  .list-row {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
    padding: 13px 15px;
  }

  .list-row .right {
    text-align: left;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 15px;
  }

  .table-wrap table {
    min-width: 620px;
  }

  .people-table,
  .payroll-table,
  .compact-table {
    min-width: 0;
  }

  .people-table thead,
  .payroll-table thead,
  .compact-table thead {
    display: none;
  }

  .people-table,
  .people-table tbody,
  .people-table tr,
  .people-table td,
  .payroll-table,
  .payroll-table tbody,
  .payroll-table tr,
  .payroll-table td,
  .compact-table,
  .compact-table tbody,
  .compact-table tr,
  .compact-table td {
    display: block;
    width: 100%;
  }

  .people-table tr,
  .payroll-table tr,
  .compact-table tr {
    position: relative;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }

  .people-table td,
  .payroll-table td,
  .compact-table td {
    border: 0;
    padding: 2px 0;
  }

  .people-table td:first-child,
  .payroll-table td:first-child,
  .compact-table td:nth-child(2) {
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 900;
  }

  .people-table td:nth-child(2),
  .payroll-table td:nth-child(2),
  .compact-table td:nth-child(3),
  .compact-table td:nth-child(4),
  .compact-table td:nth-child(5) {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
  }

  .people-table td:nth-child(3),
  .people-table td:nth-child(4),
  .payroll-table td:nth-child(8) {
    margin-top: 6px;
  }

  .payroll-table td:nth-child(3),
  .payroll-table td:nth-child(4),
  .payroll-table td:nth-child(5),
  .payroll-table td:nth-child(6),
  .payroll-table td:nth-child(7) {
    display: inline-flex;
    width: auto;
    margin: 8px 10px 0 0;
    color: var(--ink-soft);
    font-size: 0.74rem;
    font-weight: 850;
  }

  .payroll-table td:nth-child(3)::before {
    content: "Worked ";
    color: var(--muted);
  }

  .payroll-table td:nth-child(4)::before {
    content: "Late ";
    color: var(--muted);
  }

  .payroll-table td:nth-child(5)::before {
    content: "Absent ";
    color: var(--muted);
  }

  .compact-table td:first-child::before {
    content: "";
  }

  .calendar-legend {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    scrollbar-width: none;
  }

  .calendar-legend::-webkit-scrollbar {
    display: none;
  }

  .calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 900;
    padding: 5px 8px;
    white-space: nowrap;
  }

  .legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--muted-2);
  }

  .legend-dot.morning {
    background: #2563eb;
  }

  .legend-dot.night {
    background: #6d5bd0;
  }

  .legend-dot.off {
    background: #cbd5e1;
  }

  .legend-dot.late {
    background: #f59e0b;
  }

  .worker-calendar {
    min-width: 0;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .worker-calendar .weekday {
    border-right: 0;
    color: var(--muted);
    font-size: 0.55rem;
    padding: 8px 2px;
    text-align: center;
  }

  .worker-calendar .calendar-day {
    min-height: 64px;
    gap: 3px;
    border-color: #e8eef5;
    padding: 5px 4px;
  }

  .worker-calendar .calendar-day.empty {
    min-height: 64px;
  }

  .worker-calendar .calendar-day.selected {
    background: #f0fdfa;
    box-shadow: inset 0 0 0 2px var(--accent);
  }

  .worker-calendar .day-head {
    min-height: 15px;
    justify-content: center;
  }

  .worker-calendar .day-head strong {
    font-size: 0.72rem;
  }

  .worker-calendar .day-head span {
    display: none;
  }

  .worker-calendar .day-shifts {
    gap: 3px;
  }

  .worker-calendar .calendar-shift {
    min-height: 14px;
    display: block;
    border: 0;
    border-radius: 999px;
    padding: 0;
    box-shadow: none;
  }

  .worker-calendar .calendar-shift.morning {
    background: #2563eb;
    border-left: 0;
  }

  .worker-calendar .calendar-shift.night {
    background: #6d5bd0;
    border-left: 0;
  }

  .worker-calendar .calendar-shift.late {
    background: #f59e0b;
  }

  .worker-calendar .calendar-shift.absent {
    background: #ef4444;
  }

  .worker-calendar .calendar-shift > * {
    display: none;
  }

  .worker-calendar .drop-hint {
    min-height: 14px;
    display: block;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
    color: transparent;
    font-size: 0;
  }

  .worker-selected-shift {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--line);
    background: #fbfefc;
    padding: 14px 15px;
  }

  .worker-selected-shift > div {
    display: grid;
    gap: 3px;
  }

  .selected-shift-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #ffffff;
    padding: 12px;
  }

  .selected-shift-card.morning {
    border-color: rgba(37, 99, 235, 0.24);
    background: #f3f8ff;
  }

  .selected-shift-card.night {
    border-color: rgba(109, 91, 208, 0.24);
    background: #f7f5ff;
  }

  .selected-shift-card div {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .selected-shift-card span:not(.status):not(.shift-dot) {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
  }

  .off-day {
    min-height: 44px;
    display: grid;
    place-items: center;
    border: 1px dashed #cbd5e1;
    border-radius: 15px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 0.82rem;
  }

  .cs-shift-grid {
    gap: 7px;
  }

  .month-calendar:not(.worker-calendar) {
    min-width: 880px;
  }
}
