:root {
  --bg: #f4f7fb;
  --panel: #fff;
  --text: #172033;
  --muted: #667085;
  --border: #d6e0ed;
  --accent: #2864eb;
  --accent-soft: #eaf2ff;
  --danger: #dc2626;
  --shadow: 0 10px 25px rgba(15, 23, 42, .08);
  --radius: 18px
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Aptos, "Segoe UI Variable", "Segoe UI", ui-sans-serif, sans-serif
}

button,
input,
select,
textarea {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  padding: 10px 12px
}

button {
  cursor: pointer;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 800
}

.secondary {
  background: white;
  color: var(--text);
  border-color: var(--border)
}

.danger {
  background: white;
  color: var(--danger);
  border-color: var(--border)
}

.link-button {
  background: transparent;
  color: var(--accent);
  border: 0
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow)
}

h1,
h2,
h3 {
  margin: 0
}

.login {
  max-width: 390px;
  margin: 10vh auto;
  padding: 24px
}

.login p {
  color: var(--muted)
}

.login form {
  display: grid;
  gap: 10px
}

.login label,
dialog label {
  display: grid;
  gap: 5px
}

.login form[hidden] {
  display: none
}

.error {
  color: var(--danger)
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(15, 23, 42, .06)
}

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

.brand h1 {
  display: none
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 24px;
  font-weight: 900
}

.header-tabs {
  display: flex;
  height: 50px;
  gap: 8px
}

.header-tab {
  position: relative;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  padding: 0 18px
}

.header-tab.active {
  color: var(--accent)
}

.header-tab.active:after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 14px;
  right: 14px;
  height: 3px;
  border-radius: 9px;
  background: var(--accent)
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 9px
}

.header-controls #securityButton,
.header-controls #logout,
.header-controls #themeButton,
.header-controls #auditButton {
  font-weight: 400
}

.week-control {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden
}

.week-control>* {
  border: 0;
  border-radius: 0
}

.week-control input {
  font-weight: 700
}

.icon-button {
  background: white;
  color: var(--text);
  font-size: 18px
}

.header-filter {
  min-width: 190px;
  font-weight: 700
}

main {
  padding: 18px 24px 28px;
  display: grid;
  gap: 18px
}

.combined-summary {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  padding: 18px 24px;
  gap: 22px
}

.summary-divider {
  background: var(--border)
}

.summary-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 17px
}

.summary-heading span {
  color: var(--muted)
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(7, 1fr)
}

.summary-metric {
  padding: 0 14px;
  border-right: 1px solid var(--border)
}

.summary-metric:first-child {
  padding-left: 0
}

.summary-metric:last-child {
  border: 0
}

.summary-metric small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 7px
}

.summary-metric strong {
  font-size: 24px
}

.summary-metrics.weekly {
  grid-template-columns: repeat(3, 1fr)
}

.layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  min-height: 0
}

.management {
  padding: 18px;
  max-height: calc(100vh - 270px);
  overflow: auto;
  scroll-behavior: smooth
}

.management-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px
}

.management-header h2 {
  margin: 0
}

.roster-collapse-toggle {
  display: grid;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  font-size: 25px;
  line-height: 1
}

.roster-collapse-toggle span {
  transition: transform .18s ease
}

.management h2:not(:first-child) {
  margin-top: 26px
}

.management form {
  display: grid;
  gap: 9px;
  margin: 14px 0 16px
}

#userForm input[readonly] {
  background: #f1f5f9;
  color: var(--muted);
  cursor: not-allowed
}

#createUsersHeading[hidden],
#userForm[hidden],
#sitesHeading[hidden],
#siteForm[hidden],
#sites[hidden] {
  display: none
}

.management-help {
  color: var(--muted);
  line-height: 1.4
}

#deletedRecordsPanel {
  margin-top: 26px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel)
}

#deletedRecordsPanel summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  list-style: none
}

#deletedRecordsPanel summary::-webkit-details-marker {
  display: none
}

#deletedRecordsPanel summary:before {
  content: "+";
  margin-right: 8px;
  color: var(--accent)
}

#deletedRecordsPanel[open] summary:before {
  content: "-"
}

#deletedRecordsPanel summary span:first-of-type {
  flex: 1
}

.deleted-records-content {
  padding: 0 12px 12px
}

.deleted-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  text-align: center;
  font-size: 12px
}

.permanent-delete {
  padding: 5px 7px !important;
  font-size: 11px
}

.deleted-group-title {
  margin: 14px 0 8px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em
}

#deletedSites,
#deletedEmployees {
  display: grid;
  gap: 8px
}

.form-title {
  display: none;
  color: var(--accent);
  font-weight: 800
}

#employeeForm.editing {
  padding: 12px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft)
}

#employeeForm.editing .form-title {
  display: block
}

.roster-list {
  display: grid;
  gap: 10px
}

.management-list-panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel)
}

.management-list-panel summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  list-style: none
}

.management-list-panel summary::-webkit-details-marker {
  display: none
}

.management-list-panel summary:before {
  content: "+";
  color: var(--accent)
}

.management-list-panel[open] summary:before {
  content: "-"
}

.management-list-panel summary span:first-of-type {
  flex: 1
}

.management-list-panel .roster-list {
  padding: 0 12px 12px
}

.management-panel-content {
  padding: 0 12px 12px
}

.management-panel-content form {
  margin-top: 0
}

.employee-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  text-align: center
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfdff
}

.item-info {
  min-width: 0
}

.item-name {
  font-size: 16px
}

.item small {
  display: block;
  color: var(--muted);
  margin-top: 6px
}

.item-actions {
  display: flex;
  gap: 6px
}

.item button {
  padding: 7px 9px
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle
}

.site-badge {
  background: #e7f0ff;
  color: #2563eb
}

.tech-badge {
  background: #f2e8ff;
  color: #7e22ce
}

.schedule {
  padding: 18px;
  min-width: 0
}

.schedule-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 14px
}

.schedule-title p {
  margin: 5px 0 0;
  color: var(--muted)
}

.bulk-apply:disabled {
  cursor: not-allowed;
  opacity: .5
}

.bulk-apply:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
  color: white;
  box-shadow: 0 4px 12px rgba(21, 128, 61, .22)
}

.bulk-apply:not(:disabled):hover {
  background: #166534;
  border-color: #166534
}

.bulk-apply:not(:disabled):focus-visible {
  outline: 3px solid rgba(34, 197, 94, .3);
  outline-offset: 2px
}

.schedule-filters .bulk-status-control select {
  width: 100%;
  min-width: 190px;
  min-height: 40px;
  padding: 8px 34px 8px 11px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  border-color: var(--border)
}

.bulk-day-selector {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 7px;
  cursor: pointer
}

.bulk-day-selector input[type=checkbox] {
  width: 17px;
  height: 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent)
}

.bulk-day-selector span {
  line-height: 1.35
}

.bulk-day-selector input:checked+span {
  color: var(--accent)
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 330px);
  border: 1px solid var(--border);
  border-radius: 14px
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1120px
}

th,
td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  vertical-align: top
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
  text-align: left;
  color: var(--muted);
  font-weight: 800
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #f8fafc;
  width: 195px
}

th:first-child {
  z-index: 6
}

tbody tr:nth-child(odd) td {
  background: #f4f8ff
}

tbody tr:nth-child(odd) td:first-child {
  background: #eaf2ff
}

.employee-name {
  display: block;
  font-size: 17px;
  line-height: 1.3
}

.employee-meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4
}

.cell {
  display: grid;
  gap: 7px
}

.cell select,
.cell textarea {
  width: 100%;
  min-width: 115px;
  padding: 8px 10px
}

.cell textarea {
  min-height: 52px;
  resize: vertical;
  line-height: 1.3
}

.cell-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 14px
}

.employee-company {
  display: block;
  margin-top: 3px;
  color: #0d9488;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35
}

.employee-badges {
  display: block;
  margin-top: 3px
}

.last-updated {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere
}

.note-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
  white-space: nowrap
}

.note-count.over {
  color: var(--danger);
  font-weight: 800
}

.pill {
  display: inline-flex;
  width: max-content;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 900
}

.Working {
  background: #11a64a
}

.Travel {
  background: #7c3aed
}

.Vacation {
  background: #dc2626
}

.Sick {
  background: #e79b13
}

.Training {
  background: #0f766e
}

.OFF {
  background: #64748b
}

.Unassigned {
  background: #94a3b8
}

dialog {
  width: min(520px, calc(100% - 30px));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 20px 60px #0f172a44
}

dialog::backdrop {
  background: #0f172a88
}

.dialog-close {
  float: right
}

dialog label {
  margin: 10px 0
}

dialog img {
  display: block;
  width: 220px;
  height: 220px;
  margin: 12px auto;
  image-rendering: pixelated
}

dialog input {
  width: 100%
}

.security-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border)
}

.security-section h3 {
  margin: 0 0 6px
}

.security-help {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45
}

.password-visibility {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content
}

.password-visibility input {
  width: auto;
  margin: 0
}

.security-message {
  margin: 10px 0 0;
  font-size: 14px
}

.success {
  color: #15803d
}

.codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #f8fafc;
  padding: 12px;
  border-radius: 9px;
  font-family: monospace;
  font-size: 16px
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--text);
  color: white;
  padding: 11px 15px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 50
}

#toast.show {
  opacity: 1
}

@media(max-width:1200px) {
  .app-header {
    grid-template-columns: auto 1fr
  }

  .header-controls {
    grid-column: 1/-1
  }

  .combined-summary {
    grid-template-columns: 1fr
  }

  .summary-divider {
    height: 1px
  }

  .layout {
    grid-template-columns: 300px minmax(0, 1fr)
  }
}

@media(max-width:800px) {
  .app-header {
    position: static;
    grid-template-columns: 1fr
  }

  .header-tabs,
  .header-controls {
    flex-wrap: wrap
  }

  .header-filter {
    min-width: 140px;
    flex: 1
  }

  .combined-summary {
    padding: 15px
  }

  .summary-metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px
  }

  .summary-metric {
    border: 0;
    padding: 0
  }

  .layout {
    grid-template-columns: 1fr
  }

  .management {
    max-height: none
  }

  .table-wrap {
    max-height: none
  }
}

.compact-schedule {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px
}

.compact-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1.35fr) repeat(7, minmax(95px, 1fr));
  min-width: 920px
}

.compact-cell {
  min-width: 0;
  padding: 9px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #fff
}

.compact-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
  text-align: center
}

.compact-employee {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f8fafc;
  font-weight: 800
}

.compact-grid .compact-cell:nth-child(16n+9),
.compact-grid .compact-cell:nth-child(16n+10),
.compact-grid .compact-cell:nth-child(16n+11),
.compact-grid .compact-cell:nth-child(16n+12),
.compact-grid .compact-cell:nth-child(16n+13),
.compact-grid .compact-cell:nth-child(16n+14),
.compact-grid .compact-cell:nth-child(16n+15),
.compact-grid .compact-cell:nth-child(16n+16) {
  background: #f4f8ff
}

.compact-status {
  display: block;
  padding: 6px 5px;
  border-radius: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  text-align: center
}

.compact-site {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  overflow-wrap: anywhere
}

.viewer-mode main {
  padding-top: 18px
}

.viewer-mode .layout {
  grid-template-columns: minmax(0, 1fr)
}

.viewer-mode .schedule {
  width: 100%
}

.viewer-mode .schedule-title {
  margin-bottom: 10px
}

.viewer-mode .compact-schedule {
  max-height: calc(100vh - 155px)
}

[hidden] {
  display: none !important
}

.tech-badge.tech-air {
  background: #f1e8ff;
  color: #7e22ce
}

.tech-badge.tech-chiller {
  background: #dff7f3;
  color: #087f6f
}

.tech-badge.tech-other {
  background: #edf1f6;
  color: #475467
}

.roster-item {
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s
}

.roster-item:hover {
  border-color: #9bbcff;
  background: #f4f8ff
}

.roster-item.selected {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(40, 100, 235, .1)
}

.clear-selection {
  margin-left: auto;
  padding: 7px 12px
}

.summary-metrics.employee-weekly {
  grid-template-columns: repeat(7, 1fr)
}

.summary-group:has(.employee-weekly) {
  grid-column: 1/-1
}

.layout {
  grid-template-columns: auto minmax(0, 1fr)
}

.management {
  width: 330px;
  min-width: 280px;
  max-width: 50vw;
  resize: horizontal
}

.roster-item .item-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 5px
}

.roster-item .item-actions button {
  width: 100%;
  min-width: 82px;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.2
}

.roster-item .clear-selection {
  margin: 0;
  background: var(--accent);
  color: white;
  border-color: var(--accent)
}

.roster-item .item-info {
  align-self: flex-start
}

.management:after {
  content: "Drag right edge to resize";
  display: block;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  text-align: right
}

@media(max-width:800px) {
  .layout {
    grid-template-columns: 1fr
  }

  .management {
    width: auto;
    min-width: 0;
    max-width: none;
    resize: none
  }

  .management:after {
    display: none
  }
}

.item-actions button {
  min-width: 82px;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.2
}

.schedule-filters {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap
}

.schedule-filters label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800
}

.schedule-filters select {
  min-width: 210px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700
}

.schedule-filters button {
  align-self: end
}

.schedule-title>div:first-child {
  min-width: 220px
}

@media(max-width:900px) {
  .schedule-title {
    display: grid;
    gap: 12px
  }

  .schedule-filters {
    justify-content: stretch
  }

  .schedule-filters label {
    flex: 1
  }

  .schedule-filters select {
    width: 100%;
    min-width: 150px
  }

}

@media print {
  html,
  body,
  .compact-cell,
  .compact-status,
  .site-badge,
  .tech-badge {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important
  }

  body {
    background: white
  }

  .app-header,
  .combined-summary,
  .management,
  .schedule-filters,
  .schedule-title p,
  #toast {
    display: none !important
  }

  .bulk-day-selector input {
    display: none
  }

  main {
    padding: 0
  }

  .layout {
    display: block
  }

  .schedule {
    border: 0;
    box-shadow: none;
    padding: 0
  }

  .schedule-title {
    display: block !important
  }

  .schedule-title h2 {
    margin-bottom: 12px
  }

  .table-wrap,
  .compact-schedule {
    overflow: visible;
    max-height: none;
    border: 0
  }

  table,
  .compact-grid {
    min-width: 0;
    font-size: 9px
  }

  th,
  td,
  .compact-cell {
    padding: 4px
  }

  .cell select,
  .cell textarea {
    font-size: 8px;
    padding: 3px
  }

  .cell textarea {
    min-height: 28px
  }

  .pill {
    font-size: 8px;
    padding: 3px 5px
  }

  .compact-status {
    border: 1px solid currentColor
  }

  .compact-status.Working {
    border-color: #16a34a;
    background: #dcfce7 !important;
    color: #166534 !important
  }

  .compact-status.Travel {
    border-color: #7c3aed;
    background: #ede9fe !important;
    color: #5b21b6 !important
  }

  .compact-status.Vacation {
    border-color: #dc2626;
    background: #fee2e2 !important;
    color: #991b1b !important
  }

  .compact-status.Sick {
    border-color: #f59e0b;
    background: #fef3c7 !important;
    color: #92400e !important
  }

  .compact-status.Training {
    border-color: #0f766e;
    background: #ccfbf1 !important;
    color: #115e59 !important
  }

  .compact-status.OFF {
    border-color: #64748b;
    background: #e2e8f0 !important;
    color: #334155 !important
  }

  .compact-status.Unassigned {
    border-color: #94a3b8;
    background: #f1f5f9 !important;
    color: #475569 !important
  }

  @page {
    size: landscape;
    margin: 8mm
  }
}

:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --border: #d9e1ec;
  --accent: #2563eb;
  --accent-soft: #e8f0ff;
  --danger: #dc2626
}

.Working {
  background: #16a34a
}

.Travel {
  background: #7c3aed
}

.Vacation {
  background: #dc2626
}

.Sick {
  background: #f59e0b
}

.Training {
  background: #0f766e
}

.OFF {
  background: #64748b
}

.Unassigned {
  background: #94a3b8
}

.site-badge {
  background: #e8f0ff;
  color: #2563eb
}

.site-badge.floater-badge {
  background: linear-gradient(135deg, #fff1f1 0%, #fde2e2 100%);
  color: #b42318
}

.tech-badge.tech-air {
  background: #f2e8ff;
  color: #7c3aed
}

.tech-badge.tech-chiller {
  background: #e2f3f0;
  color: #0f766e
}

.tech-badge.tech-other {
  background: #eef2f6;
  color: #64748b
}

.card,
.item,
.compact-cell {
  box-shadow: none
}

.card {
  box-shadow: 0 8px 22px rgba(15, 23, 42, .07)
}

.vertical-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px
}

.vertical-actions button {
  width: 100%;
  min-width: 82px;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.2
}

.schedule-filters select[multiple] {
  height: 74px;
  padding: 5px 8px
}

.schedule-filters select[multiple] option {
  padding: 4px 6px;
  border-radius: 6px
}

.schedule-filters select[multiple] option:checked {
  background: linear-gradient(var(--accent), var(--accent));
  color: white
}

#employees .item-actions,
#users .item-actions,
#archivedUsers .item-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 112px;
  gap: 5px
}

#employees .item-actions button,
#users .item-actions button,
#archivedUsers .item-actions button {
  display: block;
  width: 100%;
  min-width: 82px;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.2
}

.brand {
  min-width: 300px
}

.xnrgy-logo {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 42px
}

.brand .brand-title {
  display: grid;
  gap: 2px
}

.brand .brand-title h1 {
  display: block;
  font-size: 15px;
  line-height: 1.15;
  white-space: nowrap;
  color: var(--text)
}

.brand .brand-title small {
  color: var(--muted);
  font-size: 11px
}

@media(max-width:1000px) {
  .brand {
    min-width: 0
  }

  .brand .brand-title h1 {
    white-space: normal;
    font-size: 13px
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101828;
  --panel: #182230;
  --text: #f2f4f7;
  --muted: #aeb8c8;
  --border: #344054;
  --accent: #6192ff;
  --accent-soft: #263a60;
  --danger: #ff7b7b;
  --shadow: 0 10px 28px rgba(0, 0, 0, .28)
}

html[data-theme="dark"] .app-header {
  background: rgba(24, 34, 48, .97)
}

html[data-theme="dark"] button,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .danger,
html[data-theme="dark"] .filter-trigger {
  background: #1d2939;
  color: var(--text)
}

html[data-theme="dark"] .item,
html[data-theme="dark"] th,
html[data-theme="dark"] th:first-child,
html[data-theme="dark"] td:first-child,
html[data-theme="dark"] .compact-cell,
html[data-theme="dark"] .compact-head,
html[data-theme="dark"] .compact-employee,
html[data-theme="dark"] .check-panel,
html[data-theme="dark"] dialog {
  background: #182230
}

html[data-theme="dark"] tbody tr:nth-child(odd) td,
html[data-theme="dark"] .compact-grid .compact-cell {
  background: #1d2939
}

html[data-theme="dark"] tbody tr:nth-child(odd) td:first-child {
  background: #263a60
}

.audit-dialog {
  width: min(1000px, calc(100% - 30px));
  max-height: 85vh
}

.audit-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 14px 0
}

.audit-toolbar input {
  flex: 1
}

.audit-table-wrap {
  overflow: auto;
  max-height: 62vh;
  border: 1px solid var(--border);
  border-radius: 10px
}

.audit-table {
  min-width: 760px
}

.audit-table td,
.audit-table th {
  position: static !important;
  background: var(--panel) !important
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  min-width: 190px
}

.audit-table td:nth-child(2) {
  font-weight: 700
}

.audit-table td:nth-child(2) small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: capitalize
}

.audit-details {
  max-width: 420px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px
}

.filter-field {
  position: relative;
  min-width: 190px
}

.filter-field>span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800
}

.check-dropdown {
  position: relative
}

.filter-trigger {
  width: 100%;
  min-height: 40px;
  padding: 8px 34px 8px 11px;
  background: white;
  color: var(--text);
  border-color: var(--border);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative
}

.filter-trigger:after {
  content: "▾";
  position: absolute;
  right: 11px;
  color: var(--muted)
}

.check-panel {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 30;
  width: max-content;
  min-width: 100%;
  max-width: 310px;
  max-height: 240px;
  overflow: auto;
  padding: 7px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .18)
}

.check-search {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  min-width: 230px;
  margin-bottom: 6px;
  padding: 8px 10px;
  background: var(--panel);
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500
}

.check-empty {
  display: block;
  padding: 9px 8px;
  color: var(--muted);
  font-size: 13px
}

.check-empty[hidden] {
  display: none
}

.check-panel label {
  display: flex !important;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  color: var(--text) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap
}

.check-panel label[hidden] {
  display: none !important
}

.check-panel label:hover {
  background: var(--accent-soft)
}

.check-panel input[type=checkbox] {
  appearance: none;
  width: 17px;
  height: 17px;
  min-width: 17px;
  margin: 0;
  padding: 0;
  border: 1.5px solid #94a3b8;
  border-radius: 3px
}

.check-panel input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px white
}

.schedule-filters>.filter-field {
  align-self: end
}

/* Shared roster groups and a compact schedule toolbar. */
.schedule-title { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 980px); align-items: end; gap: 12px 16px }
.schedule-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(190px, 1.2fr) auto; gap: 8px; width: 100%; margin-left: auto }
.schedule-filters .filter-field { min-width: 0 }
.schedule-filters .filter-trigger { min-width: 0; font-size: 14px; font-weight: 700 }
.filter-active { border-color: #0d9488; background: #e6faf5; color: #115e59 }
.schedule-actions, .bulk-actions, .view-actions { display: flex; align-items: end; gap: 10px; flex-wrap: wrap }
.schedule-actions { grid-column: 1 / -1; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--border) }
.view-actions { margin-left: auto }
.schedule-actions .bulk-status-control select { min-width: 160px; font-size: 14px; font-weight: 700; min-height: 40px }
.filter-summary { margin: 0; color: var(--muted); font-size: 12px }
.toolbar-menu { position: relative }
.toolbar-menu>summary { cursor: pointer; padding: 10px 16px; border: 1px solid var(--border); border-radius: 12px; font-weight: 800; list-style: none }
.toolbar-menu>summary::after { content: " \25be" }
.toolbar-menu>summary::-webkit-details-marker { display: none }
.toolbar-popover { position: absolute; right: 0; top: calc(100% + 6px); z-index: 35; width: 250px; max-width: 80vw; padding: 12px; display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 28px #0f172a25 }
.toolbar-popover label { font-size: 13px; font-weight: 700 }
.toolbar-popover output { display: block; color: var(--muted); margin-top: 4px }
.toolbar-popover input[type=range] { width: 100%; padding: 0; accent-color: var(--accent) }
.toolbar-popover button { text-align: left }
.badge.group-badge { background: #ccfbf1; color: #115e59; border: 1px solid #5eead4; font-size: 11px; font-weight: 800; white-space: normal; overflow-wrap: anywhere; max-width: 100%; margin: 4px 0 0 4px }
.groups-panel>summary { background: #effcf8; color: #115e59 }
.groups-panel label { font-size: 13px; font-weight: 700; display: block; margin-top: 10px }
#groupFields { border: 0; margin: 0; padding: 0; min-width: 0 }
#groupSelect, #groupName, #groupSearch { width: 100%; min-width: 0 }
.group-members { max-height: 220px; overflow-y: auto; margin-bottom: 8px }
.groups-panel .group-member { display: flex; align-items: start; gap: 9px; border-bottom: 1px solid var(--border); padding: 8px 0; margin: 0; cursor: pointer }
.group-member input[type=checkbox] { width: 17px; height: 17px; flex: 0 0 17px; margin: 3px 0; accent-color: #0d9488 }
.group-member small { display: block; color: var(--muted); font-size: 11px; line-height: 1.5 }
.group-member .employee-company { color: #0d9488; font-weight: 600 }
.group-member .membership-other { color: #92400e; background: #fef3c7; border-radius: 4px; padding: 1px 4px }
.group-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; position: sticky; bottom: 0; padding: 8px 0; background: var(--panel) }
.group-actions button { font-size: 12px; padding: 8px 10px }
.roster-resize { position: absolute; right: 0; top: 16px; bottom: 16px; width: 6px; cursor: col-resize; touch-action: none; border-radius: 6px }
.roster-resize:hover, .roster-resize:focus-visible { background: #0d94884d; outline: 2px solid #0d9488 }
html[data-theme="dark"] .group-badge, html[data-theme="dark"] .groups-panel>summary,
html[data-theme="dark"] .filter-active { background: #123c39; color: #99f6e4; border-color: #2dd4bf }
html[data-theme="dark"] .employee-company { color: #5eead4 }

@media screen {
  #schedule { table-layout: fixed; width: var(--schedule-width, 1780px); min-width: 0 }
  #schedule col.employee-column { width: 240px }
  #schedule th:first-child, #schedule td:first-child { width: 240px }
  #schedule th:not(:first-child), #schedule td:not(:first-child) { min-width: 0 }
  #schedule .cell { min-width: 0 }
  #schedule .cell select, #schedule .cell textarea { width: 100%; min-width: 0 }
  .compact-grid { grid-template-columns: var(--compact-columns, 240px repeat(7, 220px)); min-width: var(--schedule-width, 1780px) }
  #schedule thead th:not(:first-child) { position: sticky }
  .day-resize { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: col-resize; touch-action: none; z-index: 2 }
  .day-resize:hover, .day-resize:focus-visible { background: #0d94884d; outline: 2px solid #0d9488 }
}
@media screen and (min-width:801px) {
  .management { position: relative; width: var(--roster-width, 330px); max-width: min(600px, 50vw); resize: none; overflow: auto }
}
@media screen and (max-width:1500px) {
  .schedule-title { display: flex; flex-direction: column; align-items: stretch }
  .schedule-filters { max-width: 980px }
}
@media screen and (max-width:1300px) {
  .schedule-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 100% }
  .schedule-filters>#clearFilters { justify-self: start }
}
@media screen and (max-width:800px) {
  .roster-resize { display: none }
  .schedule-actions { gap: 12px }
}
@media screen and (max-width:480px) {
  .schedule-filters { grid-template-columns: minmax(0, 1fr) }
}
@media print {
  .schedule-actions, .filter-summary { display: none !important }
  .group-badge { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important }
  #schedule { width: 100% !important; table-layout: auto !important }
  #schedule colgroup, #schedule .day-resize { display: none !important }
  .compact-grid { grid-template-columns: minmax(100px, 1.35fr) repeat(7, minmax(0, 1fr)) !important; min-width: 0 !important }
}

@media screen {
  .table-wrap,
  .compact-schedule {
    overflow-y: scroll;
    scrollbar-gutter: stable;
    max-height: 68vh
  }

  .management.roster-collapsed {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    padding: 8px;
    overflow: hidden;
    resize: none
  }

  .management.roster-collapsed>.management-header {
    justify-content: center
  }

  .management.roster-collapsed>.management-header h2,
  .management.roster-collapsed>:not(.management-header),
  .management.roster-collapsed:after {
    display: none
  }

  .management.roster-collapsed .roster-collapse-toggle span {
    transform: rotate(180deg)
  }
}

@media screen and (min-width:801px) {
  .layout.roster-collapsed {
    grid-template-columns: 52px minmax(0, 1fr)
  }
}

@media screen and (max-width:800px) {
  .management.roster-collapsed {
    width: 100%;
    min-width: 0;
    max-width: none
  }

  .table-wrap,
  .compact-schedule {
    max-height: 70vh
  }
}

/* Calendar view (2026-10-15): month grid, group colours, plan and day dialogs. */
:root {
  --cal-green: #dcfce7; --cal-yellow: #fef9c3; --cal-red: #fee2e2; --cal-blue: #dbeafe;
  --cal-purple: #ede9fe; --cal-orange: #ffedd5; --cal-teal: #ccfbf1; --cal-pink: #fce7f3
}
.cal-green { background: var(--cal-green) } .cal-yellow { background: var(--cal-yellow) }
.cal-red { background: var(--cal-red) } .cal-blue { background: var(--cal-blue) }
.cal-purple { background: var(--cal-purple) } .cal-orange { background: var(--cal-orange) }
.cal-teal { background: var(--cal-teal) } .cal-pink { background: var(--cal-pink) }
.calendar-view { padding: 18px; min-width: 0; grid-column: 2 }
.viewer-mode .calendar-view { grid-column: 1 }
.calendar-print-title, .calendar-print-groups { display: none }
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 10px }
.calendar-toolbar .filter-field { min-width: 170px; margin: 0 }
.calendar-toolbar select { width: 100%; padding: 8px 10px }
.calendar-toolbar select.cal-required { border: 2px solid var(--danger) }
.calendar-month { display: flex; align-items: center; gap: 8px; margin-left: auto }
.calendar-month strong { min-width: 140px; text-align: center }
.calendar-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 15px; margin-bottom: 6px }
.calendar-legend .cal-legend-gap { margin-left: 8px }
.calendar-legend .cal-quiet { font-size: 15px }
.calendar-help { color: var(--muted); font-size: 15px; margin: 0 0 8px }
.cal-swatch { display: inline-block; width: 18px; height: 14px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, .18) }
.cal-quiet { color: var(--muted); font-size: 11px }
.calendar-grid-wrap { position: relative }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; user-select: none }
.cal-dow { text-align: center; font-weight: 800; color: var(--muted); font-size: 12px; padding: 2px 0 }
/* Tiles grow with their text (min-height only), so nothing is cut off at any zoom level;
   overflow: hidden only clips the group blocks to the rounded corners. */
.cal-day { --cal-pad-y: 5px; --cal-pad-x: 7px; position: relative; display: flex; flex-direction: column; min-height: max(96px, calc((100vh - 300px) / 6)); border: 1px solid var(--border); border-radius: 10px; background: var(--panel); padding: var(--cal-pad-y) var(--cal-pad-x); overflow: hidden; cursor: pointer }
/* Group blocks are always light colours, so their text stays dark in either theme. */
.cal-band { color: #172033 }
.cal-band .cal-quiet { color: #475569 }
/* Light grey date strip with a bold divider, edge to edge across the top of every tile. */
.cal-date { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 3px 4px; margin: calc(-1 * var(--cal-pad-y)) calc(-1 * var(--cal-pad-x)) 0; padding: 4px var(--cal-pad-x); background: #eef2f6; border-bottom: 2px solid #94a3b8; color: #172033 }
html[data-theme="dark"] .cal-date { background: #263042; border-bottom-color: #64748b; color: #e2e8f0 }
.cal-letter { display: inline-block; min-width: 22px; text-align: center }
/* Right side of the date strip: one chip for a group that is entirely OFF or on Travel, "+N", ⚠. */
/* When the tile is too narrow, the strip moves under the date instead of squeezing; the chip never
   splits, and a long group name is shortened with an ellipsis. */
.cal-strip { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 3px 4px; min-width: 0; max-width: 100%; margin-left: auto }
.cal-chip { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; padding: 0 3px 0 7px; border: 1px solid rgba(15, 23, 42, .25); border-radius: 999px; font-size: 12px; font-weight: 800; line-height: 18px; color: #334155; white-space: nowrap }
.cal-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis }
.cal-chip .pill { flex: 0 0 auto; font-size: 10.5px; padding: 0 6px }
.cal-strip .cal-more { flex: 0 0 auto }
.cal-chip-draft { border-style: dashed; border-color: #64748b }
.cal-date .cal-more { color: #475569; font-size: 12px; font-weight: 700 }
html[data-theme="dark"] .cal-date .cal-more { color: #cbd5e1 }
.cal-day:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px }
.cal-out { background: transparent; color: var(--muted); opacity: .55; cursor: default }
.cal-sun { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(148, 163, 184, .14) 6px 12px) }
.cal-today .cal-num { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 6px }
.cal-draft { outline: 2px dashed #64748b; outline-offset: -3px }
.cal-selecting { outline: 3px solid var(--accent); outline-offset: -3px }
.cal-num { font-weight: 800; font-size: 14px }
/* Night shift: "N" in the calendar date strip (names on hover), "N" badges next to Working,
   and the Night shift ticks in the schedule cell, day detail and Bulk Status. */
.cal-night, .night-badge { display: inline-grid; place-items: center; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; background: #1e293b; color: #fff; font-size: 10.5px; font-weight: 800; line-height: 1; cursor: help; -webkit-print-color-adjust: exact; print-color-adjust: exact }
.night-badge { width: 16px; height: 16px; font-size: 9.5px; margin-left: 4px; vertical-align: -2px }
.calendar-legend .cal-night { width: 16px; height: 16px; font-size: 9.5px; vertical-align: -2px }
.night-toggle { display: flex; align-items: center; gap: 6px; margin: 2px 0; font-size: 12.5px; font-weight: 600; cursor: pointer }
.night-toggle input { width: auto; margin: 0; padding: 0 }
.cal-day-table .night-toggle { margin: 0 }
.cal-day-table .night-toggle:has(input:disabled) { color: #b6c0cf; cursor: default }
html[data-theme="dark"] .cal-night, html[data-theme="dark"] .night-badge { background: #e2e8f0; color: #0f172a }
@media print {
  .night-toggle { display: none }
  .cal-night { width: 14px; height: 14px; font-size: 8.5px }
}
/* ⚠ someone is working on their group's off / travel day (chip and block). */
.cal-warn { flex: 0 0 auto; color: #b45309; font-weight: 800; font-size: 13px; cursor: help }
/* One colour block per group, edge to edge; the colour change is the divider. The last block
   stretches to the bottom of the tile. */
.cal-band { margin: 0 calc(-1 * var(--cal-pad-x)); padding: 3px var(--cal-pad-x); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere }
.cal-band:last-child { flex: 1 0 auto; margin-bottom: calc(-1 * var(--cal-pad-y)); padding-bottom: calc(3px + var(--cal-pad-y)) }
.cal-group { font-size: 13px; font-weight: 800; color: #334155 }
.cal-detail { font-size: 13px; line-height: 1.4 }
.cal-more { white-space: nowrap; cursor: help }
.cal-detail .pill { font-size: 11.5px; padding: 1px 8px; color: #fff }
.cal-detail .cal-quiet { font-size: 12.5px }
.calendar-dialog .pill { font-size: 10px; padding: 1px 7px; color: #fff }
.calendar-legend .pill { font-size: 13px; padding: 2px 10px; color: #fff }
.calendar-lock { position: absolute; inset: 24px 0 0; display: grid; place-items: center; background: rgba(241, 245, 249, .78); font-weight: 800; color: var(--danger); border-radius: 10px }
.calendar-dialog { width: min(560px, calc(100% - 30px)) }
.calendar-dialog-wide { width: min(860px, calc(100% - 30px)) }
.calendar-dialog h2 { margin-top: 0 }
.calendar-dialog h3 { display: flex; align-items: center; gap: 6px; margin: 14px 0 6px; font-size: 14px }
.calendar-dialog-site { margin: -6px 0 8px; color: var(--muted); font-weight: 700 }
.calendar-dialog label { display: block }
.calendar-dialog label > select, .calendar-dialog label > input:not([type="checkbox"]) { display: block; width: 100%; margin-top: 4px }
.plan-end { display: flex; align-items: center; gap: 10px; margin-top: 4px }
.plan-end input { flex: 1 }
.plan-end output { font-weight: 800; color: var(--accent); white-space: nowrap }
.plan-colors-field > span { display: block; margin: 10px 0 4px; font-weight: 600 }
.plan-colors { display: flex; gap: 6px }
.cal-color { width: 28px; height: 24px; padding: 0; border: 1px solid rgba(0, 0, 0, .2); border-radius: 6px }
.cal-color.selected { outline: 3px solid var(--accent); outline-offset: 2px }
.plan-checks { display: flex; gap: 18px }
.plan-checks label, .plan-check { display: flex; align-items: center; gap: 8px; margin: 8px 0 }
/* Dialog inputs are full width by default; keep checkboxes at their natural size beside the label. */
.calendar-dialog input[type="checkbox"] { width: auto; flex: 0 0 auto; margin: 0; padding: 0 }
.calendar-dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px }
.calendar-dialog-actions .cal-quiet { margin-right: auto }
.cal-day-table { width: 100%; border-collapse: collapse; font-size: 13px }
.cal-day-table th, .cal-day-table td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: middle }
.cal-day-table select { padding: 4px 8px }
.cal-actions { white-space: nowrap }
.cal-actions button { padding: 4px 10px; margin-right: 4px }
/* Phone layout: screen only, so printing never picks up these smaller sizes. */
@media screen and (max-width: 760px) {
  .calendar-month { margin-left: 0 }
  .cal-day { min-height: 64px; --cal-pad-y: 3px; --cal-pad-x: 4px }
  .cal-band, .cal-group, .cal-detail, .cal-chip { font-size: 9.5px }
}
/* Save PDF (landscape, see the @page rule above): one month per page, equal row heights,
   one text size in every tile, no "today" circle, every group listed below with the print date. */
@media print {
  .calendar-toolbar, .calendar-help, .calendar-lock { display: none !important }
  .calendar-view { border: 0; box-shadow: none; padding: 0 }
  .calendar-print-title { display: block; font-size: 18px; margin: 0 0 4px }
  .calendar-legend { font-size: 11px; gap: 2px 10px; margin-bottom: 6px }
  .calendar-legend .pill { font-size: 9.5px; padding: 0 7px }
  .calendar-legend .cal-quiet { font-size: 11px }
  .cal-swatch { width: 13px; height: 10px }
  .calendar-grid { gap: 3px; grid-template-rows: auto; grid-auto-rows: 1fr }
  .cal-dow { font-size: 11px; padding: 0 0 2px }
  .cal-day { min-height: 0.95in; --cal-pad-y: 2px; --cal-pad-x: 6px; border-radius: 6px; break-inside: avoid }
  .cal-date { flex-wrap: nowrap; padding: 3px var(--cal-pad-x); border-bottom-width: 1.5px }
  .cal-strip { flex-wrap: nowrap }
  .cal-num { font-size: 12.5px }
  .cal-today .cal-num { background: none; color: inherit; padding: 0 }
  .cal-band, .cal-group, .cal-detail, .cal-detail .cal-quiet, .cal-chip, .cal-warn, .cal-date .cal-more { font-size: 10px; line-height: 1.4 }
  .cal-band { padding: 2px var(--cal-pad-x) }
  .cal-band:last-child { padding-bottom: calc(2px + var(--cal-pad-y)) }
  .cal-detail .pill, .cal-chip .pill { font-size: 8.5px; padding: 0 5px; min-width: 0 }
  .cal-chip { line-height: 15px; padding: 0 2px 0 6px }
  .cal-who { white-space: nowrap }
  .calendar-print-groups { display: block; columns: 2; column-gap: 28px; font-size: 10px; margin-top: 8px }
  .calendar-print-groups p { break-inside: avoid; margin: 0 0 3px }
  .calendar-printed { color: #667085; font-size: 9.5px }
  .cal-day, .cal-date, .cal-chip, .cal-band, .cal-swatch, .cal-detail .pill, .calendar-legend .pill { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important }
  .cal-draft { outline: 0 }
}
.plan-sub-check { margin-left: 22px !important }

/* Summary pages, clickable summary numbers and the summary filter chip (2026-10-16). */
.summary-month { grid-column: 1 / -1 }
.summary-dots { grid-column: 1 / -1; display: flex; justify-content: center; gap: 8px; margin-top: -6px }
.summary-dot { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: var(--border); cursor: pointer }
.summary-dot.active { background: var(--accent) }
button.summary-metric { background: transparent; color: var(--text); border: 0; border-right: 1px solid var(--border); border-radius: 0; padding: 4px 14px; text-align: left; font-weight: inherit; cursor: pointer }
button.summary-metric:hover strong { color: var(--accent) }
.summary-metric:focus-visible, .summary-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
/* Summary-number pop-up: a plain list grouped by site. */
.kpi-dialog { width: min(460px, calc(100% - 30px)); max-height: min(80vh, 720px); padding: 16px 20px 18px; border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 18px 40px rgba(15, 23, 42, .18) }
.kpi-dialog::backdrop { background: rgba(15, 23, 42, .35) }
.kpi-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px }
.kpi-head h2 { margin: 0; font-size: 18px }
.kpi-head button { padding: 4px 12px; font-size: 13px }
.kpi-period { margin: 2px 0 0; color: var(--muted); font-size: 13px }
.kpi-site { display: flex; justify-content: space-between; margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 2px solid #94a3b8; font-weight: 800 }
.kpi-site span + span { color: var(--muted); font-size: 13px }
.kpi-when-head { margin: 8px 0 2px; color: #475569; font-size: 13px; font-weight: 800 }
.kpi-names { padding: 2px 0 4px; font-size: 14.5px; line-height: 1.45 }
.kpi-empty { margin: 16px 0 0; color: var(--muted) }

/* Plans pop-up (2026-11-04): timeline, one colour-edged card per group (current and upcoming
   plans), and past plans by month. Cards instead of a table, so it never scrolls sideways. */
.ink-green { --g: #22c55e; --g-soft: var(--cal-green) } .ink-yellow { --g: #eab308; --g-soft: var(--cal-yellow) }
.ink-red { --g: #ef4444; --g-soft: var(--cal-red) } .ink-blue { --g: #3b82f6; --g-soft: var(--cal-blue) }
.ink-purple { --g: #8b5cf6; --g-soft: var(--cal-purple) } .ink-orange { --g: #f97316; --g-soft: var(--cal-orange) }
.ink-teal { --g: #14b8a6; --g-soft: var(--cal-teal) } .ink-pink { --g: #ec4899; --g-soft: var(--cal-pink) }
.plan-dot { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--g) }
.plan-timeline { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 8px; margin: 12px 0 16px; background: var(--bg) }
.plan-tl-head, .plan-tl-row { display: grid; grid-template-columns: 110px 1fr; align-items: center }
.plan-tl-ticks { position: relative; height: 16px; font-size: 10.5px; color: var(--muted) }
.plan-tl-ticks span { position: absolute; white-space: nowrap }
.plan-tl-row { height: 26px }
.plan-tl-name { display: flex; align-items: center; gap: 6px; overflow: hidden; font-size: 12.5px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis }
.plan-tl-track { position: relative; height: 14px; border-radius: 7px; background: var(--border) }
.plan-tl-bar, .plan-tl-off { position: absolute; top: 0; height: 14px; border-radius: 7px; box-sizing: border-box }
.plan-tl-bar { background: var(--g) }
.plan-tl-off { border: 1px solid var(--g); background: repeating-linear-gradient(135deg, var(--g-soft) 0 4px, var(--panel) 4px 8px) }
.plan-tl-draft { opacity: .5 }
.plan-tl-today { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text) }
.plan-tl-today b { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 10px }
.plan-tl-key { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; padding-left: 110px; font-size: 11px; color: var(--muted) }
.plan-tl-key i { display: inline-block; width: 18px; height: 8px; margin-right: 4px; border-radius: 4px; background: #64748b }
.plan-tl-key i.off { border: 1px solid #64748b; background: repeating-linear-gradient(135deg, #e2e8f0 0 3px, #fff 3px 6px) }
.plan-section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 8px; font-size: 15px; font-weight: 800 }
.plan-group { margin-bottom: 10px; overflow: hidden; border: 1px solid var(--border); border-left: 5px solid var(--g); border-radius: 12px; background: var(--panel) }
.plan-group-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--g-soft); font-weight: 800 }
.plan-group-head .plan-meta { color: #475569; font-size: 12.5px; font-weight: 500 }
.plan-group-head .plan-count { margin-left: auto; color: #334155; font-size: 12px; font-weight: 700 }
.plan-row { display: grid; grid-template-columns: 1fr 150px 130px; align-items: center; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--border) }
.plan-group-head + .plan-row { border-top: 0 }
.plan-dates { font-size: 14px; font-weight: 700 }
.plan-sub { margin-top: 2px; color: var(--muted); font-size: 12px }
.calendar-dialog .plan-sub .pill { margin-right: 4px; font-size: 9.5px; padding: 1px 6px }
.plan-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700 }
.plan-state-progress .plan-chip { background: #dcfce7; color: #166534 }
.plan-state-offweek .plan-chip { background: #e2e8f0; color: #334155 }
.plan-state-upcoming .plan-chip { background: var(--accent-soft); color: var(--accent) }
.plan-state-draft .plan-chip { border: 1px dashed #94a3b8; color: #475569 }
.plan-note { display: block; margin-top: 4px; color: var(--muted); font-size: 11px }
.plan-progress { height: 5px; margin-top: 5px; overflow: hidden; border-radius: 3px; background: var(--border) }
.plan-progress b { display: block; height: 100%; border-radius: 3px; background: #22c55e }
.plan-acts { display: flex; justify-content: flex-end; gap: 6px }
.plan-acts button { padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 12px }
.plan-acts button.plan-remove:hover, .plan-acts button.plan-remove:focus-visible { border-color: #dc2626; background: #fef2f2; color: #dc2626 }
.plan-empty { padding: 10px 12px; color: var(--muted); font-size: 13px }
.plan-past { margin-top: 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg) }
.plan-past > summary { cursor: pointer; font-size: 15px; font-weight: 800 }
.plan-past > summary .cal-quiet { font-size: 12px; font-weight: 500 }
.plan-past h4 { margin: 10px 0 4px; color: var(--muted); font-size: 12px; letter-spacing: .05em; text-transform: uppercase }
.plan-past-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: #475569; font-size: 13px }
.plan-past-row:nth-of-type(even) { background: var(--panel) }
.plan-past-row .plan-group-name { width: 120px; overflow: hidden; font-weight: 700; white-space: nowrap; text-overflow: ellipsis }
.plan-past-row .cal-quiet { margin-left: auto }
.plan-lock-note { margin: 0 0 6px; padding: 6px 9px; border-radius: 8px; background: var(--accent-soft); color: #334155; font-size: 12.5px }
html[data-theme="dark"] .plan-group-head { background: color-mix(in srgb, var(--g) 28%, var(--panel)) }
html[data-theme="dark"] .plan-group-head .plan-meta, html[data-theme="dark"] .plan-group-head .plan-count,
html[data-theme="dark"] .plan-past-row, html[data-theme="dark"] .plan-lock-note { color: #cbd5e1 }
@media screen and (max-width: 760px) {
  .plan-timeline { display: none }
  .plan-row { grid-template-columns: 1fr auto; gap: 8px }
  .plan-acts { grid-column: 1 / -1; justify-content: flex-start }
  .plan-past-row { flex-wrap: wrap; gap: 4px 10px }
  .plan-past-row .cal-quiet { margin-left: 0 }
}

/* 2026-11-09 (R1): forced passphrase change, temporary passphrase dialog, user account flags. */
.login .password-visibility { display: flex }
.login-help { margin: 0; font-size: 13px }
.temporary-passphrase-dialog { width: min(440px, calc(100vw - 32px)) }
.temporary-passphrase { font-family: monospace; font-size: 18px; letter-spacing: .04em }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px }
.user-flag { display: inline-block; margin: 4px 6px 0 0; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700 }
.user-flag-pending { background: #fef3c7; color: #92400e }
.user-flag-locked { background: #fee2e2; color: #991b1b }
html[data-theme="dark"] .user-flag-pending { background: #78350f; color: #fef3c7 }
html[data-theme="dark"] .user-flag-locked { background: #7f1d1d; color: #fee2e2 }

/* 2026-11-10 (1.10.1): highlighted 14-character rule, live character counter and rule checklist
   on both new-passphrase fields. Unmet rules are red with a cross, met rules green with a tick. */
p.passphrase-highlight { margin: 0 0 10px; padding: 8px 12px; border-left: 4px solid var(--danger); border-radius: 8px; background: #fef2f2; color: var(--text); font-size: 14px }
p.passphrase-highlight strong { color: var(--danger) }
.passphrase-counter { color: var(--danger); font-size: 12.5px; font-weight: 700 }
.passphrase-checklist { margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.6 }
.passphrase-checklist li { color: var(--danger); font-weight: 600 }
.passphrase-checklist li::before { content: "\2717"; display: inline-block; width: 1.3em }
.passphrase-checklist li.met::before { content: "\2713" }
.passphrase-checklist li.met, .passphrase-counter.met { color: #15803d }
html[data-theme="dark"] p.passphrase-highlight { background: #3b1219 }
html[data-theme="dark"] .passphrase-checklist li.met, html[data-theme="dark"] .passphrase-counter.met { color: #4ade80 }
