:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #17202c;
  --muted: #667085;
  --border: #d8dee8;
  --soft: #eef2f6;
  --accent: #12695e;
  --accent-dark: #0d5149;
  --ok-bg: #edf7f3;
  --ok: #11634f;
  --warn-bg: #fff6df;
  --warn: #8a5700;
  --idle-bg: #f1f3f6;
  --idle: #475467;
  --error-bg: #fef0ef;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  line-height: 1.25;
}

#subtitle,
.panel-heading p,
.job-card p,
.manual-item span,
.manual-item small,
.job-card small,
.status-item small {
  color: var(--muted);
}

#subtitle {
  margin-top: 4px;
}

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

.button,
button {
  min-height: 36px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0 12px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.button.secondary {
  background: #fff;
  color: var(--accent-dark);
}

button.secondary-action {
  background: #fff;
  color: var(--accent-dark);
}

button:hover,
.button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
  gap: 16px;
  padding: 18px;
  max-width: 1280px;
  margin: 0 auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.wide {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading p {
  margin-top: 4px;
  font-size: 13px;
}

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

.status-item {
  min-height: 78px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
}

.status-item span,
.status-item strong,
.status-item small {
  display: block;
}

.status-item span {
  font-size: 13px;
  font-weight: 650;
}

.status-item strong {
  margin-top: 8px;
  font-size: 15px;
}

.status-item small {
  margin-top: 3px;
  line-height: 1.25;
}

.status-item.ok {
  background: var(--ok-bg);
  border-color: #c9e7dd;
}

.status-item.ok strong {
  color: var(--ok);
}

.status-item.warn {
  background: var(--warn-bg);
  border-color: #f2dba0;
}

.status-item.warn strong {
  color: var(--warn);
}

.status-item.idle {
  background: var(--idle-bg);
}

.status-item.idle strong {
  color: var(--idle);
}

.status-item.error {
  background: var(--error-bg);
  border-color: #f7cbc7;
}

.status-item.error strong {
  color: var(--error);
}

.job-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

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

.job-card.primary {
  border-color: #bfded7;
  background: #f7fbfa;
}

.job-card strong,
.manual-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.job-card p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  border-top: 1px solid var(--border);
  padding: 10px 8px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
}

.pill.error {
  background: var(--error-bg);
  color: var(--error);
}

.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

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

.manual-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.manual-item strong {
  margin-bottom: 4px;
}

.manual-item code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

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

.form-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.form-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
}

.form-row textarea {
  min-height: 120px;
}

.rental-table {
  width: 100%;
  border-collapse: collapse;
}

.rental-table td,
.rental-table th {
  border-top: 1px solid var(--border);
  padding: 8px;
}

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

.employee-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.employee-actions select {
  min-height: 34px;
  min-width: 150px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  font: inherit;
}

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

.board-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.board-search {
  width: min(280px, 100%);
  min-height: 44px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 2px;
  border: 1px solid #dfe3ec;
  border-radius: 8px;
  background: #f5f6fb;
  padding: 0 10px;
}

.board-search span {
  color: #3e424c;
  font-size: 30px;
  line-height: 1;
  transform: rotate(-15deg);
}

.board-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #242738;
  font: inherit;
  font-size: 18px;
  font-weight: 650;
}

.board-summary span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid transparent;
}

.legend.booking {
  background: #dbeafe;
  border-color: #93c5fd;
}

.legend.available {
  background: #e8f7ef;
  border-color: #9bd7b4;
}

.legend.gap {
  background: #fff2c7;
  border-color: #f1c44d;
}

.legend.unavailable {
  background: #eef0f3;
  border-color: #cbd5e1;
}

.board-scroll {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0;
  max-height: 680px;
  background: #fff;
}

.board-header,
.board-row {
  display: grid;
  grid-template-columns: 300px minmax(calc(var(--board-days, 31) * var(--board-day-width, 44px)), 1fr);
  min-width: calc(300px + (var(--board-days, 31) * var(--board-day-width, 44px)));
}

.board-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.board-corner,
.board-vehicle {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  border-right: 1px solid var(--border);
}

.board-corner {
  z-index: 4;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-height: 48px;
}

.board-days,
.board-track {
  display: grid;
  grid-template-columns: repeat(var(--board-days, 31), var(--board-day-width, 44px));
}

.board-day {
  min-height: 48px;
  padding: 6px 2px 4px;
  text-align: center;
  border-right: 1px solid var(--soft);
  color: var(--muted);
  font-size: 11px;
  position: relative;
}

.board-day em,
.board-day strong,
.board-day span {
  display: block;
}

.board-day em {
  position: absolute;
  left: 50%;
  top: 1px;
  transform: translateX(-50%);
  color: #272a39;
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.board-day strong {
  color: var(--text);
  font-size: 17px;
  line-height: 1.1;
  margin-top: 9px;
}

.board-day span {
  color: #c03737;
  font-size: 12px;
  font-weight: 700;
}

.board-day.weekend {
  background: #f7f7f9;
}

.board-day.today {
  background: #8bf1cc;
  box-shadow: inset 0 -2px 0 #5fd9b3;
}

.board-row {
  border-bottom: 1px solid var(--border);
}

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

.board-vehicle {
  min-height: 37px;
  padding: 3px 14px;
  display: block;
}

.board-vehicle span,
.board-vehicle small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-vehicle span {
  color: #25274d;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}

.board-vehicle small {
  color: #9a2828;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.15;
  margin-top: 1px;
}

.board-track {
  position: relative;
  min-height: 37px;
  padding: 3px 0;
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc((100% / var(--board-days, 31)) - 1px), var(--soft) calc((100% / var(--board-days, 31)) - 1px), var(--soft) calc(100% / var(--board-days, 31)));
}

.board-segment {
  min-width: 0;
  min-height: 29px;
  margin: 0;
  border-radius: 0;
  padding: 7px 7px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
  position: relative;
}

.board-segment.booking {
  background: rgba(224, 72, 72, 0.52);
  border-color: #d84b49;
  color: transparent;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 0, 100% 100%, 0 100%);
}

.board-segment.available {
  background: transparent;
  border-color: transparent;
  color: transparent;
}

.board-segment.gap {
  background: rgba(255, 242, 199, 0.9);
  border-color: #e1ad2e;
  color: #76510b;
}

.board-segment.unavailable,
.board-segment.blocked {
  background: rgba(224, 225, 231, 0.72);
  border-color: #c2c6d1;
  color: transparent;
  font-weight: 600;
}

.board-segment.pending,
.board-segment.loading {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(196, 202, 216, 0.45) 0,
      rgba(196, 202, 216, 0.45) 6px,
      rgba(246, 247, 250, 0.55) 6px,
      rgba(246, 247, 250, 0.55) 12px
    );
  border-color: #d7dbe5;
  color: transparent;
  animation: boardPendingPulse 1.4s ease-in-out infinite;
}

@keyframes boardPendingPulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

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

.manual-item small {
  display: block;
  margin-top: 3px;
}

.suggestions {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.suggestions article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.suggestions article strong {
  margin: 0 0 3px;
}

.suggestions article span {
  display: block;
  overflow-wrap: anywhere;
}

.suggestions.muted {
  color: var(--muted);
  font-size: 13px;
}

.candidates {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.candidates h3 {
  margin: 0;
  font-size: 13px;
}

.empty {
  color: var(--muted);
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .actions,
  .job-card,
  .manual-item,
  .suggestions article {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

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

.plantafel-page {
  overflow: hidden;
  background: #ffffff;
}

.plantafel-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.plantafel-toolbar {
  width: 100vw;
  max-width: 100vw;
  min-height: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 12px 5px;
  background: #292954;
}

.plantafel-search {
  width: 330px;
  height: 52px;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  border-radius: 6px;
  background: #f1f2f9;
  padding: 0 12px;
}

.plantafel-search span {
  width: 26px;
  height: 26px;
  border: 4px solid #3e424c;
  border-radius: 50%;
  position: relative;
}

.plantafel-search span::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 4px;
  right: -12px;
  bottom: -8px;
  background: #3e424c;
  transform: rotate(45deg);
  border-radius: 4px;
}

.plantafel-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #242738;
  font: inherit;
  font-size: 22px;
  font-weight: 650;
}

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

.plantafel-actions button {
  min-height: 34px;
  background: #ffffff;
  color: #292954;
  border-color: #ffffff;
}

.plantafel-board {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.plantafel-scroll {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  overflow: auto;
  background: #fff;
  --vehicle: 360px;
}

.plantafel-header,
.plantafel-row {
  display: grid;
  grid-template-columns: var(--vehicle) calc(var(--days) * var(--day));
  min-width: calc(var(--vehicle) + (var(--days) * var(--day)));
}

.plantafel-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  border-bottom: 1px solid #dadde5;
}

.plantafel-corner,
.plantafel-vehicle {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  border-right: 1px solid #d9dce4;
}

.plantafel-corner {
  height: var(--row);
  z-index: 6;
}

.plantafel-days,
.plantafel-track {
  display: grid;
  grid-template-columns: repeat(var(--days), var(--day));
}

.plantafel-day {
  height: var(--row);
  border-right: 1px solid #dfe1e7;
  text-align: center;
  position: relative;
  color: #5f6065;
  padding-top: 12px;
}

.plantafel-day em {
  position: absolute;
  left: 50%;
  top: 2px;
  transform: translateX(-50%);
  color: #20202a;
  font-style: normal;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.plantafel-day strong {
  display: block;
  font-size: 18px;
  line-height: 18px;
}

.plantafel-day span {
  display: block;
  color: #d33a3a;
  font-size: 12px;
  line-height: 15px;
  font-weight: 700;
}

.plantafel-day.weekend {
  background: #f7f7f8;
}

.plantafel-day.today {
  background: #88f0cc;
  border-radius: 8px 8px 0 0;
}

.plantafel-row {
  height: var(--row);
  border-bottom: 1px solid #dedfe4;
}

.plantafel-vehicle {
  height: var(--row);
  padding: 5px 12px 3px;
}

.plantafel-vehicle strong,
.plantafel-vehicle span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plantafel-vehicle strong {
  color: #25274d;
  font-size: 15px;
  line-height: 19px;
  font-weight: 800;
}

.plantafel-vehicle span {
  color: #b52e2e;
  font-size: 15px;
  line-height: 19px;
  font-weight: 650;
}

.plantafel-track {
  height: var(--row);
  position: relative;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.58)),
    repeating-linear-gradient(to right, transparent 0, transparent calc(var(--day) - 1px), #dfe1e7 calc(var(--day) - 1px), #dfe1e7 var(--day));
}

.plantafel-day.weekend,
.plantafel-track::before {
  background-color: transparent;
}

.plantafel-segment {
  appearance: none;
  font: inherit;
  text-align: left;
  height: calc(var(--row) - 8px);
  margin-top: 4px;
  border: 1px solid transparent;
  border-radius: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  line-height: calc(var(--row) - 10px);
  padding: 0 7px;
  cursor: default;
  position: relative;
}

.plantafel-segment.booking {
  background: rgba(222, 82, 79, 0.45);
  border-color: #d94442;
  color: transparent;
}

.plantafel-segment.blocked {
  background: rgba(222, 224, 231, 0.82);
  border-color: #c7cad4;
  color: transparent;
}

.plantafel-segment.gap {
  background: rgba(255, 218, 104, 0.82);
  border-color: #e7a91d;
  color: #7b5200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  line-height: 13px;
  padding: 3px 8px;
  cursor: pointer;
}

.plantafel-segment.gap.has-price-rules {
  background: rgba(255, 187, 73, 0.9);
  border-color: #d88900;
  color: #5f3500;
}

.plantafel-segment.gap:hover,
.plantafel-segment.gap:focus-visible {
  outline: 2px solid rgba(216, 137, 0, 0.32);
  outline-offset: 1px;
}

.segment-main,
.segment-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segment-main {
  font-size: 11px;
  font-weight: 800;
}

.segment-sub {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.82;
}

.plantafel-segment.available {
  background: transparent;
  border-color: transparent;
  color: transparent;
}

.plantafel-segment.half-start.half-end {
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 100%, 0 100%);
}

.plantafel-segment.half-start:not(.half-end) {
  clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%);
}

.plantafel-segment.half-end:not(.half-start) {
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 100%, 0 100%);
}

.plantafel-detail {
  position: fixed;
  z-index: 40;
  max-height: min(420px, calc(100vh - 24px));
  overflow: auto;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #cfd3dd;
  box-shadow: 0 16px 42px rgba(20, 23, 45, 0.22);
  color: #25274d;
}

.plantafel-detail[hidden] {
  display: none;
}

.plantafel-detail h3,
.plantafel-detail h4 {
  margin: 0;
  color: #25274d;
}

.plantafel-detail h3 {
  font-size: 16px;
  line-height: 20px;
}

.plantafel-detail h4 {
  margin-top: 10px;
  font-size: 12px;
  line-height: 16px;
  text-transform: uppercase;
  color: #6b6d78;
}

.plantafel-detail p {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 17px;
}

.plantafel-detail p span,
.plantafel-detail li span {
  color: #6b6d78;
}

.plantafel-detail p strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.plantafel-detail ul {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}

.plantafel-detail li {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid #eceef3;
  font-size: 13px;
  line-height: 17px;
}

@media (max-width: 720px) {
  .plantafel-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 7px 8px;
  }

  .plantafel-search {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    height: 44px;
    grid-template-columns: 38px 1fr;
  }

  .plantafel-search input {
    font-size: 18px;
  }

  .plantafel-search span {
    width: 22px;
    height: 22px;
    border-width: 3px;
  }

  .plantafel-search span::after {
    width: 13px;
    height: 3px;
    right: -10px;
    bottom: -7px;
  }

  .plantafel-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    min-width: 0;
  }

  .plantafel-actions button {
    min-width: 0;
    min-height: 34px;
    padding: 0 6px;
  }

  .plantafel-scroll {
    --vehicle: 248px;
  }

  .plantafel-day {
    padding-top: 10px;
  }

  .plantafel-day em {
    font-size: 14px;
    top: 1px;
  }

  .plantafel-day strong {
    font-size: 16px;
    line-height: 16px;
  }

  .plantafel-day span {
    font-size: 11px;
    line-height: 13px;
  }

  .plantafel-vehicle {
    padding: 4px 8px 3px;
  }

  .plantafel-vehicle strong,
  .plantafel-vehicle span {
    font-size: 13px;
    line-height: 17px;
  }

  .plantafel-segment {
    height: calc(var(--row) - 6px);
    margin-top: 3px;
    padding-left: 5px;
    padding-right: 5px;
  }

  .segment-main {
    font-size: 10px;
  }

  .segment-sub {
    font-size: 9px;
  }

  .plantafel-detail {
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: 8px;
    width: auto !important;
    max-height: 52vh;
  }
}
