﻿:root {
  --bg: #eef4f8;
  --bg-gradient: linear-gradient(180deg, #f9fbfd 0%, #ecf2f7 100%);
  --sidebar-bg: linear-gradient(180deg, #153845 0%, #102732 100%);
  --panel: rgba(255, 255, 255, 0.98);
  --border: #d7e2eb;
  --text: #17313b;
  --muted: #647784;
  --accent: #1d6f8c;
  --accent-strong: #154f66;
  --success-bg: #f3fbf5;
  --success-line: #59a87b;
  --empty-bg: #f7fafc;
  --empty-line: #c7d2db;
  --warning-bg: #fff7ec;
  --warning-line: #dca03d;
  --shadow: 0 16px 42px rgba(16, 38, 46, 0.08);
  --shadow-soft: 0 8px 20px rgba(16, 38, 46, 0.06);
  font-family: "Bahnschrift", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(29, 111, 140, 0.10), transparent 24%), var(--bg-gradient);
}
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.danger { color: #c14b39; font-weight: 700; }

button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(180deg, #1e7391 0%, #165a72 100%);
  color: #fff;
  font-weight: 700;
  padding: 11px 16px;
  box-shadow: 0 10px 18px rgba(17, 69, 88, 0.14);
}
button:hover { transform: translateY(-1px); }
button.ghost, .icon-button.ghost {
  background: #f4f8fb;
  color: var(--accent-strong);
  border: 1px solid #bfd1dd;
  box-shadow: none;
}
button.icon-add { width: 42px; min-width: 42px; height: 42px; padding: 0; font-size: 1.45rem; }

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #c9d8e4;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: #7cb2ca;
  box-shadow: 0 0 0 4px rgba(29, 111, 140, 0.12);
}
textarea { resize: vertical; }
label { display: grid; gap: 8px; min-width: 0; font-weight: 700; }
.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.checkbox input { width: 18px; height: 18px; margin: 0; }

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .74rem;
  font-weight: 700;
  color: rgba(255,255,255,.72);
}
.accent { color: var(--accent-strong); }

.auth-locked .shell { display: none; }
.auth-gate {
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,.98);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(16, 38, 46, 0.16);
  padding: 28px;
  display: grid;
  gap: 14px;
}
.auth-card h2 { margin: 0; font-size: 2rem; letter-spacing: -.03em; }
.auth-error, .form-error {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff0ed;
  color: #a33d2e;
  border: 1px solid #efc2ba;
  font-weight: 700;
}

.shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
}
.sidebar {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid rgba(255,255,255,.08);
}
.sidebar h1, .hero h2, .card h2, .card h3, .card h4, .print-header h2 { margin: 0; }
.sidebar h1 { font-size: 2.05rem; line-height: 1.04; letter-spacing: -.03em; }
.sidebar-muted, .sidebar-card { color: rgba(255,255,255,.84); }
.sidebar .sidebar-card {
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  color: rgba(255,255,255,.84) !important;
  box-shadow: none;
}
.sidebar .sidebar-card h2,
.sidebar .sidebar-card p { color: inherit; }

.nav { display: flex; flex-direction: column; gap: 10px; }
.nav-link {
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 700;
}
.nav-link:hover { background: rgba(255,255,255,.14); }
.nav-link.active {
  background: rgba(255,255,255,.2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.content { padding: 24px; min-width: 0; }
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.hero h2 { font-size: 1.9rem; letter-spacing: -.03em; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}
.hero-actions > input[type="date"] { width: 170px; }

.week-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255,255,255,.74);
  border: 1px solid #d2e0ea;
  box-shadow: var(--shadow-soft);
}
.icon-button {
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1.2rem;
}
.week-indicator {
  min-width: 124px;
  text-align: center;
  font-weight: 800;
  color: var(--accent-strong);
}

.view { display: none; }
.view.active { display: block; }
.card, .print-sheet, .cell-editor {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.card { padding: 20px; }
.slim-card { padding: 16px 18px; }
.narrow-card { max-width: 960px; }
.print-sheet { padding: 18px; }

.grid.two-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 18px;
  align-items: start;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.list-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.leaves-head { margin-bottom: 12px; }
.leaves-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 10px;
}
.leaves-toolbar-search .search-input {
  width: 100%;
}
.leaves-toolbar-filters {
  display: grid;
  grid-template-columns: auto minmax(150px, 180px) minmax(180px, 220px) auto;
  gap: 12px;
  align-items: center;
}
.leaves-filter,
.leaves-date {
  width: 100%;
}
.leaves-calendar-button {
  white-space: nowrap;
}
.leaves-help {
  margin: 6px 0 14px;
}
.search-input { min-width: 180px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.danger-button { border-color: #efc1ba !important; color: #a33d2e !important; background: #fff4f1 !important; }
.danger-button:hover { background: #ffe9e4 !important; }
.color-field { display: flex; align-items: center; }
.color-field input[type="color"] {
  width: 56px;
  min-width: 56px;
  height: 42px;
  padding: 4px;
  border-radius: 12px;
}
.field-combo { display: grid; gap: 8px; }

.employee-panel {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fb 100%);
}
.employee-panel-head { display: grid; gap: 4px; margin-bottom: 12px; }
.field-label { font-weight: 800; }
.post-zone { display: grid; gap: 10px; }
.post-zone-title {
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #567182;
}
.post-zone-grid, .post-checklist { display: grid; gap: 10px; }
.post-option-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 14px 16px 14px 48px;
  border: 1px solid #d4e0ea;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
}
.post-option-card::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid #c0cfdb;
  transform: translateY(-50%);
  background: #fff;
}
.post-option-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.post-option-card.selected {
  border-color: #69a7c2;
  background: linear-gradient(180deg, #f1f9fd 0%, #e8f4fb 100%);
  box-shadow: 0 10px 18px rgba(28, 95, 124, 0.08);
}
.post-option-card.selected::before {
  background: linear-gradient(180deg, #1e7391 0%, #165a72 100%);
  border-color: #1a6985;
  box-shadow: inset 0 0 0 4px #eaf6fb;
}
.post-option-card-main { font-weight: 800; line-height: 1.25; }
.post-option-card-meta { color: #6f8694; font-size: .9rem; }

.weekday-checklist { display: flex; flex-wrap: wrap; gap: 10px; }
.weekday-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #d4e0ea;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}
.weekday-chip input { width: 16px; height: 16px; margin: 0; }
.weekday-chip.selected {
  background: #eef7fc;
  border-color: #7db1c9;
  color: var(--accent-strong);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid #deebf3;
  vertical-align: top;
}
thead th {
  background: #eef5f9;
  color: #506877;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions button { padding: 8px 12px; font-size: .9rem; }

.week-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.week-toolbar-legend, .legend-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.legend-grid { margin-top: 16px; }
.legend-chip, .leave-badge, .leave-status, .assignment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.legend-chip.available, .assignment-cell.filled .assignment-badge { background: #e8f6ee; color: #2d704a; }
.legend-chip.empty, .assignment-cell.empty .assignment-badge { background: #f2f5f8; color: #70818e; }
.legend-chip.alert, .assignment-cell.has-conflict .assignment-badge { background: #fff1dc; color: #955d05; }

.print-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.print-header h2 { font-size: 1.6rem; }
.print-meta { text-align: right; color: #506877; font-weight: 700; }
.print-mode-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef5fb;
  color: var(--accent-strong);
  font-weight: 800;
  font-size: .8rem;
  margin-bottom: 8px;
}

.week-table {
  min-width: 1160px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
}
.week-table th, .week-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #dbe8f0;
  border-right: 1px solid #dbe8f0;
}
.week-table th:last-child, .week-table td:last-child { border-right: 0; }
.week-table thead th:nth-child(4) { background: #e7f4fb; }
.week-table thead th:nth-child(5) { background: #edf7fb; }
.week-table thead th:nth-child(6) { background: #e8f7f1; }
.week-table thead th:nth-child(7) { background: #fff5e8; }
.week-table thead th:nth-child(8) { background: #f4eefc; }
.week-table tbody td:nth-child(4) { background: #f6fbfe; }
.week-table tbody td:nth-child(5) { background: #eef6fb; }
.week-table tbody td:nth-child(6) { background: #f6fbfe; }
.week-table tbody td:nth-child(7) { background: #eef6fb; }
.week-table tbody td:nth-child(8) { background: #f6fbfe; }
.post-col { width: 350px; }
.hours-col, .break-col { width: 122px; }
.day-col { width: 140px; }
.zone-row th {
  background: linear-gradient(90deg, #d8ebf2 0%, #eef7fa 100%) !important;
  color: #365568;
  font-size: .82rem;
  text-align: left;
  font-weight: 900;
  letter-spacing: .08em;
}
.time-cell { text-align: center; cursor: pointer; }
.time-pill {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 90px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .82rem;
}
.time-empty { color: #8da0ac; }
.assignment-cell {
  position: relative;
  min-height: 92px;
  background: var(--empty-bg) !important;
  box-shadow: inset 4px 0 0 var(--empty-line);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, outline-color .12s ease;
}
.assignment-cell.filled {
  background: var(--success-bg) !important;
  box-shadow: inset 4px 0 0 var(--success-line);
}
.assignment-cell.has-conflict {
  background: var(--warning-bg) !important;
  box-shadow: inset 4px 0 0 var(--warning-line);
}
.assignment-cell:hover {
  transform: translateY(-1px);
  box-shadow: inset 4px 0 0 var(--success-line), 0 8px 18px rgba(17, 69, 88, 0.08);
}
.assignment-cell.drag-source {
  opacity: .28;
  transform: scale(.985);
}
.assignment-cell.drag-target {
  outline: 2px dashed var(--accent);
  outline-offset: -3px;
  box-shadow: inset 4px 0 0 var(--accent), 0 0 0 2px rgba(30,115,145,.12);
}
body.assignment-dragging,
body.assignment-dragging * {
  user-select: none !important;
  -webkit-user-select: none !important;
}
body.assignment-dragging .assignment-cell {
  cursor: grabbing;
}
.assignment-topline { margin-bottom: 8px; }
.assignment-main {
  padding-left: 8px;
  font-weight: 900;
  line-height: 1.24;
  font-size: 1rem;
}
.assignment-empty {
  padding-left: 8px;
  color: #8a9aa5;
  font-style: italic;
  font-weight: 700;
}
}
.assignment-notes, .assignment-leave {
  margin-top: 6px;
  padding-left: 8px;
  font-size: .83rem;
  color: #617784;
}
.assignment-leave { color: #945d04; font-weight: 700; }
.drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-10px, -10px) rotate(-2deg);
  width: 160px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid #8eb6c9;
  background: rgba(255,255,255,.98);
  box-shadow: 0 18px 32px rgba(17, 69, 88, 0.22);
}
.absence-summary td:first-child { background: #ff8b8b !important; font-size: 1rem; font-weight: 900; text-align: center; color: #16384d; }
.absence-row-cell { background: #dff4e5 !important; color: #513f0f; font-weight: 800; white-space: pre-line; }
.absence-row-cell.sick { background: #ffe6d6 !important; color: #8a2f00; }
.absence-summary td:first-child + td, .absence-summary td:first-child + td + td, .absence-summary td:first-child + td + td + td, .absence-summary td:first-child + td + td + td + td, .absence-summary td:first-child + td + td + td + td + td { }
  .absence-empty { color: #99a8b3; }

.leave-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #e6eef4;
}
.leave-item:last-child { border-bottom: 0; }
.leave-badge.leave, .leave-status.approved { background: #e9f7ef; color: #296645; }
.leave-badge.sick { background: #fff2e8; color: #965018; }
.leave-badge.training { background: #eef3ff; color: #34579a; }
.leave-badge.other, .leave-status.pending { background: #f3f0ff; color: #5b4ba2; }
.leave-status.rejected { background: #feecec; color: #a63d3d; }
.table-meta, .empty-state { padding: 12px 14px; }

.manager-print-panel,
#managerPrintPanel.hidden { display: none !important; }
.manager-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.manager-summary-card, .manager-absence-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  background: #fff;
}
.manager-summary-card { display: grid; gap: 4px; }
.manager-summary-card strong { font-size: 1.6rem; }
.manager-note-row td { background: #fbfcfd; color: #576c79; font-style: italic; }

.settings-security {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fb 100%);
}
.settings-security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.password-decoy {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.cell-editor {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 18px;
  z-index: 200;
}
.cell-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.editor-form { display: grid; gap: 12px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  min-width: 220px;
  max-width: min(90vw, 560px);
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(20,41,52,.94);
  color: #fff;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 300;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.leave-calendar-card { display: grid; gap: 16px; }
.leave-calendar-head { margin-bottom: 0; }
.leave-calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.leave-month-indicator { min-width: 190px; }
.leave-calendar-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.leave-calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f7fbfd;
  border: 1px solid #d7e4ed;
  border-radius: 999px;
}
.leave-calendar-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 5px 9px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .78rem;
}
.leave-calendar-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}
.leave-calendar-table {
  min-width: 1200px;
  border-collapse: separate;
  border-spacing: 0;
}
.leave-calendar-table th, .leave-calendar-table td {
  padding: 6px 8px;
  border-right: 1px solid #dbe8f0;
  border-bottom: 1px solid #dbe8f0;
  text-align: center;
}
.leave-calendar-corner, .leave-calendar-name, .leave-calendar-total-label {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
}
.leave-calendar-corner, .leave-calendar-name { min-width: 210px; text-align: left; font-weight: 700; }
.leave-calendar-day { min-width: 38px; background: #eef5f9; }
.leave-calendar-day span, .leave-calendar-day small { display: block; }
.leave-calendar-day.weekend, .leave-calendar-cell.weekend { background: #f0f2f5; }
.leave-calendar-cell { height: 32px; font-weight: 800; }
.leave-calendar-total { background: #fff7d1; font-weight: 900; }
.leave-ca { background: #f44336 !important; color: #fff; }
.leave-ar { background: #1ea44c !important; color: #fff; }
.leave-rtt { background: #7b3cc2 !important; color: #fff; }
.leave-recup { background: #19bce0 !important; color: #073644; }
.leave-frac { background: #fff028 !important; color: #5b4d00; }
.leave-formation { background: #d1a300 !important; color: #fff; }
.leave-ferie { background: #111 !important; color: #fff; }
.leave-vm { background: #ffb21c !important; color: #3e2a00; }
.leave-other { background: #9eb1bf !important; color: #fff; }

#leaveForm label, #leaveForm select, #leaveForm input, #leaveForm textarea { min-width: 0; }
#leaveCategory, #leaveType { max-width: 100%; }

@media (max-width: 1280px) {
  .shell { grid-template-columns: 250px minmax(0, 1fr); }
  .grid.two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { gap: 18px; }
  .hero, .week-toolbar, .print-header, .section-head { flex-direction: column; align-items: stretch; }
  .hero-actions, .list-tools, .leave-calendar-toolbar { justify-content: flex-start; }
  .leaves-toolbar-filters { grid-template-columns: 1fr; }
  .leaves-calendar-button { width: 100%; }
  .form-grid, .settings-security-grid { grid-template-columns: 1fr; }
  .cell-editor { right: 12px; left: 12px; width: auto; bottom: 12px; }
}

@media print {
  @page { size: landscape; margin: 0mm; }
  body { background: #fff; }
  body * { visibility: hidden !important; }
  #printSheet, #printSheet * { visibility: visible !important; }
  #printSheet {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      margin: 0;
      padding: 0 2.5mm;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      border: 0;
      box-shadow: none;
      background: #fff;
    }

  .no-print, .sidebar, .hero, .week-toolbar, .cell-editor, .toast { display: none !important; }
  .print-mode-label { display: inline-flex !important; }
  #managerPrintPanel, .manager-print-panel, .legend-grid, #weekLeaves { display: none !important; }
  

  .print-header { margin-bottom: 2px; }
  .print-header h2 { font-size: 1.04rem; line-height: 1.02; }
  .print-mode-label, .print-meta, .print-subtitle { font-size: .58rem; line-height: 1.05; }
    .print-mode-label { margin-bottom: 2px; padding: 3px 8px; border-radius: 999px; background: #edf4fb; color: #27506a; font-weight: 800; letter-spacing: .08em; }

   .week-table {
      min-width: 0;
      width: 100%;
      table-layout: fixed;
      font-size: 9.4px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #c8dbe7;
  }
  .week-table th, .week-table td { padding: 2px 1px; border-right: 1px solid #d4e4ed; border-bottom: 1px solid #d4e4ed; }
    .absence-summary td { padding-top: 2px; padding-bottom: 2px; }
  .week-table th:nth-child(1), .week-table td:nth-child(1) { width: 17.6%; }
    .week-table th:nth-child(2), .week-table td:nth-child(2) { width: 4.3%; }
    .week-table th:nth-child(3), .week-table td:nth-child(3) { width: 4.3%; }
    .week-table th:nth-child(4), .week-table td:nth-child(4), .week-table th:nth-child(5), .week-table td:nth-child(5), .week-table th:nth-child(6), .week-table td:nth-child(6), .week-table th:nth-child(7), .week-table td:nth-child(7), .week-table th:nth-child(8), .week-table td:nth-child(8) { width: 14.76%; }

  .zone-row th {
    background: linear-gradient(90deg, #d9edf7 0%, #eff7fb 100%) !important;
    color: #3c6278;
    font-size: .64rem;
      font-weight: 900;
      letter-spacing: .07em;
      padding: 3px 6px !important;
  }

   .assignment-cell {
      min-height: 24px;
    border-radius: 12px;
    background: #f7fbfd !important;
    box-shadow: inset 4px 0 0 var(--empty-line), inset 0 0 0 1px #dce8ef;
    overflow: hidden;
  }
  .assignment-cell.filled {
    background: #edf8f1 !important;
    box-shadow: inset 4px 0 0 #5ab77b, inset 0 0 0 1px #d8e8df;
  }
  .assignment-cell.has-conflict {
    background: #fff7ef !important;
    box-shadow: inset 4px 0 0 #e0a353, inset 0 0 0 1px #eedfcd;
  }
  .assignment-topline, .assignment-notes, .assignment-leave, td > .small.muted { display: none !important; }
  .assignment-main, .assignment-empty {
    display: block;
    padding: 3px 6px 3px 8px;
    font-size: 9.4px;
      line-height: 1.12;
      font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .assignment-empty {
      color: #8fa0ac;
      font-style: italic;
    }
    .assignment-pill {
      display: block;
      width: 100%;
      padding: 3px 6px 3px 8px;
      font-size: 9.4px;
      line-height: 1.12;
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      border-radius: 999px;
    }
    .post-cell {
      font-size: 7.8px;
      line-height: 1.08;
      font-weight: 700;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  .week-table td:first-child strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 7.1px;
    line-height: 1.04;
  }
  .week-table td:first-child .muted { display: none !important; }
   .time-pill {
      min-width: 0;
      padding: 2px 5px;
      font-size: 6.2px;
    border-radius: 999px;
    font-weight: 800;
  }

  body[data-print-mode="team"] .absence-summary { display: none !important; }
  body[data-print-mode="manager"] .absence-summary { display: table-row !important; }
  body[data-print-mode="manager"] .week-table { font-size: 8px; }
  body[data-print-mode="manager"] .assignment-pill { font-size: 8.7px; padding: 3px 5px 3px 7px; }
  body[data-print-mode="manager"] .absence-summary td:first-child { font-size: .86rem; }
  body[data-print-mode="manager"] .absence-row-cell { font-size: 7.8px; }
}









.leave-calendar-cell.has-leave {
  cursor: grab;
}
.leave-calendar-cell.drag-source {
  opacity: .45;
}
.leave-calendar-cell.drag-target {
  outline: 2px dashed #1f6f9a;
  outline-offset: -2px;
}
.leave-calendar-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(17, 69, 88, 0.2);
  border: 1px solid rgba(17, 69, 88, 0.12);
  background: #ffffff;
  color: #1f2f38;
  font-weight: 800;
  font-size: .82rem;
}
.leave-calendar-card {
  position: relative;
}
.leave-calendar-editor {
  position: fixed;
  right: 24px;
  top: 110px;
  bottom: 12px;
  width: min(430px, calc(100vw - 32px));
  overflow: auto;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  z-index: 230;
}
.leave-calendar-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 1080px) {
  .leave-calendar-editor {
    right: 12px;
    left: 12px;
    top: auto;
    bottom: 12px;
    width: auto;
  }
}


.absence-summary.leave .absence-row-cell { background: #fdb98c !important; color: #7a1f26 !important; }
.absence-summary.sick .absence-row-cell { background: #fd8c97 !important; color: #8a2f00 !important; }


.absence-summary.leave > td:first-child { background: #fdb98c  !important; color: #173247 !important; }
.absence-summary.sick > td:first-child { background: #fd8c97  !important; color: #6b2e00 !important; }

@media print {
  .week-table td:nth-child(2) .time-pill,
  .week-table td:nth-child(3) .time-pill {
    padding: 1px 3px !important;
    font-size: 5.3px !important;
    min-width: 0 !important;
  }

  .week-table td:nth-child(4) .assignment-pill,
  .week-table td:nth-child(5) .assignment-pill,
  .week-table td:nth-child(6) .assignment-pill,
  .week-table td:nth-child(7) .assignment-pill,
  .week-table td:nth-child(8) .assignment-pill {
    font-size: 9.4px !important;
  }

  body[data-print-mode="manager"] .week-table td:nth-child(4) .assignment-pill,
  body[data-print-mode="manager"] .week-table td:nth-child(5) .assignment-pill,
  body[data-print-mode="manager"] .week-table td:nth-child(6) .assignment-pill,
  body[data-print-mode="manager"] .week-table td:nth-child(7) .assignment-pill,
  body[data-print-mode="manager"] .week-table td:nth-child(8) .assignment-pill {
    font-size: 8.7px !important;
  }
}
.week-table th:nth-child(2), .week-table td:nth-child(2),
.week-table th:nth-child(3), .week-table td:nth-child(3) {
  width: 104px !important;
  max-width: 104px !important;
}

@media print {
  .week-table th:nth-child(2), .week-table td:nth-child(2),
  .week-table th:nth-child(3), .week-table td:nth-child(3) {
    width: 90px !important;
    max-width: 90px !important;
  }
}
@media print {
  #printSheet {
    width: 100.6%;
  }

  .week-table th:nth-child(1), .week-table td:nth-child(1) {
    width: 16.8% !important;
  }

  .week-table th:nth-child(4), .week-table td:nth-child(4),
  .week-table th:nth-child(5), .week-table td:nth-child(5),
  .week-table th:nth-child(6), .week-table td:nth-child(6),
  .week-table th:nth-child(7), .week-table td:nth-child(7),
  .week-table th:nth-child(8), .week-table td:nth-child(8) {
    width: calc((100% - 16.8% - 180px) / 5) !important;
  }
}
@media print {
  #printSheet {
    position: absolute !important;
    left: 1.5mm !important;
    top: 0 !important;
    width: calc(100% - 3mm) !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    display: block !important;
    box-sizing: border-box !important;
  }

  #weekGrid {
    display: block !important;
    flex: none !important;
    min-height: 0 !important;
    height: auto !important;
  }

  .week-table {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    table-layout: fixed !important;
    font-size: 8.8px !important;
    margin: 0 !important;
  }

  .week-table th:nth-child(1),
  .week-table td:nth-child(1) {
    width: 17.2% !important;
  }

  .week-table th:nth-child(2),
  .week-table td:nth-child(2),
  .week-table th:nth-child(3),
  .week-table td:nth-child(3) {
    width: 88px !important;
    max-width: 88px !important;
  }

  .week-table th:nth-child(4), .week-table td:nth-child(4),
  .week-table th:nth-child(5), .week-table td:nth-child(5),
  .week-table th:nth-child(6), .week-table td:nth-child(6),
  .week-table th:nth-child(7), .week-table td:nth-child(7),
  .week-table th:nth-child(8), .week-table td:nth-child(8) {
    width: calc((100% - 17.2% - 176px) / 5) !important;
  }

  .week-table th,
  .week-table td {
    padding: 2px 1px !important;
  }

  .assignment-cell {
    min-height: 24px !important;
    height: auto !important;
  }

  .assignment-pill {
    font-size: 8.9px !important;
    padding: 3px 6px 3px 8px !important;
  }

  .time-pill {
    padding: 1px 3px !important;
    font-size: 5.3px !important;
    min-width: 0 !important;
  }

  .absence-summary td {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
  }

  body[data-print-mode="manager"] .week-table {
    font-size: 8.2px !important;
  }

  body[data-print-mode="manager"] .assignment-pill {
    font-size: 8.3px !important;
    padding: 6px 5px 2px 7px !important;
  }
}
@media print {
  body[data-print-mode="team"] .week-table th,
  body[data-print-mode="team"] .week-table td {
    padding-bottom: 3px !important;
  }

  body[data-print-mode="team"] .assignment-cell {
    min-height: 27px !important;
  }

  body[data-print-mode="team"] .assignment-pill {
    padding: 4px 6px 4px 8px !important;
    font-size: 9px !important;
  }

  body[data-print-mode="team"] .absence-summary td {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
  }
}
@media print {
  .week-table td:nth-child(2) .time-pill,
  .week-table td:nth-child(3) .time-pill {
    font-size: 8.3px !important;
    margin: 0 auto !important;
    justify-content: center !important;
  }

  .week-table th:nth-child(2),
  .week-table th:nth-child(3),
  .week-table td:nth-child(2),
  .week-table td:nth-child(3) {
    text-align: center !important;
  }
}

@media (max-width: 768px) {
  body { overflow-x: hidden; }
  .auth-gate { padding: 14px; }
  .auth-card { width: 100%; padding: 22px 18px; border-radius: 20px; }
  .shell { grid-template-columns: 1fr !important; }
  .sidebar {
    padding: 16px 14px;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .sidebar h1 { font-size: 1.6rem; }
  .nav {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }
  .nav-link {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 12px 14px;
  }
  .content { padding: 14px; }
  .hero { margin-bottom: 14px; }
  .hero h2 { font-size: 1.45rem; }
  .hero-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
  }
  .hero-actions > * {
    width: 100% !important;
    min-width: 0;
  }
  .hero-actions > input[type="date"] { width: 100% !important; }
  .hero-actions .week-nav {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
  }
  .week-indicator {
    min-width: 0;
    flex: 1 1 auto;
  }
  .card, .print-sheet { padding: 16px; border-radius: 18px; }
  .slim-card { padding: 14px; }
  .week-toolbar-legend {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
  .table-wrap,
  #weekGrid,
  .leave-calendar-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .week-table { min-width: 920px; }
  .leave-calendar-table { min-width: 980px; }
  table { min-width: 760px; }
  .section-head,
  .leave-calendar-head,
  .print-header,
  .week-toolbar {
    gap: 12px;
  }
  .list-tools,
  .leaves-toolbar,
  .leaves-toolbar-filters,
  .leave-calendar-toolbar {
    width: 100%;
  }
  .search-input { min-width: 0; }
  .list-tools {
    justify-content: stretch;
    align-items: stretch;
  }
  .list-tools .search-input { flex: 1 1 auto; }
  .icon-add { flex: 0 0 42px; }
  .form-grid,
  .employee-form-grid,
  .settings-security-grid,
  .grid.two-columns,
  .leaves-toolbar-filters {
    grid-template-columns: 1fr !important;
  }
  .post-option-card { padding: 12px 14px 12px 44px; }
  .weekday-checklist {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .cell-editor,
  .leave-calendar-editor {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
    top: auto !important;
    bottom: 10px !important;
    max-height: calc(100vh - 20px) !important;
    border-radius: 18px;
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .content { padding: 10px; }
  .sidebar { padding: 14px 10px; }
  .hero-actions { grid-template-columns: 1fr; }
  .hero-actions .week-nav { grid-column: auto; }
  .card, .print-sheet { padding: 12px; }
  .week-toolbar-legend .legend-chip { font-size: .78rem; }
  .weekday-checklist { grid-template-columns: 1fr; }
  .cell-editor,
  .leave-calendar-editor { padding: 14px; }
}

