:root {
  --gold-50: #fffaf0;
  --gold-100: #fff1c7;
  --gold-300: #f5cf62;
  --gold-400: #edbd2b;
  --gold-500: #d9a70f;
  --gold-700: #795800;
  --ink: #191812;
  --muted: #625f54;
  --line: #dedbd1;
  --line-strong: #bbb6a7;
  --surface: #ffffff;
  --surface-soft: #f7f6f2;
  --surface-warm: #fbfaf6;
  --danger: #9f2f35;
  --danger-soft: #fff0f1;
  --warning: #8a5700;
  --warning-soft: #fff7df;
  --success: #17613a;
  --success-soft: #edf9f1;
  --info: #1f5678;
  --info-soft: #eff7fb;
  --radius-sm: .5rem;
  --radius: .85rem;
  --radius-lg: 1.25rem;
  --shadow: 0 10px 30px rgba(40, 35, 20, .07);
  --focus: #005fcc;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 90% 0, rgba(245, 207, 98, .12), transparent 26rem),
    var(--surface-soft);
  line-height: 1.5;
}

body,
input,
select,
textarea,
button {
  font: inherit;
}

a {
  color: #5f4700;
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}

a:hover {
  color: #2f2500;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: .5rem;
  left: .5rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 4.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(222, 219, 209, .85);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  display: block;
  width: 7.6rem;
  height: 2.45rem;
  object-fit: contain;
}

.brand span,
.account > span {
  display: grid;
}

.brand strong {
  font-size: 1rem;
}

.brand small,
.account small {
  color: var(--muted);
  font-size: .78rem;
}

.account {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: right;
}

.app-shell {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr);
  min-height: calc(100vh - 4.75rem);
}

.main-nav {
  position: sticky;
  top: 4.75rem;
  align-self: start;
  height: calc(100vh - 4.75rem);
  padding: 1.5rem .9rem;
  border-right: 1px solid var(--line);
  background: rgba(251, 250, 246, .87);
  overflow-y: auto;
}

.main-nav a {
  display: flex;
  min-height: 2.85rem;
  align-items: center;
  gap: .7rem;
  margin: .2rem 0;
  padding: .55rem .7rem;
  border-radius: .7rem;
  color: #454238;
  font-size: .92rem;
  font-weight: 650;
  text-decoration: none;
}

.main-nav a:hover {
  background: var(--surface);
}

.main-nav a[aria-current="page"] {
  background: var(--gold-100);
  color: #4e3900;
  box-shadow: inset 3px 0 var(--gold-500);
}

.nav-icon {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 1.65rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: white;
  font-size: .73rem;
}

.content {
  width: 100%;
  max-width: 105rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem);
}

.page-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-heading {
  margin-bottom: 1.5rem;
}

.page-heading h1,
.section-heading h2,
.panel h2,
.panel h3 {
  margin: 0;
  letter-spacing: -.025em;
}

.page-heading h1 {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.1;
}

.section-heading h2,
.panel h2 {
  font-size: 1.25rem;
}

.panel h3 {
  margin-top: 1.5rem;
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 .25rem;
  color: var(--gold-700);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.muted,
.help {
  color: var(--muted);
}

.help {
  margin: -.25rem 0 .25rem;
  font-size: .83rem;
}

.actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1rem;
  border: 1px solid transparent;
  border-radius: .65rem;
  cursor: pointer;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}

.button-primary {
  border-color: #c99b0b;
  background: linear-gradient(180deg, #f4ca50, #e5b627);
  color: #2b2100;
  box-shadow: 0 4px 12px rgba(161, 119, 0, .17);
}

.button-primary:hover {
  background: #f1c33a;
  color: #1d1700;
}

.button-quiet,
.icon-button {
  border-color: var(--line);
  background: var(--surface);
  color: #3f3c32;
}

.button-quiet:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-warm);
}

.button-danger {
  border-color: #e0aeb1;
  background: var(--danger-soft);
  color: #7a1f25;
}

.button-small {
  min-height: 2.15rem;
  padding: .35rem .65rem;
  font-size: .82rem;
}

.link-button {
  padding: .2rem;
  border: 0;
  background: transparent;
  color: #5f4700;
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .18em;
}

.danger-text {
  color: var(--danger);
}

.panel,
.toolbar-card,
.metric-grid article,
.calendar-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(1rem, 2vw, 1.5rem);
}

.panel > h2:first-child {
  margin-bottom: 1rem;
}

.toolbar-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.month-nav > div {
  display: grid;
  min-width: 10rem;
  text-align: center;
}

.month-nav span,
.status-block > span,
.metric-grid span {
  color: var(--muted);
  font-size: .78rem;
}

.month-nav strong {
  text-transform: capitalize;
}

.icon-button {
  width: 2.75rem;
  padding: 0;
  font-size: 1.25rem;
}

.status-block {
  display: grid;
  justify-items: end;
}

.status {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: .35rem;
  padding: .2rem .55rem;
  border: 1px solid var(--line);
  border-radius: 99rem;
  background: var(--surface-soft);
  color: #3f3c32;
  font-size: .75rem;
  font-weight: 800;
}

.status-draft,
.status-active {
  border-color: #acd4ba;
  background: var(--success-soft);
  color: var(--success);
}

.status-approved {
  border-color: #a9cada;
  background: var(--info-soft);
  color: var(--info);
}

.status-closed,
.status-blocked {
  border-color: #e0b1b4;
  background: var(--danger-soft);
  color: var(--danger);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}

.metric-grid article {
  display: grid;
  padding: 1rem 1.15rem;
}

.metric-grid strong {
  font-size: 1.7rem;
}

.metric-grid .metric-warning {
  border-color: #efcb77;
  background: var(--warning-soft);
}

.generator-panel,
.approval-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin: 1rem 0;
  background: linear-gradient(110deg, var(--surface), var(--gold-50));
}

.generator-panel p,
.approval-panel p {
  max-width: 55rem;
  margin: .35rem 0 0;
  color: var(--muted);
}

.generator-form {
  display: grid;
  flex: 0 1 24rem;
  gap: .7rem;
}

.generator-actions {
  display: grid;
  flex: 0 1 24rem;
  gap: .7rem;
}

.generator-actions > form:first-child .button {
  width: 100%;
}

.generator-actions > small {
  color: var(--muted);
}

.check[hidden],
.fields[hidden] {
  display: none !important;
}

.check {
  display: flex !important;
  align-items: flex-start;
  gap: .6rem;
  font-weight: 600 !important;
}

.check input {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
  margin: .1rem 0 0;
}

.choice-group {
  gap: .55rem;
}

.choice-group small {
  color: var(--muted);
}

.calendar-section {
  margin: 1rem 0;
  padding: 1.15rem;
}

.calendar-scroll,
.table-scroll {
  max-width: 100%;
  overflow: auto;
}

.calendar-scroll {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
}

.calendar-help {
  margin: .65rem 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.drag-notice {
  position: fixed;
  z-index: 50;
  right: 1rem;
  bottom: 1rem;
  max-width: min(26rem, calc(100% - 2rem));
  padding: .75rem 1rem;
  border: 1px solid #9bc8aa;
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  color: var(--success);
  box-shadow: var(--shadow);
  font-weight: 750;
}

.drag-notice.is-error {
  border-color: #d99ca1;
  background: var(--danger-soft);
  color: var(--danger);
}

.schedule-save-bar {
  position: fixed;
  z-index: 60;
  right: 1rem;
  bottom: 1rem;
  left: 50%;
  display: flex;
  width: min(54rem, calc(100% - 2rem));
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  border: 2px solid #c39b08;
  border-radius: .8rem;
  background: #fff4c7;
  box-shadow: 0 .65rem 2rem rgb(55 43 0 / 24%);
  transform: translateX(-50%);
}

.schedule-save-bar[hidden] {
  display: none;
}

.schedule-save-bar > div:first-of-type {
  display: grid;
  gap: .1rem;
}

.schedule-save-bar strong {
  color: var(--ink);
}

.schedule-save-bar span,
.schedule-save-bar small {
  color: var(--muted);
}

.schedule-save-bar small[role="alert"] {
  color: var(--danger);
  font-weight: 750;
}

.entry.entry-pending {
  border-color: #c39b08;
  box-shadow: inset 0 0 0 1px #c39b08;
}

.calendar {
  width: 100%;
  min-width: 72rem;
  table-layout: fixed;
  border-collapse: collapse;
  background: white;
}

.calendar th {
  padding: .65rem .45rem;
  border-right: 1px solid var(--line);
  background: #f2f0e9;
  color: #4b483e;
  font-size: .78rem;
  text-align: left;
}

.calendar td {
  height: auto;
  padding: .45rem;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
}

.calendar tbody tr {
  height: 11.7rem;
}

.calendar td.weekend {
  background: #f8f7f4;
}

.calendar td.holiday {
  background: #fff3f3;
}

.calendar td.outside {
  background: #eeece6;
  color: #6a665c;
}

.outside-number {
  font-size: .75rem;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  margin-bottom: .35rem;
}

.day-head time {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  font-weight: 850;
}

.day-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .35rem;
}

.day-add,
.day-vacation {
  min-height: 1.75rem;
  padding: .15rem .4rem;
  border: 1px solid #d7b94d;
  border-radius: .35rem;
  background: var(--gold-50);
  color: #584300;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 850;
}

.day-add:hover {
  background: var(--gold-100);
}

.day-vacation {
  border-color: #dfadb2;
  background: #fff0f2;
  color: #73272b;
}

.day-vacation:hover {
  background: #f7d9dc;
}

.day-edit,
.more-link {
  font-size: .7rem;
  font-weight: 750;
}

.holiday-label {
  display: grid;
  margin-bottom: .35rem;
  padding: .3rem .4rem;
  border: 1px solid #efc5c8;
  border-radius: .4rem;
  color: #73272b;
  font-size: .65rem;
  line-height: 1.25;
}

.holiday-label span {
  font-weight: 850;
  text-transform: uppercase;
}

.day-items {
  display: grid;
  gap: .28rem;
  overflow: visible;
}

.entry strong,
.absence strong {
  overflow-wrap: anywhere;
}

.entry,
.absence {
  position: relative;
  display: grid;
  padding: .28rem .38rem;
  border: 1px solid #ded7be;
  border-left: 4px solid var(--gold-400);
  border-radius: .4rem;
  background: #fffdf7;
  font-size: .69rem;
  line-height: 1.25;
}

.entry span,
.entry small,
.absence span {
  color: var(--muted);
}

.entry-extra {
  border-color: #8db5d0;
  border-left-color: #28688f;
  border-left-style: double;
  border-left-width: 6px;
  background: #e6f3fb;
}

.entry-extra small {
  color: var(--info);
  font-weight: 850;
}

.entry-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .28rem;
}

.entry-name > span {
  color: inherit;
}

.manual-hours {
  color: #315b76 !important;
  font-weight: 800;
  letter-spacing: .025em;
}

.entry-vacation {
  border-color: #dc9ca2;
  border-left-color: #b93843;
  background: #ffe8eb;
  color: #681d22;
}

.entry-vacation .entry-vacation-label {
  padding: .08rem .28rem;
  border: 1px solid #c95760;
  border-radius: 999px;
  background: #fff;
  color: #8a2730;
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .035em;
}

.entry {
  padding-right: 1.65rem;
}

.entry-edit-button {
  justify-self: start;
  min-height: 1.55rem;
  margin-top: .1rem;
  padding: .12rem .25rem;
  border: 0;
  border-radius: .25rem;
  background: transparent;
  color: #5f4700;
  cursor: pointer;
  font-size: .64rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: .15em;
}

.entry-edit-button:hover {
  background: var(--gold-100);
}

.entry-delete-button {
  position: absolute;
  top: .1rem;
  right: .1rem;
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #7b3438;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 900;
  line-height: 1;
}

.entry-delete-button:hover {
  background: #f7d9dc;
  color: #681d22;
}

.entry-delete-button:disabled {
  cursor: wait;
  opacity: .55;
}

[data-draggable-entry] {
  cursor: grab;
}

[data-draggable-entry]:active {
  cursor: grabbing;
}

.entry.is-dragging {
  opacity: .45;
}

.calendar td.is-drop-target {
  background: var(--gold-100);
  box-shadow: inset 0 0 0 3px var(--focus);
}

.absence {
  border-color: #edbdc0;
  border-left-color: #c95760;
  background: #fff2f3;
}

.absence-sick {
  border-left-color: #c46e13;
  background: #fff6e9;
}

.absence-day_off {
  border-color: #a9d8b9;
  border-left-color: #1f8a4c;
  background: #e9f8ee;
}

.absence-day_off span {
  color: #17613a;
  font-weight: 800;
}

.absence[data-absence-card] {
  padding-right: 1.65rem;
}

.absence .entry-edit-button {
  color: #5a4b3c;
}

.absence-day_off .entry-edit-button {
  color: #17613a;
}

.absence-day_off .entry-edit-button:hover {
  background: #cdeed8;
}

.absence-day_off .entry-delete-button {
  color: #1d5a37;
}

.absence-day_off .entry-delete-button:hover {
  background: #cdeed8;
  color: #0f3f24;
}

.absence-badge.absence-day_off {
  border-color: #a9d8b9;
  background: var(--success-soft);
  color: var(--success);
}

.absence-other {
  border-left-color: #7651a5;
  background: #f7f1fc;
}

.conflict-panel {
  margin-top: 1rem;
  border-color: #e8c266;
  background: var(--warning-soft);
}

.conflict-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}

.conflict-panel summary::-webkit-details-marker {
  display: none;
}

.conflict-panel summary > span:first-child {
  display: grid;
  gap: .2rem;
}

.conflict-panel summary > span:last-child {
  font-weight: 750;
}

.conflict-panel[open] summary > span:last-child {
  font-size: 0;
}

.conflict-panel[open] summary > span:last-child::after {
  content: "Zwiń listę";
  font-size: .9rem;
}

.conflict-list {
  display: grid;
  gap: .45rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.conflict-list li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: .75rem;
  padding: .55rem .7rem;
  border-radius: .45rem;
  background: rgba(255, 255, 255, .75);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, .75fr);
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}

.two-column.wide-left {
  grid-template-columns: minmax(0, 1.6fr) minmax(18rem, .7fr);
}

.form-grid,
.fields {
  display: grid;
  gap: .9rem;
}

.employee-order-save {
  position: sticky;
  top: .75rem;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: .8rem 0 1rem;
  padding: .85rem 1rem;
  border: 1px solid #d7b94d;
  border-radius: .7rem;
  background: #fff4c7;
  box-shadow: 0 .35rem 1rem rgb(71 55 4 / 12%);
}

.employee-order-save[hidden] {
  display: none;
}

.employee-order-controls {
  display: flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
}

.employee-order-controls [data-employee-position] {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 800;
}

.employee-order-controls .icon-button {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: .35rem;
}

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

.form-grid label,
.fields label {
  display: grid;
  gap: .32rem;
  color: #333127;
  font-size: .87rem;
  font-weight: 720;
}

fieldset {
  display: grid;
  gap: .9rem;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
}

legend {
  padding: 0 .35rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: .62rem .72rem;
  border: 1px solid #aaa698;
  border-radius: .55rem;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #767267;
}

input[type="color"] {
  min-height: 3rem;
  padding: .25rem;
}

.stack-list {
  display: grid;
  gap: .6rem;
}

.list-card {
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface-warm);
}

.list-card > div {
  display: grid;
}

.list-card span,
.list-card small {
  color: var(--muted);
  font-size: .83rem;
}

.list-card.disabled {
  opacity: .68;
}

.entry-operations {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: .65rem;
}

.move-entry-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .45rem;
}

.move-entry-form label {
  display: grid;
  gap: .2rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.move-entry-form input {
  min-height: 2.15rem;
  padding: .3rem .45rem;
}

.entry-dialog {
  width: min(34rem, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(20, 18, 10, .28);
}

.entry-dialog::backdrop {
  background: rgba(25, 24, 18, .58);
  backdrop-filter: blur(2px);
}

.entry-dialog form,
.entry-dialog .dialog-content {
  padding: 1.4rem;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-heading h2 {
  margin: 0;
}

.dialog-close {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
}

.dialog-context {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: .65rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--gold-50);
}

.dialog-context span {
  color: var(--muted);
}

.empty-state {
  padding: 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: .7rem;
  background: var(--surface-warm);
  text-align: center;
}

.empty-state p {
  margin: .2rem 0;
  color: var(--muted);
}

.data-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  text-align: left;
}

.data-table caption {
  padding: 0 0 1rem;
  font-size: 1rem;
  font-weight: 800;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: .7rem .65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: .85rem;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1efe8;
  color: #4b483e;
  font-size: .73rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.data-table tbody th {
  font-weight: 800;
}

.data-table th small,
.data-table td small {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

.data-table tr:hover td,
.data-table tr:hover th {
  background: #fffdf7;
}

.warning-row td,
.warning-row th {
  background: var(--warning-soft);
}

.person-mark {
  display: inline-block;
  width: .7rem;
  height: .7rem;
  margin-right: .5rem;
  border: 2px solid #665a32;
  border-radius: 50%;
  background: var(--gold-300);
}

.absence-badge {
  display: inline-flex;
  padding: .2rem .5rem;
  border: 1px solid #d9a5aa;
  border-radius: 99rem;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: .68rem;
  font-weight: 850;
}

.compact-list {
  margin: 0;
  padding-left: 1rem;
}

.compact-entry-extra,
.summary-extra {
  border-left: 4px double #28688f;
  background: #e6f3fb;
}

.compact-entry-extra {
  margin-block: .12rem;
  padding: .12rem .3rem;
}

.summary-extra {
  padding-left: .55rem;
}

.inline-form {
  display: flex;
  align-items: end;
  gap: .4rem;
}

.inline-form select {
  min-width: 8rem;
}

.user-operations {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .8rem;
}

.user-operations form {
  margin: 0;
}

.log-detail {
  display: block;
  max-width: 24rem;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .72rem;
}

.details-list {
  display: grid;
  margin: 0;
}

.details-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--line);
}

.details-list dt {
  color: var(--muted);
}

.details-list dd {
  margin: 0;
  font-weight: 800;
}

.alert {
  margin: 0 0 1rem;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: white;
}

.alert-error {
  border-color: #e0afb3;
  background: var(--danger-soft);
  color: #751f25;
}

.alert-success {
  border-color: #a9d2b7;
  background: var(--success-soft);
  color: var(--success);
}

.alert-warning {
  border-color: #ebc66f;
  background: var(--warning-soft);
  color: #664100;
}

.alert ul {
  margin-bottom: 0;
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(245, 207, 98, .25), transparent 25rem),
    linear-gradient(135deg, #f5f3eb, #fff);
}

.login-shell,
.install-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.install-shell {
  padding: 3rem 1rem;
}

.login-card,
.install-card {
  width: min(100%, 28rem);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 20px 60px rgba(38, 32, 13, .12);
}

.install-card {
  width: min(100%, 46rem);
}

.login-logo {
  display: block;
  width: 10rem;
  height: auto;
  margin-bottom: 2rem;
  object-fit: contain;
}

.login-card h1,
.install-card h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -.035em;
}

.login-card .muted,
.install-card .muted {
  margin: .45rem 0 1.5rem;
}

.login-help {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}

.error-page {
  max-width: 38rem;
  margin: 10vh auto;
  padding: 2rem;
}

.print-toolbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: .75rem;
  padding: .75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
}

.print-sheet {
  width: 297mm;
  min-height: 210mm;
  margin: 1rem auto;
  padding: 8mm;
  background: white;
  box-shadow: var(--shadow);
}

.print-header {
  display: grid;
  grid-template-columns: 40mm 1fr auto;
  align-items: center;
  gap: 6mm;
  margin-bottom: 4mm;
  padding-bottom: 3mm;
  border-bottom: 2px solid #222;
}

.print-header img {
  width: 36mm;
  height: auto;
}

.print-header p,
.print-header h1 {
  margin: 0;
}

.print-header h1 {
  font-size: 20pt;
}

.print-header dl {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 5mm;
  margin: 0;
}

.print-header dl div {
  display: grid;
}

.print-header dt {
  font-size: 7pt;
  text-transform: uppercase;
}

.print-header dd {
  margin: 0;
  font-size: 9pt;
  font-weight: 700;
}

.print-calendar {
  width: 100%;
  height: 164mm;
  table-layout: fixed;
  border-collapse: collapse;
}

.print-calendar th {
  height: 6mm;
  border: .3mm solid #444;
  background: #ecebe7;
  font-size: 7pt;
}

.print-calendar td {
  height: 25.8mm;
  padding: 1.2mm;
  border: .3mm solid #444;
  vertical-align: top;
  font-size: 6.2pt;
  line-height: 1.15;
}

.print-calendar td.outside {
  background: #eee;
}

.print-calendar td.holiday {
  background: #f9e8e8;
}

.print-day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1mm;
  margin-bottom: .8mm;
  padding-bottom: .5mm;
  border-bottom: .2mm solid #aaa;
}

.print-day-head strong {
  font-size: 8pt;
}

.print-day-head span {
  font-size: 5.3pt;
  font-weight: 700;
  text-align: right;
}

.print-entries {
  min-height: 10mm;
}

.print-entries div {
  margin-bottom: .45mm;
}

.print-entries .print-entry-extra {
  padding: .25mm .5mm;
  border-left: .8mm double #28688f;
  background: #e6f3fb;
}

.print-vacation-label {
  margin-left: .7mm;
  color: #a61924;
  font-weight: 900;
}

.print-day-off-label {
  color: #17613a;
  font-weight: 900;
}

.print-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2mm 5mm;
  margin-top: 3mm;
  font-size: 6.5pt;
}

.signatures {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  padding-top: 3mm;
}

.overtime-register table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7pt;
}

.overtime-register th,
.overtime-register td {
  height: 4.3mm;
  border: .25mm solid #555;
  padding: .7mm;
}

.overtime-register th {
  background: #ecebe7;
}

@media (max-width: 960px) {
  .app-shell {
    display: block;
  }

  .main-nav {
    position: static;
    display: flex;
    height: auto;
    gap: .25rem;
    padding: .65rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .main-nav a {
    flex: 0 0 auto;
    margin: 0;
  }

  .nav-icon {
    display: none;
  }

  .two-column,
  .two-column.wide-left {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .topbar {
    position: static;
    align-items: flex-start;
    padding: .75rem 1rem;
  }

  .brand img {
    width: 6.4rem;
  }

  .brand span {
    display: none;
  }

  .account {
    gap: .5rem;
  }

  .account > span {
    display: none;
  }

  .page-heading,
  .toolbar-card,
  .generator-panel,
  .approval-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .generator-actions {
    flex-basis: auto;
  }

  .schedule-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-save-bar .actions {
    width: 100%;
  }

  .schedule-save-bar .button {
    flex: 1;
  }

  .month-nav {
    flex-wrap: wrap;
  }

  .month-nav > div {
    flex: 1;
  }

  .month-nav > .button {
    width: 100%;
  }

  .status-block {
    justify-items: start;
  }

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

  .fields.two {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 1rem;
  }

  .panel,
  .calendar-section {
    padding: .85rem;
  }

  .conflict-list li {
    grid-template-columns: 1fr;
    gap: .1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .status,
  .entry,
  .absence,
  .button {
    forced-color-adjust: none;
    border: 2px solid CanvasText;
  }
}

@page {
  size: A4 landscape;
  margin: 5mm;
}

@media print {
  html,
  body,
  .print-body {
    background: white;
  }

  .print-toolbar {
    display: none !important;
  }

  .print-sheet {
    width: 287mm;
    min-height: 200mm;
    margin: 0;
    padding: 3mm;
    box-shadow: none;
    break-after: page;
  }

  .print-sheet:last-child {
    break-after: auto;
  }

  .print-calendar,
  .print-calendar tr,
  .print-calendar td,
  .overtime-register tr {
    break-inside: avoid;
  }

  .print-calendar td.holiday {
    background: #eee !important;
  }
}
