/* ==========================================================================
   ProPlanner — Ressursplan og mannskapsplanlegging
   Builds on the tokens in styles.css (--surface, --border, --primary …).
   ========================================================================== */
.res-shell {
  --res-ok: #10a36b;
  --res-ok-soft: color-mix(in srgb, #10a36b 16%, var(--surface));
  --res-full: #d97706;
  --res-full-soft: color-mix(in srgb, #d97706 18%, var(--surface));
  --res-over: #dc2626;
  --res-over-soft: color-mix(in srgb, #dc2626 14%, var(--surface));
  --res-weekend: color-mix(in srgb, var(--text) 3.5%, transparent);
  --res-grid: color-mix(in srgb, var(--border) 60%, transparent);
  display: grid;
  gap: 16px;
  padding-bottom: 24px;
}

.res-topbar {
  margin-bottom: 0;
}

.res-top-actions .primary-btn,
.res-top-actions .ghost-btn {
  min-height: 38px;
}

/* ---------- KPIs ---------- */
.res-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.res-kpi {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--card-border, var(--border));
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--card-shadow, none);
  overflow: hidden;
}

.res-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.res-kpi.is-over::before {
  background: var(--res-over);
}

.res-kpi.is-full::before {
  background: var(--res-full);
}

.res-kpi span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.res-kpi strong {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.res-kpi.is-over strong {
  color: var(--res-over);
}

.res-kpi small {
  color: var(--muted);
  font-size: 12.5px;
}

.res-meter {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.res-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.res-kpi.is-over .res-meter > span {
  background: var(--res-over);
}

.res-kpi.is-full .res-meter > span {
  background: var(--res-full);
}

.res-kpi.is-ok .res-meter > span {
  background: var(--res-ok);
}

/* ---------- Toolbar ---------- */
.res-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px;
  border: 1px solid var(--card-border, var(--border));
  border-radius: 14px;
  background: var(--surface);
}

.res-tabs,
.res-kind-filter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.res-tabs button,
.res-kind-filter button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

.res-tabs button .icon-svg {
  width: 15px;
  height: 15px;
}

.res-tabs button:hover,
.res-kind-filter button:hover {
  color: var(--text);
}

.res-tabs button.active,
.res-kind-filter button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1), 0 0 0 1px var(--border);
}

.res-tabs button.active .icon-svg {
  color: var(--primary);
}

.res-period {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.res-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.res-icon-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
}

.res-icon-btn .icon-svg {
  width: 16px;
  height: 16px;
}

.res-today-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.res-today-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.res-period-label {
  margin-left: 6px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.res-select select {
  min-height: 36px;
  padding: 6px 30px 6px 11px;
  border-radius: 9px;
  font-size: 13px;
}

.res-filters {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.res-search {
  position: relative;
  display: block;
  min-width: 200px;
}

.res-search .icon-svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.res-search input {
  min-height: 36px;
  padding: 7px 11px 7px 33px;
  border-radius: 9px;
  font-size: 13px;
}

/* ---------- Panels ---------- */
.res-panel {
  border: 1px solid var(--card-border, var(--border));
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--card-shadow, none);
  overflow: hidden;
}

.res-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 16px 18px 12px;
}

.res-panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.res-panel-head span {
  color: var(--muted);
  font-size: 12.5px;
}

.res-panel > .empty-state {
  margin: 16px;
}

/* ---------- Identity (avatar + name) ---------- */
.res-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.res-identity:hover strong {
  color: var(--primary);
}

.res-identity .avatar {
  flex: 0 0 auto;
}

.res-equipment-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--res-color) 16%, var(--surface));
  color: var(--res-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--res-color) 30%, transparent);
}

.res-equipment-icon .icon-svg {
  width: 16px;
  height: 16px;
}

.res-identity-copy {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 1px;
  line-height: 1.25;
}

.res-identity-copy strong,
.res-identity-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-identity-copy strong {
  font-size: 13px;
  font-weight: 600;
}

.res-identity-copy small {
  color: var(--muted);
  font-size: 11.5px;
}

.res-util {
  flex: 0 0 auto;
  min-width: 42px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.res-util.is-ok,
.res-group-util.is-ok,
.is-ok > .res-cap-value {
  background: var(--res-ok-soft);
  color: var(--res-ok);
}

.res-util.is-full,
.res-group-util.is-full {
  background: var(--res-full-soft);
  color: var(--res-full);
}

.res-util.is-over,
.res-group-util.is-over {
  background: var(--res-over-soft);
  color: var(--res-over);
}

/* ---------- Board (desktop timeline) ---------- */
.res-board-scroll {
  max-height: min(72vh, 900px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.res-board {
  position: relative;
  min-width: 100%;
}

.res-board-head {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: var(--res-label) auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.res-board-corner {
  position: sticky;
  left: 0;
  z-index: 9;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 16px 10px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.res-board-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  letter-spacing: 0;
}

.res-board-timeline {
  display: grid;
}

.res-head-row {
  position: relative;
}

.res-head-months {
  height: 24px;
  border-bottom: 1px solid var(--res-grid);
}

.res-head-weeks {
  height: 24px;
  border-bottom: 1px solid var(--res-grid);
}

.res-head-days {
  height: 34px;
}

.res-head-month,
.res-head-week,
.res-head-day {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--res-grid);
  overflow: hidden;
  white-space: nowrap;
}

.res-head-month {
  padding: 0 8px;
  overflow: clip;
}

.res-head-month span {
  position: sticky;
  left: calc(var(--res-label) + 8px);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.res-head-week {
  justify-content: center;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.res-head-week.is-today {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.res-head-day {
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  color: var(--text);
  line-height: 1.05;
}

.res-head-day small {
  color: var(--muted);
  font-size: 9.5px;
}

.res-head-day b {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.res-head-day.is-weekend {
  background: var(--res-weekend);
}

.res-head-day.is-weekend b {
  color: var(--muted);
}

.res-head-day.is-today {
  background: var(--primary);
  border-radius: 6px;
}

.res-head-day.is-today b,
.res-head-day.is-today small {
  color: #ffffff;
}

/* Groups */
.res-group-head {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}

.res-group-head-inner {
  position: sticky;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--text);
  font-size: 12.5px;
}

.res-group-head strong {
  font-weight: 600;
}

.res-group-chevron {
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.res-group-chevron .icon-svg {
  width: 14px;
  height: 14px;
}

.res-group.is-collapsed .res-group-chevron {
  transform: rotate(-90deg);
}

.res-group-count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
}

.res-group-util {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

/* Rows */
.res-row {
  display: grid;
  grid-template-columns: var(--res-label) auto;
  border-bottom: 1px solid var(--res-grid);
  transition: background 0.12s ease;
}

.res-row:hover .res-track {
  background-color: color-mix(in srgb, var(--primary) 2.5%, transparent);
}

.res-row.is-drop-target .res-track {
  background-color: color-mix(in srgb, var(--primary) 9%, transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent);
}

.res-row-label {
  position: sticky;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  padding: 0 12px 0 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.res-row:hover .res-row-label {
  background: color-mix(in srgb, var(--surface-2) 60%, var(--surface));
}

.res-track {
  position: relative;
  width: calc(var(--res-days) * var(--res-cell));
  cursor: crosshair;
  background-image:
    linear-gradient(90deg, transparent calc(var(--res-cell) * 5), var(--res-weekend) calc(var(--res-cell) * 5)),
    linear-gradient(90deg, var(--res-grid) 1px, transparent 1px);
  background-size: calc(var(--res-cell) * 7) 100%, var(--res-cell) 100%;
}

.res-over-col {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--res-over) 9%, transparent);
  pointer-events: none;
}

.res-load {
  position: absolute;
  bottom: 3px;
  display: grid;
  place-items: center;
  height: 14px;
  border-radius: 4px;
  pointer-events: auto;
}

.res-load:empty {
  height: 5px;
  border-radius: 999px;
}

.res-load span {
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.res-load.is-ok {
  background: color-mix(in srgb, var(--res-ok) 70%, var(--surface));
}

.res-load.is-full {
  background: var(--res-full);
}

.res-load.is-over {
  background: var(--res-over);
}

/* Allocation bars */
.res-bar {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 24px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--res-color) 17%, var(--surface));
  box-shadow: inset 3px 0 0 var(--res-color), inset 0 0 0 1px color-mix(in srgb, var(--res-color) 35%, transparent);
  color: var(--text);
  cursor: grab;
  overflow: hidden;
  transition: box-shadow 0.15s ease, background 0.15s ease;
  touch-action: none;
}

.res-bar:hover,
.res-bar:focus-visible {
  z-index: 3;
  background: color-mix(in srgb, var(--res-color) 26%, var(--surface));
  box-shadow: inset 3px 0 0 var(--res-color), inset 0 0 0 1px var(--res-color), 0 6px 14px -6px color-mix(in srgb, var(--res-color) 70%, transparent);
  outline: none;
}

.res-bar.cut-start {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--res-color) 35%, transparent);
}

.res-bar.cut-end {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.res-bar.is-dragging {
  z-index: 30;
  cursor: grabbing;
  opacity: 0.92;
  box-shadow: inset 3px 0 0 var(--res-color), inset 0 0 0 1.5px var(--res-color), 0 12px 24px -8px rgba(15, 23, 42, 0.45);
  pointer-events: none;
}

.res-bar-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 0 8px 0 10px;
  pointer-events: none;
}

.res-bar-label b {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-bar-label small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.res-bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 8px;
  cursor: ew-resize;
}

.res-bar-handle.is-start {
  left: 0;
}

.res-bar-handle.is-end {
  right: 0;
}

.res-bar-handle::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 3px;
  width: 2px;
  border-radius: 999px;
  background: var(--res-color);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.res-bar:hover .res-bar-handle::after {
  opacity: 0.8;
}

.res-board.is-dragging,
.res-board.is-dragging * {
  cursor: grabbing !important;
  user-select: none;
}

.res-selection {
  position: absolute;
  top: 6px;
  bottom: 20px;
  z-index: 4;
  border: 1.5px dashed var(--primary);
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  pointer-events: none;
}

.res-selection::after {
  content: attr(data-label);
  position: absolute;
  top: 50%;
  left: 8px;
  color: var(--primary-text);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transform: translateY(-50%);
}

.res-drag-tip {
  position: fixed;
  z-index: 120;
  padding: 5px 9px;
  border-radius: 7px;
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.3);
}

:root[data-theme="dark"] .res-drag-tip {
  background: #f8fafc;
  color: #0f172a;
}

.res-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 2px;
  margin-left: -1px;
  background: color-mix(in srgb, var(--res-over) 75%, transparent);
  pointer-events: none;
}

/* Legend */
.res-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.res-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.res-legend-bar {
  width: 22px;
  height: 10px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--primary) 20%, var(--surface));
  box-shadow: inset 3px 0 0 var(--primary);
}

.res-legend-load {
  width: 14px;
  height: 5px;
  border-radius: 999px;
}

.res-legend-load.is-ok {
  background: var(--res-ok);
}

.res-legend-load.is-full {
  background: var(--res-full);
}

.res-legend-load.is-over {
  background: var(--res-over);
}

.res-legend-hint {
  margin-left: auto;
}

/* ---------- Capacity ---------- */
.res-cap-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}

.res-cap-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}

.res-cap-table th,
.res-cap-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--res-grid);
  text-align: left;
  vertical-align: middle;
}

.res-cap-table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.res-cap-table thead th b,
.res-cap-table thead th small {
  display: block;
}

.res-cap-table thead th b {
  color: var(--text);
  font-size: 12.5px;
}

.res-cap-table tbody th,
.res-cap-table tfoot th {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 180px;
  background: var(--surface);
  font-weight: 600;
}

.res-cap-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

.res-cap-table th > span,
.res-cap-table th > small {
  display: block;
}

.res-cap-table th > span {
  font-size: 13px;
}

.res-cap-table th > small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
}

.res-cap-table tfoot th,
.res-cap-table tfoot td {
  border-bottom: 0;
  background: var(--surface-2);
}

.res-cap-cell {
  min-width: 96px;
}

.res-cap-cell b {
  display: block;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.res-cap-cell .res-meter {
  height: 5px;
  margin: 5px 0 4px;
}

.res-cap-cell small {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.res-cap-cell.is-ok .res-meter > span {
  background: var(--res-ok);
}

.res-cap-cell.is-full .res-meter > span {
  background: var(--res-full);
}

.res-cap-cell.is-full b {
  color: var(--res-full);
}

.res-cap-cell.is-over {
  background: color-mix(in srgb, var(--res-over) 6%, transparent);
}

.res-cap-cell.is-over b {
  color: var(--res-over);
}

.res-cap-cell.is-over .res-meter > span {
  background: var(--res-over);
}

.res-capacity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px;
}

.res-project-list,
.res-available-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0 8px 12px;
  list-style: none;
}

.res-project-list li {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
}

.res-project-list li:hover {
  background: var(--surface-2);
}

.res-project-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.res-project-line i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 3px;
  background: var(--res-color);
}

.res-project-line strong {
  flex: 1 1 auto;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-project-line span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.res-meter.is-project > span {
  background: var(--res-color);
}

.res-available-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
}

.res-available-list li:hover {
  background: var(--surface-2);
}

.res-available-list .ghost-btn {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12.5px;
}

/* ---------- Register ---------- */
.res-register {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.res-register-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--card-border, var(--border));
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--card-shadow, none);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.res-register-card:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.res-register-card.is-inactive {
  opacity: 0.7;
}

.res-register-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.res-tag {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.res-register-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
}

.res-register-facts div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.res-register-facts .is-wide {
  grid-column: 1 / -1;
}

.res-register-facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.res-register-facts dd {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-register-facts dd.is-over {
  color: var(--res-over);
}

.res-register-facts dd.is-full {
  color: var(--res-full);
}

.res-register-facts dd.is-ok {
  color: var(--res-ok);
}

.res-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 3px;
}

.res-register-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.res-register-actions .ghost-btn {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 12.5px;
}

.res-actions-spacer,
.res-foot-spacer {
  flex: 1;
}

/* ---------- Empty state ---------- */
.res-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 24px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
}

.res-empty h2 {
  margin: 6px 0 0;
  font-size: 18px;
}

.res-empty p {
  max-width: 520px;
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.55;
}

.res-empty-art {
  display: grid;
  gap: 6px;
  width: 150px;
}

.res-empty-art span {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.res-empty-art span:nth-child(1) {
  width: 70%;
}

.res-empty-art span:nth-child(2) {
  width: 90%;
  margin-left: 10%;
  background: color-mix(in srgb, #0ea5e9 16%, var(--surface));
  box-shadow: inset 3px 0 0 #0ea5e9;
}

.res-empty-art span:nth-child(3) {
  width: 55%;
  margin-left: 30%;
  background: color-mix(in srgb, #10b981 16%, var(--surface));
  box-shadow: inset 3px 0 0 #10b981;
}

/* ---------- Dialogs ---------- */
.res-allocation-modal {
  width: min(620px, 100%);
}

.res-label-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.res-optional {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
}

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

.modal label.res-kind-card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.res-kind-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.res-kind-card span:last-child {
  display: grid;
  gap: 2px;
}

.res-kind-card strong {
  font-size: 13.5px;
  font-weight: 600;
}

.res-kind-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.res-kind-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
}

.res-kind-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary);
}

.res-kind-card:has(input:checked) .res-kind-icon {
  background: var(--primary);
  color: #ffffff;
}

.res-kind-card:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.res-input-suffix {
  position: relative;
  display: block;
}

.res-input-suffix input {
  padding-right: 54px !important;
}

.res-input-suffix > span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  transform: translateY(-50%);
  pointer-events: none;
}

.res-capacity-field,
.res-date-block,
.res-load-block {
  display: grid;
  gap: 8px;
}

.res-load-block,
.res-date-block {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.res-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.res-chips [hidden] {
  display: none;
}

.res-field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.res-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal label.res-color-swatch {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.res-color-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.res-color-swatch span {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
  transition: transform 0.12s ease;
}

.res-color-swatch:hover span {
  transform: scale(1.08);
}

.res-color-swatch:has(input:checked) span {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--swatch, var(--text));
}

.modal label.res-color-swatch.is-auto {
  width: auto;
}

.res-color-swatch.is-auto span {
  display: grid;
  place-items: center;
  width: auto;
  height: 26px;
  padding: 0 10px;
  border: 1px dashed var(--border);
  background: var(--surface);
  box-shadow: none;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.res-color-swatch.is-auto:has(input:checked) span {
  border-style: solid;
  border-color: var(--text);
  color: var(--text);
  box-shadow: none;
}

.res-summary {
  display: grid;
  gap: 6px;
}

.res-summary:empty {
  display: none;
}

.res-summary-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.res-summary-row .icon-svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--muted);
}

.res-summary-row.is-ok {
  background: var(--res-ok-soft, #e7f6ef);
}

.res-summary-row.is-ok .icon-svg {
  color: var(--res-ok, #10a36b);
}

.res-summary-row.is-over {
  background: var(--res-over-soft, #fdecec);
  color: color-mix(in srgb, var(--res-over, #dc2626) 80%, var(--text));
}

.res-summary-row.is-over .icon-svg {
  color: var(--res-over, #dc2626);
}

/* The dialog lives in #modal-root, outside .res-shell, so give it the tokens too. */
.res-modal {
  --res-ok: #10a36b;
  --res-ok-soft: color-mix(in srgb, #10a36b 14%, var(--surface));
  --res-over: #dc2626;
  --res-over-soft: color-mix(in srgb, #dc2626 12%, var(--surface));
}

/* ---------- External projects ---------- */
.res-ext-mark {
  flex: 0 0 auto;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--res-color, var(--muted)) 45%, var(--border));
  border-radius: 4px;
  color: var(--muted);
  font-size: 9.5px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 15px;
  text-transform: uppercase;
}

.res-bar.is-external {
  background:
    repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--res-color) 9%, transparent) 6px 12px),
    color-mix(in srgb, var(--res-color) 12%, var(--surface));
  box-shadow: inset 3px 0 0 var(--res-color), inset 0 0 0 1px color-mix(in srgb, var(--res-color) 40%, transparent);
  outline: 1px dashed color-mix(in srgb, var(--res-color) 55%, transparent);
  outline-offset: -1px;
}

.res-chip.is-external {
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--res-color) 8%, transparent) 7px 14px),
    color-mix(in srgb, var(--res-color) 10%, var(--surface));
}

.res-chip .res-ext-mark,
.res-project-line .res-ext-mark {
  margin-left: 6px;
  vertical-align: 1px;
}

.res-new-project {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}

.res-new-project[hidden],
[data-res-plan-field][hidden] {
  display: none;
}

.res-new-project-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.res-new-project-head > .icon-svg {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 7px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.res-new-project-head span {
  display: grid;
  gap: 2px;
}

.res-new-project-head strong {
  font-size: 13.5px;
  font-weight: 600;
}

.res-new-project-head small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.res-external-panel .res-panel-head > div {
  display: grid;
  gap: 2px;
}

.res-external-panel .res-panel-head .ghost-btn {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 12.5px;
}

.res-external-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 14px 14px;
  list-style: none;
}

.res-external-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.res-external-item:hover {
  border-color: color-mix(in srgb, var(--res-color) 50%, var(--border));
  background: color-mix(in srgb, var(--res-color) 5%, var(--surface));
}

.res-external-item > i {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 4px;
  background: var(--res-color);
}

.res-external-item > span {
  display: grid;
  flex: 1 1 auto;
  gap: 1px;
  min-width: 0;
}

.res-external-item strong,
.res-external-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-external-item strong {
  font-size: 13px;
  font-weight: 600;
}

.res-external-item small {
  color: var(--muted);
  font-size: 11.5px;
}

.res-external-item > .icon-svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.res-external-item:hover > .icon-svg {
  opacity: 1;
}

.res-external-list .is-archived .res-external-item {
  opacity: 0.65;
}

.res-external-empty {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Absence and holidays ---------- */
.res-bar.is-absence {
  background:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--res-color) 20%, var(--surface)) 0 7px, color-mix(in srgb, var(--res-color) 12%, var(--surface)) 7px 14px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--res-color) 45%, transparent);
}

.res-bar.is-absence:hover,
.res-bar.is-absence:focus-visible {
  box-shadow: inset 0 0 0 1px var(--res-color), 0 6px 14px -6px color-mix(in srgb, var(--res-color) 70%, transparent);
}

.res-bar.is-absence .res-bar-label b {
  color: color-mix(in srgb, var(--res-color) 70%, var(--text));
}

.res-absence-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--res-color);
  color: #ffffff;
}

.res-absence-icon .icon-svg {
  width: 12px;
  height: 12px;
  stroke-width: 1.8 !important;
}

.res-bar-label .res-absence-icon {
  align-self: center;
}

.res-absence-col {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--res-color) 7%, transparent);
  pointer-events: none;
}

.res-load.is-absence {
  background: color-mix(in srgb, var(--res-color) 85%, var(--surface));
}

.res-holiday-col {
  position: absolute;
  top: 82px;
  bottom: 0;
  z-index: 1;
  background:
    repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--res-over) 6%, transparent) 5px 10px),
    color-mix(in srgb, var(--text) 3%, transparent);
  pointer-events: none;
}

.res-head-day.is-holiday {
  background: color-mix(in srgb, var(--res-over) 9%, transparent);
}

.res-head-day.is-holiday b,
.res-head-day.is-holiday small {
  color: var(--res-over);
}

.res-legend-absence {
  width: 22px;
  height: 10px;
  border-radius: 3px;
  background: repeating-linear-gradient(135deg, #bae6fd 0 4px, #e0f2fe 4px 8px);
  box-shadow: inset 0 0 0 1px #7dd3fc;
}

.res-legend-holiday {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  background: repeating-linear-gradient(45deg, transparent 0 3px, rgba(220, 38, 38, 0.25) 3px 6px), var(--surface-2);
}

.res-chip.is-absence {
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--res-color) 8%, transparent) 7px 14px),
    color-mix(in srgb, var(--res-color) 11%, var(--surface));
}

.res-card-day.is-absence {
  background: color-mix(in srgb, var(--res-color) 16%, var(--surface));
}

.res-card-day.is-absence b {
  color: var(--res-color);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.res-absence-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 14px 14px;
  list-style: none;
}

.res-absence-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--res-color) 5%, var(--surface));
  color: var(--text);
  text-align: left;
}

.res-absence-item:hover {
  border-color: color-mix(in srgb, var(--res-color) 50%, var(--border));
}

.res-absence-item .res-absence-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.res-absence-item .res-absence-icon .icon-svg {
  width: 15px;
  height: 15px;
}

.res-absence-copy {
  display: grid;
  flex: 1 1 auto;
  gap: 1px;
  min-width: 0;
}

.res-absence-copy b {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-absence-copy small {
  color: color-mix(in srgb, var(--res-color) 70%, var(--text));
  font-size: 12px;
  font-weight: 500;
}

.res-absence-dates {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 1px;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.res-absence-dates small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

/* Dialog: work / absence */
.res-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.res-mode-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

.res-mode-switch button .icon-svg {
  width: 16px;
  height: 16px;
}

.res-mode-switch button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 0 0 1px var(--border);
}

.res-mode-switch button.active .icon-svg {
  color: var(--primary);
}

.res-allocation-modal.is-absence .res-mode-switch button.active .icon-svg {
  color: #0284c7;
}

.res-fieldset {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.res-fieldset[hidden] {
  display: none;
}

.res-field {
  display: grid;
  gap: 6px;
}

.res-absence-types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.modal label.res-absence-type {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.res-absence-type input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.res-absence-type .res-absence-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--res-color) 14%, var(--surface));
  color: var(--res-color);
}

.res-absence-type .res-absence-icon .icon-svg {
  width: 15px;
  height: 15px;
}

.res-absence-type:hover {
  border-color: color-mix(in srgb, var(--res-color) 45%, var(--border));
}

.res-absence-type:has(input:checked) {
  border-color: var(--res-color);
  background: color-mix(in srgb, var(--res-color) 8%, var(--surface));
  box-shadow: 0 0 0 1px var(--res-color);
  font-weight: 600;
}

.res-absence-type:has(input:checked) .res-absence-icon {
  background: var(--res-color);
  color: #ffffff;
}

.res-absence-type:has(input:focus-visible) {
  outline: 2px solid var(--res-color);
  outline-offset: 2px;
}

.res-duration {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.res-duration .res-field-label {
  width: 100%;
  margin: 0;
}

.res-duration-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.modal .res-duration-switch label {
  position: relative;
  display: block;
  cursor: pointer;
}

.res-duration-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.res-duration-switch span {
  display: block;
  padding: 6px 14px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.res-duration-switch input:checked + span {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 0 0 1px var(--border);
}

.res-duration-switch input:focus-visible + span {
  outline: 2px solid var(--primary);
}

.res-absence-hours {
  width: 130px;
}

.res-absence-hours[hidden] {
  display: none;
}

.res-chips [data-res-for][hidden] {
  display: none;
}

.res-summary-row.is-warn {
  background: color-mix(in srgb, #d97706 12%, var(--surface));
}

.res-summary-row.is-warn .icon-svg {
  color: #d97706;
}

.res-summary-row .res-absence-icon {
  background: var(--res-color);
}

/* Toolbar project filter (combobox) */
.res-project-filter {
  min-width: 220px;
}

.res-project-filter .combo-trigger {
  min-height: 36px;
  padding: 5px 9px 5px 11px;
  font-size: 13px;
}

.res-project-filter .combo-panel {
  left: auto;
  width: 320px;
}

@media (max-width: 760px) {
  .res-absence-types {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .res-project-filter {
    min-width: 200px;
  }

  .res-project-filter .combo-panel {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
  }

  .res-absence-list {
    grid-template-columns: 1fr;
  }
}

/* Floating add button (phones) */
.res-fab {
  display: none;
}

/* ---------- Mobile agenda ---------- */
.res-agenda {
  display: grid;
  gap: 14px;
}

.res-week-strip {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--card-border, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
}

.res-week-day {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 10px;
  line-height: 1.1;
}

.res-week-day small {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: capitalize;
}

.res-week-day b {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.res-week-day.is-weekend b {
  color: var(--muted);
}

.res-week-day.is-today {
  background: var(--primary);
}

.res-week-day.is-today small,
.res-week-day.is-today b {
  color: #ffffff;
}

.res-week-day-meter {
  position: relative;
  display: block;
  width: 6px;
  height: 18px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.res-week-day.is-today .res-week-day-meter {
  background: rgba(255, 255, 255, 0.3);
}

.res-week-day-meter i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  background: var(--res-ok);
}

.res-week-day-meter.is-full i {
  background: var(--res-full);
}

.res-week-day-meter.is-over i {
  background: var(--res-over);
}

.res-week-day.is-today .res-week-day-meter i {
  background: #ffffff;
}

.res-agenda-group {
  display: grid;
  gap: 8px;
}

.res-agenda-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.res-agenda-group-title span {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  letter-spacing: 0;
}

.res-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--card-border, var(--border));
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--card-shadow, none);
}

.res-card-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.res-card-day {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-height: 46px;
  padding: 5px 0;
  border: 0;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.1;
}

.res-card-day small {
  color: var(--muted);
  font-size: 10px;
  text-transform: capitalize;
}

.res-card-day b {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.res-card-day.is-ok {
  background: var(--res-ok-soft);
}

.res-card-day.is-ok b {
  color: var(--res-ok);
}

.res-card-day.is-full {
  background: var(--res-full-soft);
}

.res-card-day.is-full b {
  color: var(--res-full);
}

.res-card-day.is-over {
  background: var(--res-over-soft);
  box-shadow: inset 0 0 0 1.5px var(--res-over);
}

.res-card-day.is-over b {
  color: var(--res-over);
}

.res-card-day.is-weekend.is-none {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border);
}

.res-card-allocations {
  display: grid;
  gap: 6px;
}

.res-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--res-color) 12%, var(--surface));
  color: var(--text);
  text-align: left;
  box-shadow: inset 3px 0 0 var(--res-color);
}

.res-chip i {
  display: none;
}

.res-chip span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.res-chip b {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-chip small {
  color: var(--muted);
  font-size: 11.5px;
}

.res-card-free {
  margin: 0;
  color: var(--res-ok);
  font-size: 12.5px;
  font-weight: 500;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .res-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .res-filters {
    justify-content: flex-start;
  }

  .res-capacity-grid {
    grid-template-columns: 1fr;
  }

  .res-legend-hint {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .res-shell {
    gap: 12px;
    padding-bottom: 88px;
  }

  .res-topbar h1 {
    font-size: 24px;
  }

  .res-top-actions {
    display: none;
  }

  .res-kpis {
    display: flex;
    gap: 8px;
    margin: 0 -16px;
    padding: 2px 16px 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .res-kpi {
    flex: 0 0 72%;
    padding: 14px;
    scroll-snap-align: start;
  }

  .res-kpi strong {
    font-size: 22px;
  }

  .res-toolbar {
    display: grid;
    gap: 8px;
    padding: 8px;
  }

  .res-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .res-tabs button {
    justify-content: center;
    min-height: 36px;
  }

  .res-period {
    display: grid;
    grid-template-columns: 40px auto 40px minmax(0, 1fr);
    align-items: center;
  }

  .res-icon-btn,
  .res-today-btn {
    height: 40px;
  }

  .res-icon-btn {
    width: 40px;
  }

  .res-period-label {
    overflow: hidden;
    font-size: 12.5px;
    text-align: right;
    text-overflow: ellipsis;
  }

  /* One week per screen on phones; the range picker only applies to capacity. */
  .res-range-select {
    display: none;
  }

  .res-filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin: 0 -8px;
    padding: 0 8px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .res-filters > * {
    flex: 0 0 auto;
  }

  .res-search {
    min-width: 170px;
  }

  .res-search input,
  .res-select select {
    min-height: 40px;
    font-size: 16px; /* avoids iOS zoom on focus */
  }

  .res-capacity .res-panel-head {
    padding: 14px 14px 10px;
  }

  .res-cap-table tbody th,
  .res-cap-table tfoot th {
    min-width: 128px;
  }

  .res-register {
    grid-template-columns: 1fr;
  }

  .res-fab {
    position: fixed;
    right: 18px;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 18px;
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--primary) 70%, transparent), 0 2px 6px rgba(15, 23, 42, 0.2);
  }

  .res-fab .icon-svg {
    width: 24px;
    height: 24px;
  }

  .res-kind-cards {
    grid-template-columns: 1fr;
  }

  .res-modal .modal-foot {
    flex-wrap: wrap;
  }

  .res-foot-spacer {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .res-bar,
  .res-group-chevron,
  .res-color-swatch span {
    transition: none;
  }
}
