:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-hover: #5a9cff;
  --accent2: #2ecc71;
  --danger: #ff6b6b;
  --border: #2f4058;
  --code-h: #ffd166;
  --code-s: #06d6a0;
  --radius: 0;
  --control-height: 2.55rem;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(160deg, #0b1020, #121a28 40%, #0f1419);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.experience-panel {
  max-width: 36rem;
  margin: 2rem auto;
}
.experience-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 1.25rem 0;
}
@media (max-width: 520px) {
  .experience-choices {
    grid-template-columns: 1fr;
  }
}
.experience-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  padding: 1.1rem 1.15rem;
  min-height: 7rem;
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.experience-card:hover {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.08);
}
.experience-card strong {
  font-size: 1.05rem;
}
.experience-card .muted {
  font-size: 0.82rem;
  line-height: 1.4;
}
.experience-icon {
  font-size: 1.75rem;
  line-height: 1;
}
.experience-remember {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.experience-view-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.experience-view-control select {
  width: auto;
  min-width: 7.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  min-height: 2.35rem;
}
.login-view-foot {
  margin: 1rem 0 0;
  text-align: center;
}

.account-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.25rem;
  margin: 0;
  max-width: 28rem;
}
.account-summary dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.account-summary dd {
  margin: 0;
}
.account-password-form .account-password-actions {
  display: flex;
  align-items: flex-end;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  margin-left: auto;
}
.topbar-actions #logout-btn {
  margin-left: 0;
}

input.date-uk-input {
  min-width: 6.75rem;
  max-width: 7.5rem;
  font-variant-numeric: tabular-nums;
}

.cal-page-focused-book .cal-manual-book-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(61, 139, 253, 0.35);
}
.cal-page-focused-book .calendar-wrap-focused {
  max-width: 100%;
}
.cal-page-focused-book .calendar-wrap-focused .calendar {
  min-width: 0;
}

.reports-page > .panel {
  max-width: 56rem;
}
.reports-page .panel > p.muted {
  margin-bottom: 1rem;
  line-height: 1.5;
}
.reports-page .report-form {
  display: block;
  margin-bottom: 0;
}
.reports-page .report-form,
.reports-page .report-form-section,
.reports-page .report-type-grid-wrap,
.reports-page .report-type-grid label,
.reports-page .report-form input,
.reports-page .report-form select,
.reports-page .report-form button {
  border-radius: 0;
}
.reports-page .report-form fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.reports-page .report-form-section {
  margin: 0 0 1.1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.reports-page .report-form-section-wide {
  width: 100%;
}
.reports-page .report-form-section h4 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.reports-page .report-form label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.reports-page .report-form label input:not([type="checkbox"]),
.reports-page .report-form label select {
  margin-top: 0.35rem;
  width: 100%;
  max-width: 100%;
  border-radius: 0;
}
.reports-page .report-form .checkbox-inline input[type="checkbox"] {
  width: auto;
  margin-top: 0;
}
.reports-page .report-period-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}
.reports-page .report-form-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
@media (max-width: 900px) {
  .reports-page .report-form-split {
    grid-template-columns: 1fr;
  }
}
.reports-page .report-form-split .report-form-section {
  margin-bottom: 0;
  height: 100%;
}
.reports-page .report-field-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.reports-page .report-field-stack select {
  min-width: 0;
}
.reports-page .report-checkbox-block {
  margin-top: 0.25rem;
  align-items: flex-start;
  line-height: 1.4;
}
.reports-page .report-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}
.reports-page .report-category-grid {
  gap: 0.55rem 0.85rem;
}
.reports-page .report-filter-grid label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: normal;
}
.reports-page .report-filter-grid label input[type="checkbox"] {
  width: auto;
  margin: 0;
  min-height: auto;
  flex-shrink: 0;
}
.reports-page .report-type-toolbar {
  margin-bottom: 0.65rem;
}
.reports-page .report-type-grid-wrap {
  padding: 0.65rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.reports-page .report-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}
.reports-page .report-type-grid label {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.45rem;
  row-gap: 0.1rem;
  align-items: start;
  margin: 0;
  padding: 0.5rem 0.6rem;
  width: calc(50% - 0.25rem);
  min-width: 10.5rem;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.8rem;
  line-height: 1.35;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
}
@media (min-width: 640px) {
  .reports-page .report-type-grid label {
    width: calc(33.333% - 0.34rem);
  }
}
@media (min-width: 900px) {
  .reports-page .report-type-grid label {
    width: calc(25% - 0.38rem);
  }
}
.reports-page .report-type-grid label input[type="checkbox"] {
  grid-row: 1 / span 2;
  margin: 0.1rem 0 0;
  width: auto;
  min-height: auto;
}
.reports-page .report-type-code {
  font-weight: 700;
  color: var(--text);
  grid-column: 2;
  grid-row: 1;
}
.reports-page .report-type-name {
  color: var(--muted);
  font-size: 0.76rem;
  grid-column: 2;
  grid-row: 2;
  word-break: break-word;
}
.reports-page .report-output-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.35rem;
  align-items: center;
}
.reports-page .report-group-select select {
  min-width: 11rem;
  margin-top: 0.35rem;
}
.reports-page .report-form-actions {
  padding-top: 0.25rem;
}
.reports-page .report-form-actions button {
  min-width: 10rem;
}
.reports-page #report-out {
  margin-top: 1.25rem;
}

.team-page-toolbar {
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}
.team-filters-panel {
  margin-bottom: 1rem;
}
.team-filter-form {
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 0;
}
.team-filter-form label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 10rem;
}
.team-filter-form select {
  margin-top: 0.35rem;
  min-width: 12rem;
  border-radius: 0;
}
.team-filter-form button {
  min-height: 2.35rem;
}
.team-page-toolbar label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.team-page-toolbar select {
  margin-top: 0.35rem;
  min-width: 6rem;
  border-radius: 0;
}
.team-usage-stats {
  margin-bottom: 1rem;
}
.team-month-table .team-totals-year-row td {
  border-top: 2px solid var(--border);
  background: var(--surface2);
}
.report-form .report-date-label input[type="date"] {
  min-width: 10.75rem;
  width: auto;
  color-scheme: dark;
  cursor: pointer;
}
.report-form .report-date-label input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.85;
  filter: invert(0.85);
}
.report-overview .report-period-line {
  margin: 0 0 0.75rem;
}
.report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.5rem;
}
.report-stats .stat .value {
  font-size: 1.15rem;
}
.report-by-employee,
.report-detail {
  margin-top: 1rem;
}
.table-scroll {
  overflow-x: auto;
}
table.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.report-table th,
table.report-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: middle;
}
table.report-table th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

#login-screen[hidden],
#main-screen[hidden] {
  display: none !important;
}

#app.app-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
#app.app-auth #main-screen {
  display: none !important;
}
#app.app-app #login-screen {
  display: none !important;
}

.login-panel {
  max-width: 420px;
  width: 100%;
  margin: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.login-panel h1 { margin: 0 0 .25rem; font-size: 1.6rem; }
.muted { color: var(--muted); margin-top: 0; }

form label {
  display: block;
  margin: .75rem 0;
  font-size: .9rem;
  color: var(--muted);
}
input, textarea {
  width: 100%;
  margin-top: .35rem;
  padding: .55rem .65rem;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  box-sizing: border-box;
}
select {
  width: 100%;
  margin-top: .35rem;
  padding: 0.5rem 2rem 0.5rem 0.65rem;
  border-radius: 0;
  border: 1px solid var(--border);
  background-color: var(--surface2);
  color: var(--text);
  box-sizing: border-box;
  line-height: normal;
  min-height: var(--control-height);
  vertical-align: middle;
  cursor: pointer;
}
select[multiple],
select[size]:not([size='1']) {
  min-height: 6rem;
  padding: 0.45rem 0.65rem;
  overflow: auto;
  white-space: normal;
}
button {
  cursor: pointer;
  border: none;
  border-radius: 0;
  padding: .55rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  min-height: 44px;
}
button:hover:not(:disabled) {
  background: var(--accent-hover);
}
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
button.danger { background: var(--danger); }
button.small { padding: .35rem .6rem; font-size: .85rem; }

.error { color: var(--danger); font-size: .9rem; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 1.35rem;
  padding-top: max(0.85rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: rgba(26, 35, 50, 0.92);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
  min-width: 0;
}
.topbar > div:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  flex-shrink: 0;
  margin-right: 0.25rem;
  padding-right: 1.25rem;
  border-right: 1px solid var(--border);
}
.topbar #logout-btn {
  flex-shrink: 0;
  min-height: auto;
  padding: 0.45rem 0.85rem;
}
.badge {
  display: inline-block;
  margin-left: .5rem;
  padding: .15rem .5rem;
  border-radius: 0;
  background: var(--surface2);
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: visible;
  overflow-y: visible;
  padding: 0.15rem 0 0.25rem;
}
.tabs button {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 0.45rem 0.85rem;
  min-height: auto;
  white-space: nowrap;
}
.tabs button.active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}

#main-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
#main-screen > header { flex-shrink: 0; }
#view-root {
  flex: 1;
  min-width: 0;
  padding: 1.25rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  overflow-x: clip;
}
#view-root.view-wide {
  max-width: 100%;
  padding: 1rem clamp(0.65rem, 2vw, 1.25rem);
  box-sizing: border-box;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: end;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
}
.stat .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.stat .value { font-size: 1.4rem; font-weight: 700; margin-top: .25rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
th, td {
  text-align: left;
  padding: .5rem .6rem;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; font-size: .8rem; }

.leave-pill {
  display: inline-block;
  min-width: 2rem;
  text-align: center;
  padding: .15rem .4rem;
  border-radius: 0;
  font-weight: 700;
  font-size: .75rem;
  white-space: nowrap;
  line-height: 1.2;
}
.leave-H { background: #27ae60; color: #fff; }
.leave-H1, .leave-H2, .leave-Q { background: #7dcea0; color: #1e4628; }
.leave-S { background: #c0392b; color: #fff; }
.leave-S1, .leave-S2 { background: #f1948a; color: #5b1a14; }
.leave-L { background: #f4d03f; color: #4a3d08; }
.leave-M { background: #e67e22; color: #fff; }
.leave-C { background: #95a5a6; color: #1a1f20; }
.leave-B { background: #f8b4d9; color: #6b2045; }
.leave-W { background: #85c1e9; color: #154360; }
.leave-U { background: #1a237e; color: #fff; }
.leave-U1, .leave-U2 { background: #7986cb; color: #1a237e; }
.leave-NS { background: #5d6d7e; color: #fff; }
.leave-H1, .leave-H2, .leave-S1, .leave-S2, .leave-U1, .leave-U2 {
  font-size: 0.58rem;
  padding: 0.12rem 0.25rem;
}
.leave-M { font-size: 0.58rem; padding: 0.12rem 0.25rem; }

.calendar-year th.cal-month-head {
  font-size: 0.65rem;
  padding: 0.2rem 0.1rem;
  border-right: 2px solid rgba(139, 156, 179, 0.65);
}
.calendar-year th.cal-year-day,
.calendar-year td.cal-year-day-cell {
  min-width: 14px;
  max-width: 18px;
  height: 22px;
  font-size: 0.55rem;
  padding: 0;
  line-height: 1.1;
}
.calendar-year .leave-pill {
  font-size: 0.45rem;
  min-width: 0;
  padding: 0 1px;
  border-radius: 0;
}
.calendar-year .leave-pill-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.75rem;
  max-width: 100%;
  padding: 0;
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
}
.calendar-year .cal-weekend-mark {
  font-size: 0.5rem;
  font-weight: 600;
  display: block;
  text-align: center;
  overflow: hidden;
}
.calendar-year th.emp-name,
.calendar-year td.emp-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
}
.calendar-year thead tr:nth-child(2) th { top: 1.35rem; }

.cal-day-adjust-wrap { margin-top: 0.75rem; }
.cal-day-adjust {
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.35rem;
}
.cal-day-adjust th,
.cal-day-adjust td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
}
.cal-day-adjust select { max-width: 10rem; }

td.cal-slot.cal-request-slot-am,
th.cal-year-day.cal-request-slot-am {
  box-shadow: inset 0 0 0 2px #3498db;
}
td.cal-slot.cal-request-slot-pm,
th.cal-year-day.cal-request-slot-pm {
  box-shadow: inset 0 0 0 2px #9b59b6;
}

.calendar-wrap { overflow-x: auto; }
.calendar {
  border-collapse: collapse;
  border-spacing: 0;
  min-width: 100%;
  border: 1px solid rgba(139, 156, 179, 0.45);
}
.calendar th,
.calendar td {
  border: 1px solid rgba(47, 64, 88, 0.95);
  box-sizing: border-box;
}
.calendar th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.calendar-am-pm thead tr:nth-child(2) th { top: 1.65rem; }
.calendar-am-pm th.emp-name { z-index: 5; top: 0; }
.calendar td {
  min-width: 28px;
  height: 28px;
  text-align: center;
  font-size: .7rem;
  padding: 0;
  vertical-align: middle;
}
.calendar-am-pm .cal-day-head {
  font-size: 0.72rem;
  white-space: nowrap;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid rgba(139, 156, 179, 0.35);
  border-right: 2px solid rgba(139, 156, 179, 0.65);
  vertical-align: middle;
}
.calendar-am-pm .cal-slot-head {
  font-size: 0.65rem;
  min-width: 28px;
  padding: 0.35rem 0.2rem;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}
.calendar-am-pm .cal-slot-head.am {
  border-right: 1px solid rgba(100, 120, 150, 0.55);
}
.calendar-am-pm .cal-slot-head.pm {
  border-right: 2px solid rgba(139, 156, 179, 0.65);
}
.calendar-am-pm td.cal-slot {
  min-width: 46px;
  height: 32px;
  padding: 0;
}
.calendar td.cal-slot.cal-booked {
  position: relative;
}
.calendar td.cal-slot.cal-booked-hol {
  background: linear-gradient(165deg, #2ecc71 0%, #27ae60 100%);
  box-shadow: inset 0 0 0 2px #abebc6;
}
.calendar td.cal-slot.cal-booked-hol-half {
  background: linear-gradient(165deg, #a9dfbf 0%, #7dcea0 100%);
  box-shadow: inset 0 0 0 2px #d5f5e3;
}
.calendar td.cal-slot.cal-booked-sick {
  background: linear-gradient(165deg, #e74c3c 0%, #c0392b 100%);
  box-shadow: inset 0 0 0 2px #f5b7b1;
}
.calendar td.cal-slot.cal-booked-sick-half {
  background: linear-gradient(165deg, #f5b7b1 0%, #f1948a 100%);
  box-shadow: inset 0 0 0 2px #fadbd8;
}
.calendar td.cal-slot.cal-booked-lieu {
  background: linear-gradient(165deg, #f7dc6f 0%, #f4d03f 100%);
  box-shadow: inset 0 0 0 2px #fcf3cf;
}
.calendar td.cal-slot.cal-booked-matpat {
  background: linear-gradient(165deg, #f39c12 0%, #e67e22 100%);
  box-shadow: inset 0 0 0 2px #fdebd0;
}
.calendar td.cal-slot.cal-booked-comp {
  background: linear-gradient(165deg, #bdc3c7 0%, #95a5a6 100%);
  box-shadow: inset 0 0 0 2px #ecf0f1;
}
.calendar td.cal-slot.cal-booked-bank {
  background: linear-gradient(165deg, #fde2f0 0%, #f8b4d9 100%);
  box-shadow: inset 0 0 0 2px #fce4ec;
}
.calendar td.cal-slot.cal-booked-wfh {
  background: linear-gradient(165deg, #aed6f1 0%, #85c1e9 100%);
  box-shadow: inset 0 0 0 2px #d6eaf8;
}
.calendar td.cal-slot.cal-booked-unpaid {
  background: linear-gradient(165deg, #283593 0%, #1a237e 100%);
  box-shadow: inset 0 0 0 2px #7986cb;
}
.calendar td.cal-slot.cal-booked-unpaid-half {
  background: linear-gradient(165deg, #9fa8da 0%, #7986cb 100%);
  box-shadow: inset 0 0 0 2px #c5cae9;
}
.calendar td.cal-slot.cal-booked-ns {
  background: linear-gradient(165deg, #7f8c8d 0%, #5d6d7e 100%);
  box-shadow: inset 0 0 0 2px #aeb6bf;
}
.calendar td.cal-slot.cal-pending-slot {
  outline: 2px dashed #ffb347;
  outline-offset: -2px;
}
.calendar td.cal-slot.cal-booked .cal-slot-fill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  min-height: 30px;
  padding: 2px 1px;
  box-sizing: border-box;
}
.calendar td.cal-slot.cal-booked .leave-pill {
  width: auto;
  min-width: 0;
  max-width: none;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 0.1rem 0.3rem;
}
.calendar-am-pm td.cal-slot.am {
  border-right: 1px solid rgba(100, 120, 150, 0.55);
}
.calendar-am-pm td.cal-slot.pm {
  border-right: 2px solid rgba(139, 156, 179, 0.65);
}
.calendar-am-pm td.cal-slot-full {
  min-width: 54px;
  border-right: 2px solid rgba(139, 156, 179, 0.65);
}
.calendar td.cal-slot-full.cal-booked .cal-slot-fill {
  min-height: 30px;
}
.calendar td.cal-slot-full.cal-booked .leave-pill {
  max-width: none;
  font-size: 0.68rem;
}
.cal-nav-toolbar {
  gap: 0.75rem 1.15rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.cal-nav-toolbar label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.cal-nav-toolbar label input {
  margin-top: 0.35rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.55rem;
}
.cal-nav-toolbar label select {
  margin-top: 0.35rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.55rem;
}
.cal-nav-toolbar #cal-prev,
.cal-nav-toolbar #cal-today,
.cal-nav-toolbar #cal-next {
  min-height: 2.35rem;
  padding: 0.4rem 0.7rem;
  align-self: flex-end;
}
.cal-nav-toolbar .cal-view-label {
  margin-left: auto;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  padding-left: 0.5rem;
}
.cal-nav-toolbar .cal-show-leavers {
  align-self: center;
  margin-bottom: 0.35rem;
  margin-left: 0.5rem;
  white-space: nowrap;
}
.cal-nav-toolbar .cal-show-leavers input {
  margin-top: 0;
  min-height: auto;
}
.cal-month-jump-label input { min-width: 9rem; }
.calendar th.emp-name,
.calendar td.emp-name {
  text-align: left;
  min-width: 168px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
  border-right: 2px solid rgba(139, 156, 179, 0.55);
}
.calendar th.weekend,
.calendar td.weekend {
  background: #1a2740;
  box-shadow: inset 0 0 0 1px #4a7fd4;
  color: #d4e4ff;
}
.calendar td.weekend .cal-weekend-mark {
  font-size: .65rem;
  font-weight: 700;
  color: #8eb8ff;
  letter-spacing: -.02em;
}
.calendar th.bank,
.calendar td.bank {
  background: linear-gradient(165deg, #fde2f0 0%, #f8b4d9 100%);
  box-shadow: inset 0 0 0 2px #f48fb1;
  color: #6b2045;
}
.calendar td.bank .leave-pill.leave-B {
  background: #f8b4d9;
  color: #6b2045;
}
.calendar td.weekend.bank {
  box-shadow: inset 0 0 0 2px #f48fb1;
}
.cal-pending-wrap {
  display: inline-block;
  outline: 2px dashed #ffb347;
  outline-offset: 1px;
  border-radius: 0;
  opacity: 0.95;
}
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.35rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0 0.85rem;
  font-size: 0.85rem;
  line-height: 1.45;
  border-bottom: 1px solid var(--border);
}
.cal-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.cal-legend .cal-legend-meta {
  flex-basis: 100%;
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  gap: 0;
}
.cal-legend .cal-legend-meta + .cal-legend-meta {
  margin-top: 0;
  padding-top: 0.35rem;
  border-top: none;
}
.cal-legend .swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 0;
  vertical-align: middle;
  flex-shrink: 0;
}
.swatch-weekend { background: #1a2740; box-shadow: inset 0 0 0 2px #4a7fd4; }
.swatch-bank { background: #f8b4d9; box-shadow: inset 0 0 0 2px #f48fb1; }
.swatch-hol { background: #27ae60; box-shadow: inset 0 0 0 2px #abebc6; }
.swatch-sick { background: #c0392b; box-shadow: inset 0 0 0 2px #f5b7b1; }
.swatch-lieu { background: #f4d03f; box-shadow: inset 0 0 0 2px #fcf3cf; }
.swatch-wfh { background: #85c1e9; box-shadow: inset 0 0 0 2px #d6eaf8; }
.swatch-unpaid { background: #1a237e; box-shadow: inset 0 0 0 2px #7986cb; }
.swatch-pending { background: transparent; outline: 2px dashed #ffb347; }
.swatch-ns { background: #5d6d7e; box-shadow: inset 0 0 0 2px #aeb6bf; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: end;
  margin-bottom: 1rem;
}
.toolbar label { margin: 0; font-size: .8rem; }
.toolbar input,
.toolbar select {
  width: auto;
  min-width: 140px;
  max-width: 100%;
}
.toolbar button { min-height: 2.35rem; }

.cal-page > .stats {
  margin-bottom: 1.25rem;
}
.cal-page > .panel {
  margin-bottom: 1.25rem;
}
.cal-manual-book-panel h3,
.cal-request-panel h3 {
  margin: 0 0 0.65rem;
}
.cal-manual-book-panel .muted,
.cal-request-panel .muted {
  margin: 0 0 1rem;
  line-height: 1.55;
}
.cal-manual-book-panel .toolbar,
.cal-request-panel .toolbar {
  gap: 0.75rem 1rem;
  margin-bottom: 0.65rem;
}
.cal-request-balance {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.cal-request-balance-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}
.cal-request-balance .allowance-primary {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.cal-request-balance .allowance-label {
  font-size: 0.9rem;
  color: var(--text);
}
.cal-request-balance-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.cal-request-balance-meta {
  color: var(--warn, #e6a817);
}
.cal-request-panel .report-date-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}
.cal-request-panel .report-date-label input[type="date"] {
  min-width: 10.75rem;
  width: 100%;
  max-width: 16rem;
  color-scheme: dark;
  cursor: pointer;
}
.cal-request-panel .report-date-label input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.85;
  filter: invert(0.85);
}
.calendar-wrap.panel {
  padding: 0.75rem 0.85rem 0.9rem;
  margin-bottom: 0;
}

.actions { display: flex; gap: .35rem; flex-wrap: wrap; }

.sub-tabs {
  margin-bottom: 1rem;
  flex-wrap: wrap;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
  gap: 0.35rem;
  padding: 0.35rem;
  background: rgba(36, 48, 68, 0.55);
  border: 1px solid var(--border);
}
.sub-tabs button {
  font-weight: 600;
}
.people-admin-banner {
  margin-bottom: 1rem;
  border-color: rgba(61, 139, 253, 0.35);
}
.users-password-cell {
  min-width: 11rem;
}
.users-password-cell input[type='password'] {
  width: 100%;
  min-width: 8rem;
  margin-bottom: 0.35rem;
}
.users-table-wrap {
  border: 1px solid var(--border);
  background: rgba(36, 48, 68, 0.45);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}
.users-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
@media (max-width: 1100px) {
  .users-table {
    min-width: 48rem;
    table-layout: auto;
    width: max-content;
  }
}
.users-table select {
  display: block;
  width: auto;
  max-width: 100%;
}
.users-table select[name='role'] {
  min-width: 6.75rem;
  width: 7.25rem;
  max-width: 8rem;
}
.users-emp-cell {
  min-width: 11rem;
  max-width: 16rem;
}
.users-emp-label {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  line-height: 1.35;
  word-break: break-word;
}
.users-emp-pick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
.users-emp-pick-row .users-emp-label {
  flex: 1 1 8rem;
  margin: 0;
}
.users-emp-picker {
  width: min(100%, 24rem);
  max-height: min(85vh, 32rem);
  display: flex;
  flex-direction: column;
  margin: 0;
}
.users-emp-picker-search-label {
  display: block;
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.users-emp-picker-search-label input {
  width: 100%;
  margin-top: 0.35rem;
}
.users-emp-picker-list {
  flex: 1 1 auto;
  min-height: 8rem;
  max-height: 14rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
}
.users-emp-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  margin: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  min-height: auto;
  font-weight: 400;
  cursor: pointer;
}
.users-emp-picker-item:last-child {
  border-bottom: none;
}
.users-emp-picker-item:hover {
  background: rgba(61, 139, 253, 0.15);
}
.users-emp-picker-item[hidden] {
  display: none !important;
}
.users-table td {
  vertical-align: middle;
}
.users-table td:has(select) {
  min-width: 0;
}
.users-add-form {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.users-add-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}
.users-add-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  align-items: end;
}
.users-add-form label {
  margin: 0;
  font-size: 0.85rem;
}
.users-add-form input,
.users-add-form select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
}
.users-add-employee {
  grid-column: span 2;
}
.users-add-actions {
  display: flex;
  align-items: flex-end;
}
.users-add-actions button {
  width: 100%;
  min-height: var(--control-height);
}
@media (max-width: 960px) {
  .users-add-grid {
    grid-template-columns: 1fr 1fr;
  }
  .users-add-employee {
    grid-column: span 2;
  }
}
@media (max-width: 560px) {
  .users-add-grid {
    grid-template-columns: 1fr;
  }
  .users-add-employee {
    grid-column: span 1;
  }
}
.users-name-cell {
  min-width: 10rem;
}
.table-scroll { overflow-x: auto; max-width: 100%; }
.people-panel-intro {
  margin-bottom: 0.75rem;
}
.people-year-bar {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
}
.people-year-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}
.people-year-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}
.people-year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.people-year-pill {
  position: relative;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 3.25rem;
}
.people-year-pill:hover {
  border-color: var(--accent);
}
.people-year-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.people-year-leaver-count {
  display: inline-block;
  margin-left: 0.35rem;
  min-width: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.12);
  vertical-align: middle;
}
.people-year-pill.active .people-year-leaver-count {
  background: rgba(255, 255, 255, 0.25);
}
.people-year-hint {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
}
.people-leaver-all-years {
  display: block;
  margin-top: 0.65rem;
}
.people-leaver-year-section {
  margin-bottom: 1.5rem;
}
.people-leaver-year-heading {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}
.emp-name .cal-emp-dept {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: normal;
  line-height: 1.2;
}
.cal-emp-book-btn .cal-emp-dept {
  display: block;
  margin-top: 0.15rem;
}

.tech-jobs-toolbar {
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}
.tech-jobs-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tech-jobs-grid {
  min-width: 720px;
}
.tech-day-head {
  font-size: 0.75rem;
  text-align: center;
  white-space: nowrap;
}
.tech-job-edit {
  min-width: 4.5rem;
  vertical-align: top;
}
.tech-job-mini {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.7rem;
  margin-bottom: 0.25rem;
}
.tech-job-mini input {
  width: 3rem;
  padding: 0.15rem 0.25rem;
  font-size: 0.8rem;
}
.tech-emp-name {
  min-width: 9rem;
}
.tech-delta-pos { color: var(--accent); }
.tech-delta-neg { color: var(--danger); }
.tech-jobs-period {
  margin-top: 1rem;
}
.tech-jobs-period h4 {
  margin-top: 0;
}
.tech-jobs-day-layout {
  display: grid;
  grid-template-columns: minmax(300px, 22rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1rem;
}
.tech-jobs-cal-slot {
  min-width: 0;
}
.tech-jobs-main-slot {
  min-width: 0;
}
@media (max-width: 960px) {
  .tech-jobs-day-layout {
    grid-template-columns: 1fr;
  }
  .tech-jobs-cal-slot {
    max-width: 22rem;
  }
}
.tech-jobs-cal {
  padding: 0.85rem 1rem;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}
.tech-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.tech-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 0.35rem;
}
.tech-cal-weekdays span {
  display: block;
  padding: 0.15rem 0;
}
.tech-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}
.tech-cal-pad {
  min-height: 2.25rem;
}
.tech-cal-day {
  min-height: 2.25rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.8rem;
  line-height: 1.1;
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tech-cal-day:hover {
  border-color: var(--accent);
}
.tech-cal-day.today {
  font-weight: 700;
}
.tech-cal-day.has-data {
  box-shadow: inset 0 -3px 0 var(--accent);
}
.tech-cal-day.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tech-cal-day.weekend {
  background: var(--bg);
  border-color: transparent;
  color: var(--muted);
  opacity: 0.45;
  cursor: default;
}
.tech-cal-legend-dot.weekend {
  opacity: 0.45;
  background: var(--bg);
  border: 1px solid var(--border);
}
.tech-day-off-note {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.tech-emp-bulk-open {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.tech-emp-bulk-open:hover strong {
  text-decoration: underline;
}
.tech-emp-bulk-hint {
  font-size: 0.78rem;
}
.tech-job-off {
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}
.tech-day-head-weekend {
  opacity: 0.5;
}
.tech-jobs-bulk-modal {
  max-width: 36rem;
  width: calc(100% - 2rem);
  max-height: min(90vh, 42rem);
  display: flex;
  flex-direction: column;
}
.tech-bulk-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  margin: 0.75rem 0;
}
.tech-bulk-table {
  width: 100%;
  border-collapse: collapse;
}
.tech-bulk-table th,
.tech-bulk-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tech-bulk-table input {
  width: 5rem;
  max-width: 100%;
}
.tech-cal-legend {
  font-size: 0.78rem;
  margin: 0.65rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.tech-cal-legend-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  background: var(--border);
  vertical-align: middle;
}
.tech-cal-legend-dot.has-data {
  box-shadow: inset 0 -2px 0 var(--accent);
}
.tech-cal-legend-dot.selected {
  background: var(--accent);
}
.tech-day-editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.tech-day-table input {
  width: 5rem;
  max-width: 100%;
  font-size: 1rem;
  padding: 0.35rem 0.5rem;
}
.tech-day-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.tech-jobs-day-editor {
  min-width: 0;
}
.tech-day-table-wrap {
  margin-top: 0.5rem;
}
.tech-day-table {
  width: 100%;
  min-width: 36rem;
}
.tech-day-table th {
  white-space: nowrap;
  font-size: 0.85rem;
}
.tech-month-stat {
  white-space: nowrap;
  text-align: right;
}
.tech-bonus-cell {
  color: var(--accent);
  font-size: 1.05rem;
}
.tech-day-table th .muted {
  font-weight: normal;
  font-size: 0.75rem;
}
.people-panel { overflow: hidden; min-width: 0; }
.people-panel-intro {
  padding: 0 0.25rem;
}
.people-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  border: 1px solid var(--border);
  border-radius: 0;
  background: rgba(36, 48, 68, 0.45);
  margin: 0.5rem 0 1rem;
  position: relative;
}
.people-table-wrap:focus {
  outline: 2px solid rgba(61, 139, 253, 0.45);
  outline-offset: 2px;
}
.people-table-scroll-hint {
  display: none;
  font-size: 0.8rem;
  margin: 0 0 0.35rem;
  padding: 0.35rem 0.65rem;
  background: rgba(61, 139, 253, 0.12);
  border: 1px solid rgba(61, 139, 253, 0.35);
  border-radius: 0;
}
.people-table-scroll-hint.is-visible {
  display: block;
}
.people-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.82rem;
}
.people-table th,
.people-table td {
  padding: 0.35rem 0.4rem;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}
.people-table select[name="department_id"],
.people-table select[name="manager_employee_id"] {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  font-size: 0.78rem;
  padding: 0.25rem 0.35rem;
}
table select,
.approval-table select,
.cal-day-adjust select,
.day-decision-select {
  width: auto;
  max-width: 100%;
}
.table-scroll select,
.table-scroll input[type="text"],
.table-scroll input[type="number"],
.table-scroll input:not([type="checkbox"]) {
  min-width: 0;
  width: auto;
  max-width: 100%;
}
.people-table input[type="date"],
.people-table input.date-uk-input {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  font-size: 0.78rem;
  padding: 0.25rem 0.3rem;
}
.pay-due-breakdown {
  font-size: 0.75rem;
  max-width: 22rem;
  text-align: left;
}
.pay-due-breakdown summary {
  cursor: pointer;
  list-style: none;
}
.pay-due-breakdown summary::-webkit-details-marker {
  display: none;
}
.pay-due-hint {
  font-size: 0.7rem;
}
.pay-due-steps {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}
.pay-due-steps li {
  margin-bottom: 0.35rem;
  line-height: 1.35;
}
.pay-due-sublist {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  font-size: 0.72rem;
}
.pay-due-sublist li {
  margin: 0.1rem 0;
}
.people-table td:has(.pay-due-breakdown) {
  min-width: 9rem;
  vertical-align: top;
}

.backup-restore-panel .backup-restore-scroll {
  max-height: 22rem;
  overflow: auto;
}
table.backup-restore-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.backup-restore-table th,
table.backup-restore-table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.55rem;
  vertical-align: top;
  text-align: left;
}
table.backup-restore-table th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.backup-when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 9.5rem;
}
.backup-change-details summary {
  cursor: pointer;
  list-style: none;
}
.backup-change-details summary::-webkit-details-marker {
  display: none;
}
.backup-change-details summary::before {
  content: '▸ ';
  color: var(--muted);
}
.backup-change-details[open] summary::before {
  content: '▾ ';
}
.backup-action-code {
  font-size: 0.72rem;
  margin-left: 0.35rem;
  opacity: 0.85;
}
.backup-change-detail {
  margin-top: 0.4rem;
  padding: 0.35rem 0 0 0.5rem;
  border-left: 2px solid var(--border);
  font-size: 0.8rem;
}
.backup-restore-col {
  white-space: nowrap;
  width: 1%;
}
.work-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.25rem;
  font-size: 0.68rem;
}
.work-weekdays .work-wd {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  cursor: pointer;
  white-space: nowrap;
}
.work-weekdays input { margin: 0; }
.work-weekdays-cell { min-width: 0; }
.people-table .people-emp-name {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
  width: 9.5%;
  min-width: 7.5rem;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.12);
}
.people-table th.people-emp-name { z-index: 4; }
.people-table .people-actions-col {
  position: sticky;
  right: 0;
  z-index: 3;
  background: var(--surface);
  width: 8.5%;
  min-width: 7.25rem;
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.12);
}
.people-table th.people-actions-col { z-index: 4; }
.people-row-save { display: none; }
.people-actions-col .small {
  font-size: 0.72rem;
  padding: 0.3rem 0.45rem;
}
table td .muted { font-size: .8rem; }

.status-badge {
  display: inline-block;
  margin-top: .25rem;
  padding: .1rem .45rem;
  border-radius: 0;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.status-active { background: rgba(46, 204, 113, .15); color: #7dcea0; }
.status-pending { background: rgba(255, 179, 71, .18); color: #ffc978; }
.status-left { background: rgba(255, 107, 107, .12); color: #ffb4b4; }
.pay-due { color: #7dcea0; }
tr.batch-header td {
  background: rgba(61, 139, 253, 0.12);
  font-size: 0.92rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}
tr.batch-day td:first-child { padding-left: 1.25rem; }
tr.batch-footer td { padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.approval-coverage-list {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.45;
}
.approval-coverage-list li {
  margin: 0.2rem 0;
}
.approval-coverage-dept {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: normal;
}
.approval-coverage-cell {
  min-width: 11rem;
  max-width: 22rem;
  vertical-align: top;
  font-size: 0.85rem;
}
.approval-coverage-block {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.approval-coverage-block .approval-coverage-list {
  display: inline-block;
  vertical-align: top;
  margin-left: 0.35rem;
}
.approval-table .batch-header td {
  vertical-align: top;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(1rem + env(safe-area-inset-top));
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  background: rgba(8, 12, 18, 0.72);
}
.modal-overlay[hidden] {
  display: none !important;
}
body.modal-open {
  overflow: hidden;
}
.leave-request-modal {
  width: min(100%, 28rem);
  max-height: min(92vh, 640px);
  overflow-y: auto;
  margin: 0;
}
.leave-request-review-summary {
  display: grid;
  gap: 0.65rem;
  margin: 0 0 1rem;
}
.leave-request-review-summary > div {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.5rem 0.75rem;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.leave-request-review-summary dt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.leave-request-review-summary dd {
  margin: 0;
  font-size: 0.95rem;
}
.error-inline {
  color: var(--danger);
  font-size: 0.85rem;
}
.signature-block {
  margin-bottom: 1rem;
}
.signature-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.signature-pad {
  display: block;
  width: 100%;
  height: 9rem;
  touch-action: none;
  cursor: crosshair;
  background: var(--surface2);
  border: 2px solid var(--border);
}
.signature-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-actions button[type="button"]:last-child {
  min-width: 8rem;
}
.approval-employee-signature {
  margin-top: 0.65rem;
}
.approval-employee-signature img {
  display: block;
  margin-top: 0.35rem;
  max-width: 100%;
  height: auto;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.garage-hive-modal {
  width: min(100%, 24rem);
}
.garage-hive-question {
  font-size: 1.05rem;
  margin: 0 0 1rem;
}
.garage-hive-hint {
  margin: 0.75rem 0 1rem;
  font-size: 0.85rem;
}
.gh-toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}
.gh-toggle-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 2.25rem;
  text-align: center;
}
.gh-toggle-label.is-active {
  color: var(--accent);
}
.gh-toggle {
  position: relative;
  display: inline-block;
  width: 3.25rem;
  height: 1.85rem;
  flex-shrink: 0;
}
.gh-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.gh-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border: 2px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.gh-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 4px);
  height: calc(100% - 4px);
  background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
}
.gh-toggle input:checked + .gh-toggle-track {
  background: rgba(61, 139, 253, 0.2);
  border-color: rgba(61, 139, 253, 0.65);
}
.gh-toggle input:checked + .gh-toggle-track::after {
  transform: translateX(100%);
  background: var(--accent);
}
.approval-day-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.day-decision-select { min-width: 6.5rem; max-width: 8rem; }
.day-decision-note { min-width: 8rem; max-width: 12rem; font-size: 0.85rem; }
tr.row-locked { opacity: .82; }
tr.row-locked select:disabled { opacity: .65; cursor: not-allowed; }
.emp-left { text-decoration: line-through; color: var(--muted); }

.cal-pickable { cursor: pointer; }
.cal-pickable:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-emp-book-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.15rem 0.35rem;
  margin: -0.15rem -0.35rem;
  background: transparent;
  color: inherit;
  font: inherit;
  border: 1px dashed transparent;
  border-radius: 0;
}
.cal-emp-book-btn:hover {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.08);
}
.cal-emp-book-btn.active {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.2);
  font-weight: 600;
}
tr.cal-book-target-row .emp-name {
  box-shadow: inset 3px 0 0 var(--accent);
}
.cal-multi-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.1;
}
.cal-multi-pill .leave-pill {
  font-size: 0.58rem;
  padding: 0.1rem 0.25rem;
  min-width: 0;
  white-space: nowrap;
}
.cal-del-booking {
  display: inline-block;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0;
  line-height: 0;
}
.cal-del-booking:hover .leave-pill {
  outline: 2px solid var(--danger);
  outline-offset: 1px;
  filter: brightness(1.15);
}
.cal-del-booking:focus-visible .leave-pill {
  outline: 2px solid var(--danger);
  outline-offset: 1px;
}
.cal-manual-book-panel { border-color: rgba(61, 139, 253, 0.45); }
.cal-range-start,
.cal-range-end { background: rgba(61, 139, 253, 0.55) !important; box-shadow: inset 0 0 0 2px #6eb3ff; }
.cal-range-mid { background: rgba(61, 139, 253, 0.28) !important; }
tr.cal-self-row .emp-name { font-weight: 600; }
.cal-request-panel { margin-bottom: 1rem; }
.checkbox-inline { display: flex; align-items: center; gap: .4rem; }
.checkbox-inline input { width: auto; margin: 0; }

.audit-page .audit-panel {
  max-width: 52rem;
}
.audit-filter-toolbar {
  align-items: flex-end;
  margin-bottom: 0.75rem;
}
.audit-filter-toolbar label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.audit-filter-toolbar input,
.audit-filter-toolbar select {
  margin-top: 0.35rem;
  border-radius: 0;
  min-width: 10rem;
}
.audit-result-count {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 72vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.audit-entry {
  border: 1px solid var(--border);
  background: var(--surface2);
  padding: 0.85rem 1rem;
}
.audit-entry-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}
.audit-entry-titles {
  flex: 1;
  min-width: 0;
}
.audit-entry-title {
  display: block;
  font-size: 1rem;
  line-height: 1.3;
}
.audit-entry-when {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.audit-badge {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  border-radius: 0;
}
.audit-badge-leave { background: rgba(61, 139, 253, 0.25); color: #9ec5ff; }
.audit-badge-people { background: rgba(46, 204, 113, 0.2); color: #7dcea0; }
.audit-badge-system { background: rgba(149, 165, 166, 0.25); color: #d5dbdb; }
.audit-entry-summary {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}
.audit-entry-meta {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}
.audit-action-code {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
}
.audit-entry-details {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}
.audit-entry-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  user-select: none;
}
.audit-details-grid {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.audit-detail-section h5 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.audit-dl-row {
  display: grid;
  grid-template-columns: minmax(7rem, 9rem) 1fr;
  gap: 0.35rem 0.75rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(47, 64, 88, 0.45);
  font-size: 0.82rem;
  line-height: 1.4;
}
.audit-dl-row dt {
  margin: 0;
  color: var(--muted);
}
.audit-dl-row dd {
  margin: 0;
  word-break: break-word;
}
.audit-decision-list {
  margin: 0;
  padding-left: 1.1rem;
}
.audit-raw {
  margin: 0.5rem 0 0;
  font-size: .75rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
  padding: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* —— Mobile employee booking —— */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0.35rem 0.5rem;
  padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
  background: rgba(26, 35, 50, 0.96);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  gap: 0.25rem;
  justify-content: space-around;
  align-items: stretch;
}
.bottom-nav button {
  flex: 1;
  min-height: 48px;
  padding: 0.35rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 0;
  line-height: 1.2;
}
.bottom-nav button.active {
  background: var(--surface2);
  color: var(--accent);
}

#app.layout-employee-app #view-root {
  padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
  #app.layout-employee-app .topbar .tabs {
    display: none;
  }
  #app.layout-employee-app .topbar #logout-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.65rem;
    min-height: 36px;
  }
  #app.layout-employee-app .topbar #user-badge {
    display: none;
  }
  #app.layout-employee-app .bottom-nav {
    display: flex;
  }
  #app.layout-employee-app #view-root {
    padding: 0.75rem;
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
  }

  .layout-employee .cal-request-panel {
    position: sticky;
    top: calc(3.25rem + env(safe-area-inset-top));
    z-index: 5;
    margin-bottom: 0.75rem;
    border: 2px solid rgba(61, 139, 253, 0.45);
  }
  .layout-employee .cal-request-panel h3 {
    font-size: 1.05rem;
  }
  .layout-employee .cal-request-panel .muted {
    font-size: 0.85rem;
    line-height: 1.45;
  }
  .layout-employee .cal-request-panel .toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .layout-employee .cal-request-panel .toolbar label {
    margin: 0;
  }
  .layout-employee .cal-request-panel .report-date-label input[type="date"] {
    min-height: 2.75rem;
    max-width: none;
    font-size: 1rem;
  }
  .layout-employee .cal-request-balance {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .layout-employee .cal-request-balance .allowance-primary {
    font-size: 1.75rem;
  }
  .leave-request-modal {
    width: 100%;
    max-height: none;
    min-height: min(100%, 100dvh);
    border-radius: 0;
  }
  .leave-request-review-summary > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .signature-pad {
    height: 10.5rem;
  }
  .modal-actions {
    flex-direction: column-reverse;
  }
  .modal-actions button {
    width: 100%;
  }
  .layout-employee .cal-request-panel button[type="submit"] {
    width: 100%;
    font-size: 1rem;
  }
  .layout-employee .cal-nav-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .layout-employee .cal-nav-toolbar .cal-month-jump-label,
  .layout-employee .cal-nav-toolbar .cal-year-jump-label,
  .layout-employee .cal-nav-toolbar .cal-view-label {
    display: none;
  }
  .layout-employee .cal-legend {
    display: none;
  }
  .layout-employee .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .layout-employee .stat .value {
    font-size: 1.25rem;
  }
  .layout-employee .calendar-am-pm td.cal-slot {
    min-width: 40px;
  }
  .layout-employee .calendar-am-pm .cal-day-head {
    font-size: 0.65rem;
  }
}

@media (min-width: 769px) {
  #bottom-nav {
    display: none !important;
  }
}

.cal-page.layout-employee .cal-request-panel {
  order: -2;
}
.cal-page {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

/* —— Viewport-fit layout (no page-level horizontal scroll) —— */
#app.app-app {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

#allowance-defaults-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.65rem 0.85rem;
  align-items: end;
}
#allowance-defaults-form > strong,
#allowance-defaults-form > span.muted {
  grid-column: 1 / -1;
}
#allowance-defaults-form .checkbox-inline {
  grid-column: 1 / -1;
}
#allowance-defaults-form label {
  margin: 0;
}
#allowance-defaults-form button[type='submit'] {
  grid-column: 1 / -1;
  justify-self: start;
}

@media (max-width: 1280px) {
  .topbar {
    align-items: stretch;
  }
  .topbar > div:first-child {
    flex: 1 1 100%;
    border-right: none;
    padding-right: 0;
  }
  .topbar-actions {
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 1100px) {
  .people-table {
    table-layout: auto;
    min-width: 880px;
    width: max-content;
  }
}

.table-scroll,
.calendar-wrap,
.tech-day-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.tech-deduct-btn {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.tech-deduction-amount {
  color: var(--danger, #c0392b);
  font-weight: 600;
}

.tech-deduction-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tech-deduction-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
}

.tech-deduction-list-item span {
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
}

.tech-jobs-deduction-modal #tech-jobs-deduction-list-wrap h3 {
  color: var(--text);
}

.tech-jobs-deduction-modal form label textarea {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}
