:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --line: #dce4ef;
  --text: #111827;
  --muted: #637083;
  --nav: #06132a;
  --blue: #075dce;
  --green: #16834d;
  --red: #f46f76;
  --yellow: #ffd331;
  --orange: #f58220;
  --shadow: 0 14px 35px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #06132a 0%, #123f85 100%);
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 4px;
  color: var(--text);
}

.login-card h1 {
  font-size: 28px;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: #26364f;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-weight: 400;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: linear-gradient(180deg, #06132a 0%, #0b2250 100%);
  color: #fff;
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #071b55;
  color: var(--yellow);
  font-weight: 800;
  border: 2px solid var(--yellow);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aebbd0;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 14px 16px;
  background: transparent;
  color: #dbe5f4;
  text-align: left;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: var(--blue);
  color: #fff;
}

.account-box {
  position: absolute;
  right: 16px;
  bottom: 20px;
  left: 16px;
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}

.account-box strong,
.account-box span {
  display: block;
}

.account-box span {
  color: #aebbd0;
  font-size: 13px;
}

.account-box .secondary-button {
  width: 100%;
}

.app-shell {
  margin-left: 240px;
}

.page {
  padding: 14px;
}

.page-title,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.08;
}

.page-title p,
.panel-note {
  margin-top: 6px;
  color: var(--muted);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.service-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: #9a6a1f;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.danger-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: #b42318;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #26364f;
}

.toolbar {
  display: grid;
  grid-template-columns: auto auto auto minmax(180px, 1fr) 180px auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.selection-actions,
.date-filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid #d8c4ad;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff8ef;
}

.selection-actions strong,
.date-filter-actions strong {
  margin-right: auto;
  color: #5b341b;
}

.toolbar input,
.toolbar select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.month-picker-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
}

.month-picker-button:hover,
.month-picker-button:focus {
  border-color: var(--line);
  background: #fff;
  color: var(--blue);
}

.calendar-panel,
.data-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.calendar-scroll {
  overflow: auto;
}

.calendar-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.calendar-table th,
.calendar-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 7px;
  text-align: center;
}

.calendar-table th.today-column,
.calendar-table td.today-column {
  border-right: 2px solid #075dce;
  border-left: 2px solid #075dce;
  background: #eef5ff;
}

.calendar-table th.today-column-head {
  border-top: 2px solid #075dce;
  color: #075dce;
  font-weight: 800;
}

.calendar-table tbody tr:last-child td.today-column {
  border-bottom: 2px solid #075dce;
}

.calendar-table th:first-child,
.calendar-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 240px;
  background: #fff;
  text-align: left;
}

.vehicle-row-dimmed td {
  opacity: 0.35;
}

.vehicle-row-dimmed .calendar-day {
  pointer-events: none;
}

.vehicle-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vehicle-trigger {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.vehicle-trigger:hover strong {
  color: var(--blue);
}

.add-vehicle-row td {
  background: #fbfdff;
}

.add-vehicle-calendar {
  min-height: 36px;
  border: 1px dashed var(--blue);
  border-radius: 8px;
  padding: 0 12px;
  background: #eef5ff;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

.add-vehicle-calendar:hover {
  background: #dfeeff;
}

.vehicle-thumb {
  display: grid;
  flex: 0 0 54px;
  width: 54px;
  height: 34px;
  place-items: center;
  border-radius: 6px;
  background: #e8eef8;
  color: #0b2250;
  font-size: 12px;
  object-fit: cover;
}

.vehicle-cell strong,
.vehicle-cell span {
  display: block;
}

.vehicle-cell span {
  color: var(--muted);
  font-size: 12px;
}

.day-box {
  width: 26px;
  height: 26px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.day-booked {
  border-color: var(--red);
  background: linear-gradient(135deg, #ff9ca1, var(--red));
}

.day-customer-match {
  animation: reservation-pulse 0.9s ease-in-out infinite;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.2);
}

.day-service {
  border-color: var(--yellow);
  background: linear-gradient(135deg, #ffe889, var(--yellow));
}

.day-selected {
  border-color: #6f3f1f;
  background: linear-gradient(135deg, #b98758, #6f3f1f);
}

.date-range-selected {
  border-color: #6f3f1f;
  background: linear-gradient(135deg, #c99b75, #8a5632);
}

.month-has-match {
  border-color: var(--red);
  color: var(--red);
  animation: button-pulse 0.9s ease-in-out infinite;
}

@keyframes reservation-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.12);
    opacity: 0.62;
  }
}

@keyframes button-pulse {
  0%,
  100% {
    background: #fff;
  }

  50% {
    background: #fff0f0;
  }
}

.legend {
  display: flex;
  gap: 28px;
  padding: 18px 24px;
  color: #334155;
}

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

.legend i {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--line);
}

.legend-free {
  background: #fff;
}

.legend-booked {
  background: var(--red);
}

.legend-service {
  background: var(--yellow);
}

.data-panel {
  padding: 20px;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.list-row.service-row {
  border-color: #e7c24d;
  background: #fff8d8;
}

.list-row span {
  color: var(--muted);
}

.list-trigger {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.list-trigger:hover strong {
  color: var(--blue);
}

.list-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.compact-button {
  min-height: 34px;
  padding: 0 12px;
}

.chat-panel {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.chat-client-picker {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.chat-client-picker label {
  display: grid;
  gap: 6px;
  color: #26364f;
  font-weight: 700;
}

.chat-client-picker select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.chat-thread {
  display: grid;
  max-height: 520px;
  gap: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbff;
}

.empty-chat {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}

.chat-message {
  width: min(760px, 86%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.chat-message.developer {
  justify-self: end;
  border-color: #bdd3ff;
  background: #eef5ff;
}

.chat-message.client {
  justify-self: start;
}

.chat-message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chat-message-meta strong {
  color: var(--text);
  font-size: 14px;
}

.chat-message p {
  white-space: pre-wrap;
  line-height: 1.45;
}

.chat-form {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.chat-form label {
  display: grid;
  gap: 6px;
  color: #26364f;
  font-weight: 700;
}

.chat-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 400;
  background: #fff;
}

.chat-actions {
  display: flex;
  justify-content: flex-end;
}

.hidden {
  display: none !important;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(7, 22, 45, 0.45);
}

.modal-card {
  display: grid;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  gap: 12px;
  padding: 22px;
}

.modal-card label {
  display: grid;
  gap: 6px;
  color: #26364f;
  font-weight: 700;
}

.modal-card input,
.modal-card select,
.modal-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 400;
}

.checkbox-grid {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #26364f;
  font-weight: 700;
}

.checkbox-grid input {
  width: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.contract-dialog {
  width: min(1180px, calc(100vw - 36px));
  height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.contract-preview-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  max-height: calc(100vh - 36px);
  background: #eef2f7;
}

.contract-preview-actions {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  background: #fff;
}

.contract-preview-actions strong {
  margin-right: auto;
}

.contract-preview {
  display: grid;
  gap: 18px;
  min-height: 0;
  align-content: start;
  overflow: auto;
  padding: 18px;
}

.contract-page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 14mm 16mm;
  background: #fff;
  color: #111827;
  font-family: "Times New Roman", Times, serif;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.12);
}

.contract-title {
  margin: 0 0 24px;
  border-bottom: 2px solid #777;
  text-align: center;
  font-size: 22px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.contract-section-title {
  margin: 16px 0 9px;
  text-align: center;
  font-size: 18px;
  text-transform: uppercase;
}

.contract-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0;
  font-size: 15px;
  line-height: 1.3;
}

.contract-row strong {
  white-space: nowrap;
}

.contract-line-value {
  display: inline-block;
  min-width: 90px;
  border-bottom: 1px dotted #777;
  padding: 0 8px 2px;
  font-weight: 700;
}

.contract-line-wide {
  flex: 1;
}

.contract-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 28px;
  margin: 12px 0;
}

.contract-note {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.4;
}

.contract-terms {
  margin: 0;
  padding-left: 28px;
  font-size: 13px;
  line-height: 1.45;
}

.contract-terms li {
  margin: 10px 0;
}

.contract-fees {
  margin: 10px 0 12px;
  padding-left: 22px;
  font-size: 12px;
  line-height: 1.35;
}

.contract-fees li {
  margin: 5px 0;
}

.contract-vehicle-state {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 24px;
  align-items: start;
  margin-top: 18px;
}

.vehicle-diagram {
  display: grid;
  min-height: 160px;
  place-items: center;
  border: 2px solid #111;
  padding: 8px;
}

.vehicle-diagram img {
  width: 100%;
  max-height: 170px;
  object-fit: contain;
}

.contract-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 24px;
  text-align: center;
}

.contract-signature-line {
  height: 24px;
  margin-bottom: 8px;
  border-bottom: 1px dotted #555;
}

.contract-page-compact .contract-section-title {
  margin: 10px 0 7px;
}

.contract-page-compact .contract-note {
  margin-top: 8px;
}

.contract-page-compact .contract-row {
  margin: 6px 0;
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .app-shell {
    margin-left: 0;
  }

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

  .chat-client-picker {
    grid-template-columns: 1fr;
  }

  .contract-page {
    width: 100%;
    min-height: auto;
  }

  .contract-grid,
  .contract-vehicle-state {
    grid-template-columns: 1fr;
  }

  .toolbar h2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .page {
    padding: 18px;
  }

  .page-title,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

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