:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4f8;
  --ink: #17212f;
  --muted: #687589;
  --line: #dbe4ec;
  --primary: #126c65;
  --primary-strong: #0b4f4a;
  --accent: #c9872b;
  --danger: #c43d4b;
  --success: #188456;
  --shadow: 0 18px 45px rgba(19, 33, 47, 0.12);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #10161c;
  --surface: #17212b;
  --surface-soft: #22303c;
  --ink: #edf4f8;
  --muted: #9fb0be;
  --line: #30414f;
  --primary: #4cb9aa;
  --primary-strong: #77d5c8;
  --accent: #d6a156;
  --danger: #ee7280;
  --success: #4fc083;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  caret-color: transparent;
  font-family: "Assistant", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

input,
textarea,
[contenteditable="true"] {
  caret-color: auto;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  min-height: 100vh;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 42px;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.brand-lockup,
.sidebar-brand,
.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1;
}

.brand-lockup p,
.sidebar-brand small,
.user-chip small,
.eyebrow,
.metric span {
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.auth-tab {
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(19, 33, 47, 0.1);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.auth-form.active {
  display: flex;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 108, 101, 0.14);
  outline: none;
}

.primary-action,
.secondary-action {
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  font-weight: 800;
  white-space: nowrap;
}

.primary-action {
  background: var(--primary);
  color: white;
}

.primary-action:hover {
  background: var(--primary-strong);
}

.link-action {
  min-height: auto;
  width: fit-content;
  justify-self: center;
  border: 0;
  padding: 2px 4px;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.link-action:hover {
  color: var(--primary-strong);
}

.secondary-action {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.danger-action {
  border-color: #ffd4da;
  color: var(--danger);
}

.danger-action:hover {
  background: #ffe8eb;
}

.auth-visual {
  position: relative;
  display: grid;
  min-height: 100%;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(rgba(8, 31, 39, 0.45), rgba(8, 31, 39, 0.45)),
    url("https://images.unsplash.com/photo-1552664730-d307ca884978?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-left: 1px solid var(--line);
  background: #10232e;
  color: white;
}

.sidebar .brand-mark {
  background: #e7f7f4;
  color: var(--primary);
}

.sidebar-brand {
  position: relative;
  margin-bottom: 32px;
}

.sidebar-brand small {
  display: block;
  color: #a9bdc9;
}

.notification-button {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-inline-start: auto;
  border: 1px solid rgba(231, 247, 244, 0.2);
  border-radius: 8px;
  background: #10232e;
  color: #ffffff;
  box-shadow: none;
}

.notification-button:hover,
.notification-button.has-unread {
  transform: translateY(-1px);
  background: #203d4c;
}

.notification-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-badge {
  position: absolute;
  top: -7px;
  left: -7px;
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid #10232e;
  border-radius: 999px;
  padding: 0 6px;
  background: #d92518;
  color: white;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.notification-popover {
  position: absolute;
  top: calc(100% + 12px);
  inset-inline-start: 0;
  z-index: 50;
  width: min(360px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 130px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.notification-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.notification-popover-header button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.logout-button {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-top: auto;
  border: 1px solid rgba(231, 247, 244, 0.18);
  border-radius: 8px;
  background: #203d4c;
  color: #e7f7f4;
}

.logout-button:hover {
  background: #2b5264;
}

.logout-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logout-button::after {
  content: attr(aria-label);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  z-index: 30;
  min-width: max-content;
  transform: translateY(-50%);
  border-radius: 8px;
  padding: 7px 10px;
  background: #0b141a;
  color: white;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.logout-button:hover::after {
  opacity: 1;
}

.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: #dbe7ee;
  text-align: right;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: #203d4c;
  color: white;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 14px;
  font-weight: 800;
}

h2 {
  margin-top: 3px;
  font-size: 30px;
}

.user-chip {
  min-width: 190px;
  justify-content: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--success);
}

.mobile-menu {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar,
.table-header,
.report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.employee-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-inline-start: auto;
}

.attendance-delete-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin: -4px 0 12px;
}

#scheduling .toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  justify-content: space-between;
}

#weekly .toolbar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  justify-content: space-between;
}

#scheduling .toolbar .form-note,
#weekly .toolbar .form-note {
  grid-column: 1 / -1;
}

.scheduling-date-actions,
.weekly-date-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weekly-date-actions {
  justify-self: end;
  order: 2;
}

#weekly .toolbar > label {
  justify-self: start;
  order: 1;
}

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

.assignment-controls label {
  min-width: 260px;
  color: var(--primary-strong);
}

.assignment-controls select {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  font-weight: 800;
}

.week-stats-widget {
  position: relative;
  width: fit-content;
}

.week-stats-toggle {
  width: auto;
  min-width: 0;
  padding-inline: 22px;
  caret-color: transparent;
  user-select: none;
}

.week-stats-toggle[aria-expanded="true"] {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  color: var(--primary-strong);
}

.week-stats-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 35;
  width: min(540px, calc(100vw - 44px));
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.week-stats-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.week-stats-header div {
  display: grid;
  gap: 3px;
}

.week-stats-header span {
  color: var(--muted);
  font-weight: 800;
}

.week-stats-header button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.week-stats-content {
  display: grid;
  max-height: 280px;
  overflow-y: auto;
  gap: 12px;
}

.week-stats-table {
  display: grid;
  gap: 7px;
}

.week-stats-row {
  display: grid;
  grid-template-columns: minmax(126px, 1fr) repeat(4, 48px);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface);
}

.week-stats-row.soc-stats-row {
  grid-template-columns: minmax(126px, 1fr) repeat(5, 48px);
}

.week-stats-row span {
  display: grid;
  min-height: 30px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-soft);
  font-weight: 900;
}

.week-stats-labels {
  margin-bottom: 8px;
  border-color: transparent;
  background: transparent;
  padding-block: 0;
}

.week-stats-labels strong,
.week-stats-labels span {
  min-height: auto;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.toolbar .form-note {
  width: 100%;
  text-align: right;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.date-range button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 22px;
}

.home-dashboard {
  display: grid;
  gap: 16px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  align-items: stretch;
  gap: 18px;
  overflow: hidden;
  padding: 22px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 13%, transparent), transparent 42%),
    var(--surface);
}

.home-kicker {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 12px;
  border-radius: 999px;
  padding: 5px 10px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary-strong);
  font-weight: 900;
}

.home-hero h3 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.home-hero p {
  max-width: 640px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.home-status-card {
  display: grid;
  align-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.home-status-card span,
.home-metric span,
.home-next-shift span,
.home-shift-row span,
.home-alert span {
  color: var(--muted);
  font-weight: 700;
}

.home-status-card strong {
  font-size: 22px;
}

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

.home-metric {
  display: grid;
  gap: 8px;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(19, 33, 47, 0.06);
}

.home-metric strong {
  color: var(--primary);
  font-size: 34px;
  line-height: 1;
}

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

.home-panel {
  min-height: 230px;
  padding: 18px;
}

.compact-action {
  min-height: 36px;
  padding: 7px 12px;
}

.home-next-shift {
  display: grid;
  gap: 8px;
  min-height: 140px;
  align-content: center;
  border-radius: 8px;
  padding: 18px;
  background: var(--surface-soft);
}

.home-next-shift strong {
  font-size: 24px;
}

.home-today-list,
.home-alert-list,
.quick-actions {
  display: grid;
  gap: 10px;
}

.home-shift-row,
.home-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.home-shift-row {
  border-right: 5px solid var(--primary);
}

.home-shift-row.evening {
  border-right-color: var(--accent);
}

.home-shift-row.night {
  border-right-color: #536a96;
}

.home-shift-row.middle {
  border-right-color: #7c3aed;
}

.home-shift-row div {
  display: grid;
  gap: 2px;
}

.home-alert {
  align-items: start;
  flex-direction: column;
}

.home-alert.reminder {
  border-right: 5px solid var(--primary);
}

.home-alert.shortage {
  border-right: 5px solid var(--danger);
}

.home-empty {
  display: grid;
  min-height: 96px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

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

.quick-actions .secondary-action {
  min-height: 54px;
  white-space: normal;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(172px, 1fr));
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  overscroll-behavior-inline: contain;
}

.day-column,
.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(19, 33, 47, 0.06);
}

.day-column {
  min-width: 172px;
  max-width: 240px;
  padding: 10px;
  overflow: hidden;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 800;
}

.day-header span {
  color: var(--muted);
  font-size: 14px;
}

.day-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.holiday-marker {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.shift-pill {
  display: grid;
  gap: 4px;
  min-height: 86px;
  max-height: 260px;
  margin-bottom: 10px;
  padding: 10px 9px;
  border-radius: 8px;
  background: var(--surface-soft);
  border-right: 4px solid var(--primary);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.shift-pill[data-select-shift] {
  cursor: pointer;
}

.shift-pill[data-select-shift]:hover,
.shift-pill.selected-shift {
  outline: 2px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.shift-pill.availability-available-card {
  background: color-mix(in srgb, var(--success) 11%, var(--surface-soft));
  outline: 2px solid color-mix(in srgb, var(--success) 24%, transparent);
}

.shift-pill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.shift-role-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 58%;
}

.shift-checkbox {
  position: relative;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.shift-checkbox input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: inherit;
}

.shift-checkbox span {
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary);
  border-radius: 5px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  transition: 0.16s ease;
}

.shift-checkbox input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 108, 101, 0.14);
}

.shift-checkbox input:checked + span::after {
  content: "";
  display: block;
  width: 6px;
  height: 10px;
  margin: 2px auto 0;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.shift-checkbox input:disabled + span {
  opacity: 0.45;
}

.shift-pill.evening {
  border-right-color: var(--accent);
}

.shift-pill.night {
  border-right-color: #536a96;
}

.shift-pill.middle {
  border-right-color: #7c3aed;
  background: color-mix(in srgb, #7c3aed 7%, var(--surface-soft));
}

.shift-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  border-radius: 999px;
  padding: 3px 8px;
  background: color-mix(in srgb, #7c3aed 14%, var(--surface));
  color: #6d28d9;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.assignment-role-badge {
  min-width: auto;
  width: fit-content;
  justify-self: start;
}

.assignment-role-badge.tier-one {
  background: color-mix(in srgb, #7c3aed 14%, var(--surface));
  color: #6d28d9;
}

.assignment-role-badge.tier-two {
  background: color-mix(in srgb, #0891b2 15%, var(--surface));
  color: #0e7490;
}

.assignment-role-badge.manager {
  background: color-mix(in srgb, #b45309 16%, var(--surface));
  color: #92400e;
}

.shift-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 2px;
  color: #6d28d9;
  font-size: 12px;
  font-weight: 900;
}

.shift-section-divider::before,
.shift-section-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, #7c3aed 42%, var(--line)), transparent);
}

.shift-pill strong {
  font-size: 15px;
}

.shift-pill small {
  color: var(--muted);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 16px;
}

#attendance .split-layout {
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin-bottom: 16px;
  font-size: 20px;
}

.form-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.assignment-list,
.permission-list {
  display: grid;
  gap: 10px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading h3 {
  margin-bottom: 0;
}

.attendance-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.attendance-log-panel {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.attendance-log-panel .responsive-table {
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  max-height: min(620px, calc(100vh - 260px));
  overflow: auto;
}

.attendance-log-panel table {
  min-width: 780px;
}

.attendance-log-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.attendance-log-panel tbody tr {
  transition: background 0.15s ease;
}

.attendance-log-panel tbody tr:hover {
  background: rgba(18, 108, 101, 0.06);
}

.attendance-state {
  color: var(--muted);
  font-weight: 700;
}

.live-clock {
  display: block;
  font-size: 40px;
  line-height: 1;
  color: var(--primary);
}

.clock-action {
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  background: var(--success);
  color: white;
  font-weight: 800;
}

.clock-action.active {
  background: var(--danger);
}

.save-note {
  color: var(--muted);
  font-weight: 700;
}

.form-note {
  min-height: 24px;
  color: var(--primary);
  font-weight: 800;
}

body.hide-action-output #appShell .form-note {
  display: none !important;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.permission-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

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

.attendance-actions label {
  min-width: 240px;
}

.permission-actions select {
  min-width: 160px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 3px 10px;
  background: #e8f5f2;
  color: var(--primary);
  font-weight: 800;
  white-space: nowrap;
}

body.theme-dark .tag {
  background: #183b37;
}

.tag.warning {
  background: #fff2da;
  color: #8a5a0b;
}

body.theme-dark .tag.warning {
  background: #463519;
  color: #ffd386;
}

.tag.danger {
  background: #ffe8eb;
  color: var(--danger);
}

body.theme-dark .tag.danger {
  background: #4b2027;
  color: #ff9aa5;
}

.scheduling-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: 16px;
}

.assignment-side-panel {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 12px;
}

.employee-pick {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: right;
}

.employee-pick:hover,
.employee-pick.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.employee-pick.selected {
  box-shadow: inset 4px 0 0 var(--primary);
}

.employee-pick.manual-locked,
.employee-pick:disabled {
  cursor: not-allowed;
  opacity: 0.82;
  border-color: color-mix(in srgb, var(--blue) 28%, var(--line));
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
}

.employee-pick.manual-locked:hover,
.employee-pick:disabled:hover {
  transform: none;
}

.employee-pick span {
  display: grid;
  gap: 3px;
}

.availability-toolbar label {
  min-width: 240px;
}

.empty-week {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  min-height: 120px;
  align-content: center;
}

.empty-week span {
  color: var(--muted);
}

.assignment-name {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.assignment-details {
  display: grid;
  gap: 4px;
  min-width: 0;
  justify-items: start;
}

.weekly-edit-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.weekly-edit-row {
  align-items: flex-start;
  padding: 3px 0;
}

.weekly-time-edit {
  display: flex;
  gap: 6px;
  width: 100%;
  align-items: center;
  margin-top: 4px;
}

.weekly-time-edit label {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 0;
}

.weekly-time-edit label small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
}

.weekly-time-edit input {
  width: 100%;
  height: 30px;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.employee-name {
  font-weight: 500;
}

.employee-name.highlighted {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border-radius: 6px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--employee-color) 14%, transparent);
  color: var(--employee-color);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.assignment-name button,
.remove-assignment-button {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.assignment-name button:hover,
.remove-assignment-button:hover {
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
  background: color-mix(in srgb, var(--danger) 18%, var(--surface));
  transform: translateY(-1px);
}

.attendance-delete-button {
  margin-inline: auto;
}

.shift-time-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.actual-shift-time {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 13px;
  line-height: 1.1;
  font-weight: 900;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actual-shift-time.default {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  color: var(--muted);
}

.actual-shift-time.valid {
  background: #dcfce7;
  color: #15803d;
}

.actual-shift-time.manual {
  background: #e3f7ff;
  color: #08728d;
}

.actual-shift-time.out-of-range {
  background: #fee2e2;
  color: #b91c1c;
}

body.theme-dark .actual-shift-time.valid {
  background: #153825;
  color: #86efac;
}

body.theme-dark .actual-shift-time.manual {
  background: #123845;
  color: #80def5;
}

body.theme-dark .actual-shift-time.out-of-range {
  background: #4a1717;
  color: #fca5a5;
}

.availability-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 900;
  line-height: 1.1;
}

.availability-status.available {
  background: #c9f8dc;
  color: #075f37;
  box-shadow:
    inset 0 0 0 1px #55c98c,
    0 5px 14px rgba(24, 132, 86, 0.16);
}

.availability-status.unreported {
  color: var(--muted);
}

.availability-status.unavailable {
  background: #ffe8eb;
  color: var(--danger);
  box-shadow: inset 0 0 0 1px #f2a8b0;
}

.availability-status.low-priority {
  background: #fff2da;
  color: #8a5a0b;
  box-shadow: inset 0 0 0 1px #e7bd70;
}

.availability-note-input {
  min-height: 58px;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}

.availability-note-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 108, 101, 0.14);
  outline: none;
}

.availability-note-preview {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

body.theme-dark .availability-status.available {
  background: #123d29;
  color: #91f0b8;
  box-shadow:
    inset 0 0 0 1px #2d8c5d,
    0 5px 14px rgba(79, 192, 131, 0.14);
}

body.theme-dark .availability-status.unavailable {
  background: #4b2027;
  color: #ff9aa5;
  box-shadow: inset 0 0 0 1px #8b3a45;
}

body.theme-dark .availability-status.low-priority {
  background: #463519;
  color: #ffd386;
  box-shadow: inset 0 0 0 1px #8d6b30;
}

.draft-label {
  color: var(--accent);
  font-weight: 800;
}

.manual-label {
  border-radius: 999px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
  font-weight: 900;
}

.responsive-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(10, 31, 51, 0.06);
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

th {
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

tbody tr:last-child td {
  border-bottom: 0;
}

#attendance .responsive-table,
#reports .responsive-table {
  border-radius: 10px;
}

#attendance tbody tr:hover,
#reports tbody tr:hover {
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}

#attendance td strong,
#reports td strong {
  color: var(--ink);
  font-weight: 900;
}

.compact-select {
  min-height: 34px;
  padding: 5px 8px;
  font-size: 15px;
  font-weight: 800;
}

.table-input {
  width: min(220px, 100%);
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.table-action {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.report-controls {
  justify-content: flex-start;
}

.report-controls label {
  min-width: 180px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 7%, transparent), transparent 58%),
    var(--surface);
  box-shadow: 0 12px 28px rgba(10, 31, 51, 0.06);
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 32px;
}

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

.setting-card {
  min-height: 160px;
}

.toggle-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.toggle-row input {
  width: 22px;
  min-height: 22px;
  accent-color: var(--primary);
}

.notification-list {
  display: grid;
  gap: 8px;
  max-height: 440px;
  overflow-y: auto;
  padding: 12px;
}

.notification-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-soft);
}

.notification-item div {
  display: grid;
  gap: 4px;
}

.notification-item span {
  color: var(--muted);
  font-weight: 700;
}

.notification-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 7px;
  border-radius: 999px;
  background: transparent;
}

.notification-item.unread .notification-dot {
  background: #d92518;
  box-shadow: 0 0 0 4px rgba(217, 37, 24, 0.12);
}

.notification-item.reminder {
  border-color: color-mix(in srgb, var(--success) 38%, var(--line));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}

.notification-item.shortage {
  border-color: color-mix(in srgb, var(--danger) 38%, var(--line));
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
}

.notification-item.holiday {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--line));
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
}

.notification-item.clean {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
}

.version-number {
  display: block;
  margin-bottom: 8px;
  font-size: 34px;
  color: var(--primary);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 18, 24, 0.48);
}

.modal-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-panel h3 {
  margin-bottom: 18px;
}

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

@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    inset-block: 0;
    right: 0;
    width: 280px;
    transform: translateX(100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-grid;
    place-items: center;
  }

  .topbar {
    align-items: flex-start;
  }

  .user-chip {
    display: none;
  }

  .split-layout,
  #attendance .split-layout,
  .settings-grid,
  .metrics-row,
  .home-hero,
  .home-grid,
  .home-metrics,
  .scheduling-workspace {
    grid-template-columns: 1fr;
  }

  .assignment-side-panel {
    position: static;
  }

  .schedule-grid {
    grid-template-columns: repeat(7, minmax(164px, 72vw));
  }
}

@media (max-width: 560px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .auth-panel,
  .workspace {
    padding: 14px;
  }

  .auth-shell {
    min-height: 100svh;
  }

  .auth-panel {
    justify-content: start;
    min-height: 100svh;
    gap: 18px;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  input,
  select,
  textarea {
    min-height: 46px;
    font-size: 16px;
  }

  button,
  .primary-action,
  .secondary-action {
    min-height: 46px;
    max-width: 100%;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-lockup p {
    overflow-wrap: anywhere;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 26px;
    line-height: 1.12;
  }

  .topbar {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .mobile-menu {
    flex: 0 0 auto;
  }

  .sidebar {
    width: min(292px, 86vw);
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  }

  .notification-popover {
    position: fixed;
    inset-block-start: max(76px, env(safe-area-inset-top));
    inset-inline: 10px;
    width: auto;
    max-height: calc(100svh - 98px);
  }

  .notification-list,
  .attendance-log-panel .responsive-table,
  .responsive-table,
  .schedule-grid {
    -webkit-overflow-scrolling: touch;
  }

  .toolbar,
  .table-header,
  .report-controls {
    align-items: stretch;
    gap: 10px;
  }

  .toolbar > *,
  .home-status-card,
  .assignment-controls,
  .assignment-controls label,
  .availability-toolbar label,
  .attendance-actions,
  .attendance-actions label,
  .table-header > *,
  .report-controls > *,
  .report-controls label {
    width: 100%;
  }

  .employee-table-actions,
  .attendance-actions,
  .weekly-edit-actions,
  .scheduling-date-actions,
  .weekly-date-actions,
  .report-controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .report-controls .primary-action,
  .report-controls .secondary-action,
  .employee-table-actions button,
  .weekly-edit-actions button {
    width: 100%;
  }

  .date-range {
    justify-content: space-between;
    width: 100%;
  }

  .date-range strong {
    min-width: 0;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #scheduling .toolbar,
  #weekly .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .scheduling-date-actions,
  .weekly-date-actions {
    width: 100%;
  }

  .weekly-date-actions,
  #weekly .toolbar > label {
    order: initial;
    justify-self: stretch;
  }

  .week-stats-panel {
    left: auto;
    right: 0;
    width: calc(100vw - 40px);
    transform: none;
  }

  .week-stats-row {
    grid-template-columns: minmax(110px, 1fr) repeat(4, 38px);
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .schedule-grid {
    grid-auto-flow: column;
    grid-auto-columns: minmax(168px, 82vw);
    grid-template-columns: none;
    max-width: 100%;
    padding-bottom: 12px;
  }

  .home-shift-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .day-column {
    max-width: none;
  }

  .shift-pill {
    max-height: 300px;
  }

  .weekly-time-edit {
    flex-wrap: nowrap;
  }

  .weekly-time-edit input {
    height: 36px;
    font-size: 16px;
  }

  .list-item,
  .employee-pick,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .permission-actions {
    justify-content: stretch;
  }

  .permission-actions > *,
  .attendance-actions > *,
  .assignment-controls > * {
    width: 100%;
  }

  .live-clock {
    font-size: 34px;
  }

  table {
    min-width: 680px;
  }

  .attendance-log-panel table {
    min-width: 720px;
  }

  #attendance .responsive-table,
  #reports .responsive-table {
    overflow-x: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #attendance .responsive-table table,
  #reports .responsive-table table {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
  }

  #attendance .responsive-table thead,
  #reports .responsive-table thead {
    display: none;
  }

  #attendance .responsive-table tbody,
  #reports .responsive-table tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }

  #attendance .responsive-table tr,
  #reports .responsive-table tr {
    display: grid;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(10, 31, 51, 0.07);
  }

  #attendance .responsive-table td,
  #reports .responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-width: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 4px;
    text-align: start;
    overflow-wrap: anywhere;
  }

  #attendance .responsive-table td:last-child,
  #reports .responsive-table td:last-child {
    border-bottom: 0;
  }

  #attendance .responsive-table td::before,
  #reports .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
  }
}

@media (max-width: 920px) and (orientation: landscape) {
  .workspace {
    padding: 14px;
  }

  .topbar {
    margin-bottom: 14px;
  }

  .sidebar {
    width: min(300px, 58vw);
  }

  .schedule-grid {
    grid-template-columns: repeat(7, minmax(156px, 34vw));
  }

  .attendance-log-panel .responsive-table {
    max-height: calc(100svh - 190px);
  }

  .auth-panel {
    justify-content: start;
    padding-block: 18px;
  }
}
