:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #dfe4eb;
  --line-strong: #cbd4df;
  --text: #26313f;
  --muted: #718096;
  --teal: #95ddd8;
  --teal-strong: #69bea7;
  --salmon: #f2a08e;
  --cream: #f7ecd6;
  --rest: #f1f1f3;
  --accent: #2f6fbb;
  --danger: #dc3f5c;
  --shadow: 0 16px 48px rgba(31, 41, 55, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body.auth-gated .app-shell {
  display: none;
}

.app-notice {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 28px));
  border: 1px solid rgba(105, 190, 167, 0.45);
  border-radius: 8px;
  background: #f0fbf8;
  color: #266a5d;
  padding: 12px 16px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.app-notice.error {
  border-color: rgba(220, 63, 92, 0.42);
  background: #fff1f4;
  color: #a52b42;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand-block h1,
.dialog-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow,
.control-label,
.toolbar span,
.stats-strip span,
.shift-meta {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.week-control,
.segmented-control,
.toolbar,
.stats-strip,
.schedule-shell {
  border: 1px solid var(--line);
  background: var(--surface);
}

.week-control {
  display: grid;
  grid-template-columns: 36px auto 36px;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: 8px;
}

.week-control strong {
  display: block;
  min-width: 178px;
  font-size: 14px;
  text-align: center;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.segmented-control {
  display: flex;
  padding: 4px;
  border-radius: 8px;
}

.segment {
  min-width: 142px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--accent);
  color: #fff;
}

.toolbar {
  position: sticky;
  top: 73px;
  z-index: 9;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(160px, 220px) auto auto auto auto auto auto auto auto 1fr;
  align-items: end;
  gap: 14px;
  border-top: 0;
  border-left: 0;
  border-right: 0;
}

.account-bar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 320px) 1fr auto auto;
  gap: 14px;
  align-items: end;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-top: 0;
  border-left: 0;
  border-right: 0;
  background: var(--surface);
}

.account-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.week-publication {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.week-publication span {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.week-publication.published span {
  border-color: rgba(105, 190, 167, 0.45);
  background: rgba(105, 190, 167, 0.16);
  color: #2f806e;
}

.week-publication select {
  min-width: 112px;
}

.manager-only-hidden {
  display: none !important;
}

body.employee-mode .toolbar,
body.employee-mode #weekPublication,
body.employee-mode #managerDashboard,
body.employee-mode #managerRequests,
body.employee-mode .shift-actions,
body.employee-mode .add-cell-shift {
  display: none !important;
}

.search-field,
.select-field,
.form-grid label {
  display: grid;
  gap: 6px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 187, 0.14);
}

.primary-button,
.primary-link-button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button,
.primary-link-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-button span {
  display: inline;
  color: inherit;
  margin-right: 8px;
  font-size: 18px;
  line-height: 1;
}

.ghost-button {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
}

.main-grid {
  min-width: 0;
  padding: 14px 16px 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.manager-dashboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.dashboard-card {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
}

.dashboard-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-card strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.dashboard-card.wide strong {
  font-size: 15px;
}

.dashboard-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-actions button {
  min-height: 44px;
}

.employee-portal,
.manager-requests {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

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

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

.portal-head h2 {
  margin: 0;
  font-size: 20px;
}

.request-list {
  display: grid;
  gap: 8px;
}

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

.attendance-card.active {
  border-color: rgba(105, 190, 167, 0.58);
  background: rgba(105, 190, 167, 0.12);
}

.attendance-card span,
.attendance-card small,
.attendance-row span,
.attendance-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.attendance-card strong {
  display: block;
  margin: 2px 0;
  font-size: 18px;
}

.attendance-mini-list {
  display: grid;
  gap: 4px;
  justify-items: end;
}

.next-shift-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(52, 113, 197, 0.24);
  border-radius: 8px;
  background: #eef5ff;
  padding: 12px;
}

.next-shift-card span,
.next-shift-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.next-shift-card strong {
  display: block;
  margin: 2px 0;
  font-size: 18px;
}

.scan-qr-button {
  margin-top: 4px;
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}

.qr-scan-panel {
  display: grid;
  gap: 12px;
}

.qr-scan-panel video {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  object-fit: cover;
}

.qr-scan-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

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

.attendance-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.attendance-filters {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.2fr 1fr 1fr;
  gap: 10px;
}

.attendance-filters label {
  display: grid;
  gap: 6px;
}

.attendance-filters span,
.attendance-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.attendance-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.attendance-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.monthly-summary {
  display: grid;
  gap: 8px;
}

.monthly-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.monthly-summary-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.monthly-summary-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 0.6fr 0.6fr 0.6fr;
}

.monthly-summary-row div {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.monthly-summary-row:last-child div {
  border-bottom: 0;
}

.monthly-summary-row.head {
  background: #f3f6fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.monthly-summary-row.open {
  background: #fff7e6;
}

.attendance-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.attendance-sheet {
  min-width: 900px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.attendance-sheet-head,
.attendance-sheet-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 1fr 0.7fr 0.7fr 0.6fr 0.8fr 1fr;
  gap: 0;
  align-items: center;
}

.attendance-sheet-head {
  background: #f3f6fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.attendance-sheet-head div,
.attendance-sheet-row div {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.attendance-sheet-row:last-child div {
  border-bottom: 0;
}

.attendance-sheet-row.open {
  background: #fff7e6;
}

.attendance-sheet-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.attendance-sheet-row.open span {
  border-color: rgba(216, 166, 42, 0.45);
  background: rgba(216, 166, 42, 0.16);
  color: #8a620d;
}

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

.mini-action {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 900;
}

.attendance-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.attendance-row.in {
  border-left-color: var(--teal-strong);
}

.attendance-row.out {
  border-left-color: var(--danger);
}

.employee-mobile-schedule {
  display: grid;
  gap: 10px;
}

.mobile-employee-summary,
.mobile-day-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mobile-employee-summary {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.mobile-employee-summary strong,
.mobile-employee-summary span {
  display: block;
}

.mobile-employee-summary span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.mobile-day-card {
  padding: 10px;
}

.mobile-day-card.today {
  border-color: rgba(220, 63, 92, 0.4);
}

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

.mobile-day-head strong {
  font-size: 16px;
}

.mobile-day-head span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.request-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.request-row span,
.request-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.request-pending {
  border-left: 4px solid #d8a62a;
}

.request-approved {
  border-left: 4px solid var(--teal-strong);
}

.request-rejected {
  border-left: 4px solid var(--danger);
}

.request-actions {
  display: flex;
  gap: 8px;
}

.empty-state {
  color: var(--muted);
  padding: 8px 0;
  font-size: 14px;
}

.unpublished-notice {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 18px;
  font-weight: 800;
}

.login-hint,
.login-error {
  margin: 14px 0 0;
  font-size: 13px;
}

.login-hint {
  color: var(--muted);
}

.login-error {
  color: var(--danger);
  font-weight: 800;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  border-radius: 8px;
  overflow: hidden;
}

.stats-strip div {
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}

.stats-strip div:last-child {
  border-right: 0;
}

.stats-strip strong {
  font-size: 20px;
}

.schedule-shell {
  min-height: 0;
  overflow: auto;
  border-radius: 8px;
}

.schedule-view {
  min-width: 100%;
}

.hidden {
  display: none;
}

.employee-grid {
  display: grid;
  grid-template-columns: 220px repeat(7, minmax(145px, 1fr));
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(175px, 1fr));
}

.grid-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: contents;
}

.header-cell,
.employee-cell,
.schedule-cell,
.day-column {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.header-cell {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: #7b8798;
  font-size: 14px;
  font-weight: 800;
}

.header-cell:first-child {
  justify-content: flex-start;
  padding-left: 16px;
}

.today-pill {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
}

.employee-row {
  display: contents;
}

.employee-cell {
  min-height: 92px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-content: start;
  padding: 12px 10px;
  background: #fff;
}

.avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.employee-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 850;
}

.employee-role {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.employee-hours {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.employee-hours strong {
  color: var(--text);
}

.schedule-cell {
  position: relative;
  min-height: 92px;
  padding: 5px 5px 34px;
  background: #fff;
}

.schedule-cell .shift-card + .shift-card {
  margin-top: 5px;
}

.schedule-cell .request-card-inline,
.day-column .request-card-inline {
  margin-top: 5px;
}

.add-cell-shift {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  box-shadow: 0 6px 18px rgba(31, 41, 55, 0.1);
}

.schedule-cell:hover .add-cell-shift,
.add-cell-shift:focus-visible {
  opacity: 1;
}

.empty-cell .add-cell-shift {
  opacity: 1;
}

.shift-card {
  position: relative;
  min-height: 58px;
  height: 100%;
  border-radius: 6px;
  padding: 8px;
  overflow: hidden;
  color: #233240;
  line-height: 1.06;
  cursor: grab;
  transition: box-shadow 140ms ease, transform 140ms ease, outline-color 140ms ease;
}

.employee-mode .shift-card {
  height: auto;
  cursor: default;
}

.employee-mode .shift-card:active {
  cursor: default;
}

.shift-card:active {
  cursor: grabbing;
}

.shift-card.dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

.shift-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 6px;
}

.shift-card strong {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
  min-width: 0;
}

.shift-card p {
  margin: 0;
  font-size: 13px;
}

.shift-card small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

.shift-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.copy-shift,
.delete-shift {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(35, 50, 64, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.36);
  color: #233240;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
}

.shift-card:hover .copy-shift,
.shift-card:hover .delete-shift,
.copy-shift:focus-visible,
.delete-shift:focus-visible {
  opacity: 1;
}

.delete-shift {
  font-size: 18px;
}

.delete-shift:hover {
  border-color: rgba(156, 35, 56, 0.45);
  background: rgba(255, 255, 255, 0.58);
  color: #9c2338;
}

.active-drop {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
  background: #edf5ff;
}

.shift-day {
  background: var(--teal);
}

.shift-open {
  background: var(--teal-strong);
}

.shift-evening {
  background: var(--salmon);
}

.shift-rest {
  background: var(--rest);
}

.shift-leave {
  background: var(--cream);
}

.day-view-inner {
  display: grid;
  grid-template-rows: 42px 1fr;
}

.day-column {
  min-height: calc(100vh - 180px);
  padding: 6px;
  background: #fff;
}

.day-column.today {
  background: #f4fbfd;
}

.day-column .shift-card {
  height: auto;
  min-height: 64px;
  margin-bottom: 6px;
}

.day-empty {
  color: var(--muted);
  padding: 16px 8px;
  font-size: 13px;
}

.shift-dialog {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  box-shadow: var(--shadow);
}

.wide-dialog {
  width: min(920px, calc(100vw - 32px));
}

.shift-dialog::backdrop {
  background: rgba(20, 28, 38, 0.32);
}

.shift-dialog form {
  padding: 20px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.form-grid label:last-child {
  grid-column: 1 / -1;
}

.form-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.split-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
}

.danger-button {
  border: 1px solid rgba(220, 63, 92, 0.32);
  border-radius: 8px;
  background: #fff;
  color: var(--danger);
  font-weight: 900;
}

.employee-manager {
  display: grid;
  gap: 16px;
}

.copy-panel {
  display: grid;
  gap: 16px;
}

.backup-panel {
  display: grid;
  gap: 12px;
}

.notification-panel {
  display: grid;
  gap: 14px;
}

.intermittenti-panel {
  display: grid;
  gap: 14px;
}

.intermittenti-preview {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.intermittenti-table {
  min-width: 780px;
}

.intermittenti-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.7fr 0.7fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

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

.intermittenti-row.head {
  background: #f3f6fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.intermittenti-row div {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 10px;
}

.intermittenti-row.muted-row {
  background: #fff7e6;
}

.missing-value {
  color: var(--danger);
  font-weight: 900;
}

.print-panel {
  display: grid;
  gap: 14px;
}

.print-preview-shell {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
  padding: 14px;
}

.print-preview {
  width: min(820px, 100%);
  margin: 0 auto;
  background: #fff;
  color: #1f2937;
  padding: 24px;
  border-radius: 4px;
  box-shadow: 0 10px 28px rgba(31, 41, 55, 0.12);
}

.print-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  border-bottom: 2px solid #1f2937;
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.print-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.print-head p,
.print-meta {
  margin: 0;
  color: #5f6b7a;
  font-size: 13px;
}

.print-day-section {
  break-inside: avoid;
  margin-top: 16px;
}

.print-day-section h3 {
  margin: 0 0 8px;
  border-bottom: 1px solid #d7dee8;
  padding-bottom: 6px;
  font-size: 17px;
}

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

.print-shift-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid #dbe3ee;
  border-left: 5px solid #69bea7;
  border-radius: 6px;
  padding: 9px 10px;
  break-inside: avoid;
}

.print-shift-time {
  color: #1f2937;
  font-size: 13px;
  font-weight: 900;
}

.print-shift-card strong,
.print-shift-card span,
.print-shift-card small {
  display: block;
}

.print-shift-card strong {
  font-size: 14px;
}

.print-shift-card span,
.print-shift-card small {
  color: #5f6b7a;
  font-size: 12px;
  margin-top: 2px;
}

.print-empty {
  color: #718096;
  border: 1px dashed #cbd4df;
  border-radius: 6px;
  padding: 10px;
  font-size: 13px;
}

.totem-body {
  min-height: 100vh;
  background: #eef2f7;
}

.totem-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.totem-panel {
  width: min(760px, 100%);
  display: grid;
  justify-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: clamp(24px, 5vw, 52px);
  text-align: center;
  box-shadow: var(--shadow);
}

.totem-panel h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
}

.totem-clock {
  margin: 0;
  color: var(--accent);
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 900;
}

.qr-frame {
  width: min(420px, 78vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.totem-status strong,
.totem-status span,
.totem-code {
  display: block;
}

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

.totem-status span,
.totem-code {
  color: var(--muted);
  font-weight: 800;
}

.compact-actions {
  margin-top: 0;
}

.notification-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
}

.notification-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.notification-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.notification-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.notification-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.notification-row-head strong,
.notification-row-head span {
  display: block;
}

.notification-row-head span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.notice-status {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.notice-status.sent {
  border-color: rgba(105, 190, 167, 0.5);
  background: rgba(105, 190, 167, 0.16);
  color: #2f806e;
}

.notification-message {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  padding: 10px;
  line-height: 1.35;
}

.backup-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.backup-list {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.backup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

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

.backup-row strong,
.backup-row span {
  display: block;
}

.backup-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.history-panel {
  display: grid;
  gap: 14px;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.history-row strong,
.history-row span,
.history-row em,
.history-row small {
  display: block;
}

.history-row span,
.history-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.history-row em {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.request-calendar {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.request-calendar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.request-calendar-head strong {
  color: var(--text);
}

.request-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.request-day-card {
  min-height: 92px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px;
  text-align: left;
}

.request-day-card strong,
.request-day-card span {
  display: block;
}

.request-day-card strong {
  margin-bottom: 6px;
  font-size: 13px;
}

.request-day-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.request-day-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 187, 0.14);
}

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

.copy-mode label,
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.copy-mode input,
.checkbox-field input {
  width: auto;
  margin: 0;
}

.employee-list {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.employee-list-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

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

.employee-list-row strong,
.employee-list-row span {
  display: block;
}

.employee-list-row span {
  color: var(--muted);
  font-size: 12px;
}

.employee-form-actions {
  display: flex;
  gap: 10px;
}

.employee-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-employee,
.reset-pin-employee,
.delete-employee {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
}

.edit-employee,
.reset-pin-employee {
  width: auto;
  min-width: 76px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.reset-pin-employee {
  min-width: 84px;
}

.delete-employee {
  border: 1px solid rgba(156, 35, 56, 0.3);
  border-radius: 6px;
  background: #fff;
  color: #9c2338;
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .account-bar {
    grid-template-columns: 1fr;
  }

  .toolbar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr auto auto auto auto auto auto auto auto;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .manager-dashboard {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

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

  .schedule-view {
    min-width: 1080px;
  }

  .employee-mode .schedule-view {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .topbar,
  .main-grid {
    padding-left: 10px;
    padding-right: 10px;
  }

  .employee-mode .topbar {
    gap: 10px;
  }

  .employee-mode .segmented-control {
    display: none;
  }

  .employee-mode .account-bar {
    padding: 10px;
  }

  .employee-mode .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-mode .stats-strip div {
    padding: 10px;
  }

  .employee-mode .stats-strip strong {
    font-size: 18px;
  }

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

  .next-shift-card {
    grid-template-columns: 1fr;
  }

  .employee-mode .schedule-shell {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .manager-dashboard {
    grid-template-columns: 1fr;
  }

  .stats-strip div {
    border-right: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .portal-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .portal-actions,
  .portal-actions .primary-button,
  .portal-actions .ghost-button {
    width: 100%;
  }

  .notification-row-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .notification-actions,
  .notification-actions .ghost-button {
    width: 100%;
  }

  .print-preview {
    padding: 16px;
  }

  .print-head {
    display: grid;
  }

  .request-row {
    grid-template-columns: 1fr;
  }

  .request-calendar-grid {
    grid-template-columns: 1fr;
  }

  .attendance-filters,
  .attendance-summary {
    grid-template-columns: 1fr;
  }

  .segment {
    min-width: 0;
    flex: 1;
  }
}

@media print {
  body {
    background: #fff;
  }

  body * {
    visibility: hidden;
  }

  body.printing-attendance #attendanceDialog,
  body.printing-attendance #attendanceDialog *,
  body.printing-attendance-summary #attendanceDialog,
  body.printing-attendance-summary #attendanceDialog * {
    visibility: visible;
  }

  body.printing-attendance #attendanceDialog,
  body.printing-attendance-summary #attendanceDialog {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    max-width: none;
    border: 0;
    box-shadow: none;
  }

  body.printing-attendance #attendanceDialog form,
  body.printing-attendance-summary #attendanceDialog form {
    padding: 0;
  }

  body.printing-attendance #attendanceDialog::backdrop,
  body.printing-attendance .dialog-head button,
  body.printing-attendance .attendance-tools,
  body.printing-attendance .attendance-filters,
  body.printing-attendance-summary #attendanceDialog::backdrop,
  body.printing-attendance-summary .dialog-head button,
  body.printing-attendance-summary .attendance-tools,
  body.printing-attendance-summary .attendance-filters,
  body.printing-attendance-summary .attendance-list {
    display: none !important;
  }

  body.printing-attendance .attendance-list {
    max-height: none;
    overflow: visible;
  }

  body.printing-attendance .attendance-sheet {
    min-width: 0;
    border-color: #111827;
  }

  body.printing-attendance .attendance-sheet-head,
  body.printing-attendance .attendance-sheet-row {
    grid-template-columns: 1.5fr 1fr 0.7fr 0.7fr 0.6fr 0.8fr;
  }

  body.printing-attendance .attendance-sheet-head div:last-child,
  body.printing-attendance .attendance-sheet-row div:last-child {
    display: none;
  }

  body.printing-attendance-summary .monthly-summary {
    display: grid;
  }

  body.printing-attendance-summary .monthly-summary-row {
    grid-template-columns: 1.5fr 0.7fr 0.7fr 0.7fr;
  }

  #printPreview,
  #printPreview * {
    visibility: visible;
  }

  #printPreview {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .print-preview-shell {
    border: 0;
    padding: 0;
    overflow: visible;
  }
}

.request-card-inline {
  min-height: 56px;
  border: 1px dashed rgba(47, 111, 187, 0.5);
  border-radius: 6px;
  padding: 8px;
  background: #f6f9ff;
  color: var(--text);
  line-height: 1.08;
}

.request-card-inline strong,
.request-card-inline p,
.request-card-inline small {
  display: block;
  margin: 0;
}

.request-card-inline strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.request-card-inline p,
.request-card-inline small {
  color: var(--muted);
  font-size: 12px;
}

.request-card-inline.request-approved {
  border-color: rgba(105, 190, 167, 0.75);
  background: #effaf7;
}

.request-card-inline.request-rejected {
  border-color: rgba(220, 63, 92, 0.55);
  background: #fff3f5;
}
