/* ── Pico CSS Overrides & Custom Variables ──────────────────────────────── */
:root {
  --pico-color-black: #0a0a0a;
  --pico-color-white: #ffffff;
  --accent:           #8b1a1a;
  --accent-hover:     #6e1414;
  --accent-light:     #f5e6e6;
  --grey-50:          #fafafa;
  --grey-100:         #f3f3f3;
  --grey-200:         #e5e5e5;
  --grey-400:         #a3a3a3;
  --grey-600:         #525252;
  --grey-800:         #262626;
  --radius:           6px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
  --shadow-md:        0 4px 12px rgba(0,0,0,.12);
  --font:             system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Pico overrides */
  --pico-font-family-sans-serif:  var(--font);
  --pico-primary:                 var(--accent);
  --pico-primary-hover:           var(--accent-hover);
  --pico-primary-inverse:         #ffffff;
  --pico-border-radius:           var(--radius);
  --pico-font-size:               15px;
  --pico-color:                   var(--pico-color-black);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--pico-font-size);
  color: var(--pico-color-black);
  background: var(--grey-50);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; margin: 0 0 .5rem; color: var(--pico-color-black); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem 1.1rem;
  border: 2px solid var(--pico-color-black);
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--pico-color-black);
  color: #fff;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--grey-800); border-color: var(--grey-800); color: #fff; text-decoration: none; }
.btn-outline {
  background: #fff;
  color: var(--pico-color-black);
}
.btn-outline:hover { background: var(--pico-color-black); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: #b91c1c; border-color: #b91c1c; }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Badges */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-success  { background: #dcfce7; color: #166534; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-neutral  { background: var(--grey-200); color: var(--grey-600); }
.badge-accent   { background: var(--accent-light); color: var(--accent); }

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* Forms */
label { font-weight: 600; font-size: .875rem; display: block; margin-bottom: .25rem; color: var(--pico-color-black); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font);
  color: var(--pico-color-black);
  transition: border-color .15s;
  background: #fff;
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--pico-color-black);
}
input::placeholder, textarea::placeholder { color: var(--grey-400); opacity: 1; }
.field-group { margin-bottom: 1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.field-hint { font-size: .8rem; color: var(--grey-600); margin-top: .25rem; }
.field-error { font-size: .8rem; color: #b91c1c; margin-top: .25rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table th { background: var(--grey-100) !important; color: var(--pico-color-black) !important; padding: .6rem .75rem; text-align: left; font-weight: 700; white-space: nowrap; border-bottom: 2px solid var(--grey-200); }
table td { padding: .55rem .75rem; border-bottom: 1px solid var(--grey-200); vertical-align: middle; background: #fff; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--grey-50) !important; }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info    { background: #e0f2fe; color: #0c4a6e; border: 1px solid #7dd3fc; }

/* Utility */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.text-muted { color: var(--grey-600); }
.text-sm { font-size: .8rem; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* Divider */
hr { border: none; border-top: 1px solid var(--grey-200); margin: 1.5rem 0; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--grey-200);
  border-top-color: var(--pico-color-black);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Schedule admin – Kalender-Übersicht */
.sched-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.sched-cal-header {
  text-align: center;
  font-weight: 700;
  font-size: .75rem;
  padding: .3rem .25rem;
  color: var(--grey-600);
}
.sched-cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--grey-100);
  transition: border-color .1s, background .1s;
  user-select: none;
}
.sched-cal-day:hover:not(.sched-cal-empty) { border-color: var(--grey-400); }
.sched-cal-day.sched-cal-today    { border-color: var(--pico-color-black); }
.sched-cal-day.sched-cal-selected { border-color: var(--accent); background: var(--accent-light); }
.sched-cal-empty { background: transparent; cursor: default; }
.sched-cal-num { font-size: .85rem; font-weight: 600; line-height: 1; }
.sched-cal-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sched-dot-ok      { background: #16a34a; }
.sched-dot-partial { background: #ca8a04; }
.sched-dot-missing { background: #dc2626; }
.sched-dot-none    { background: var(--grey-200); }

/* Schedule admin – Kalender + Tagesdetail nebeneinander auf breiten Screens */
.sched-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}
@media (min-width: 900px) {
  .sched-layout {
    grid-template-columns: 1fr minmax(280px, 420px);
  }
  .sched-detail-card {
    position: sticky;
    top: calc(52px + 1rem); /* below topnav */
  }
}

/* Urlaubs-Overlay */
.vacation-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--grey-200);
  box-shadow: var(--shadow-md);
  padding: 1rem;
  overflow-y: auto;
  z-index: 400;
  transform: translateX(0);
  transition: transform .25s ease;
}
.vacation-sidebar.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

/* Backdrop */
.vacation-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  z-index: 399;
}
.vacation-sidebar-backdrop.visible { display: block; }

.vacation-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--grey-200);
}
.btn-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: var(--grey-600); padding: .1rem .3rem;
}
.btn-close:hover { color: var(--pico-color-black); }

.vsb-section { margin-bottom: 1rem; }
.vsb-section-title {
  font-size: .75rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: .5rem; padding: .2rem .4rem;
  border-radius: 3px;
}
.vsb-approved { background: #dcfce7; color: #166534; }
.vsb-pending  { background: #fef9c3; color: #854d0e; }

.vsb-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: .5rem; font-size: .8rem; padding: .2rem 0;
  border-bottom: 1px solid var(--grey-100);
}
.vsb-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vsb-days { color: var(--grey-600); white-space: nowrap; }

/* Schedule admin – Tagesdetail */
.shift-group-name {
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--grey-600);
  border-bottom: 1px solid var(--grey-200);
  padding-bottom: .3rem;
  margin-bottom: .4rem;
}
.shift-detail-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .6rem;
  border-radius: var(--radius);
  margin-bottom: .3rem;
  font-size: .875rem;
}
.shift-detail-row.sdr-ok      { background: #f0fdf4; }
.shift-detail-row.sdr-partial { background: #fefce8; }
.shift-detail-row.sdr-missing { background: #fef2f2; }
.sdr-info  { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; min-width: 160px; }
.sdr-role  { font-weight: 600; }
.sdr-names { flex: 1; color: var(--grey-600); font-size: .85rem; min-width: 80px; }
.sdr-status { font-size: 1rem; font-weight: 700; min-width: 1.25rem; text-align: center; }
.sdr-ok .sdr-status      { color: #16a34a; }
.sdr-partial .sdr-status { color: #ca8a04; }
.sdr-missing .sdr-status { color: #dc2626; }

/* Calendar grid (Urlaubsantrag) */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-header { font-weight: 700; text-align: center; font-size: .75rem; padding: .25rem; }
.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  font-size: .875rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background .1s, border-color .1s;
  user-select: none;
}
.cal-day:hover:not(.cal-empty):not(.cal-disabled) { border-color: var(--pico-color-black); }
.cal-day.cal-selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-day.cal-approved { background: var(--grey-600); color: #fff; }
.cal-day.cal-disabled { background: var(--grey-100); color: var(--grey-400); cursor: not-allowed; }
.cal-day.cal-blocked { background: #fee2e2; color: #991b1b; cursor: not-allowed; text-decoration: line-through; opacity: .85; }
.cal-day.cal-blocked:hover { border-color: #fca5a5; }
.cal-day.cal-empty { cursor: default; }
.cal-day.cal-today { border-color: var(--pico-color-black); font-weight: 700; }

/* Schedule list (Mitarbeiter-Tagesansicht) */
.schedule-list { list-style: none; padding: 0; margin: 0; }
.schedule-list li { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--grey-200); }
.schedule-list li:last-child { border-bottom: none; }
.sl-date { width: 90px; flex-shrink: 0; font-size: .8rem; color: var(--grey-600); }
.sl-info { flex: 1; }
.sl-vacation { color: var(--accent); font-style: italic; }
.sl-free { color: var(--grey-400); }
