:root {
  --bg: #f4fbff;
  --bg-secondary: #e9f8fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --ink: #123047;
  --text: #31586d;
  --muted: #5d7e8f;
  --primary: #0ea5a8;
  --primary-dark: #0b7f88;
  --primary-soft: rgba(14, 165, 168, 0.14);
  --secondary: #0f75c8;
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.12);
  --line: rgba(17, 94, 89, 0.14);
  --line-strong: rgba(17, 94, 89, 0.24);
  --shadow-sm: 0 10px 24px rgba(20, 76, 105, 0.08);
  --shadow-md: 0 18px 40px rgba(15, 67, 92, 0.14);
  --shadow-lg: 0 24px 56px rgba(15, 67, 92, 0.18);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(14, 116, 144, 0.16), transparent 26%),
    linear-gradient(180deg, #f7fdff 0%, #eef9fc 42%, #f8fcfd 100%);
}

.shell {
  width: min(1400px, calc(100% - 24px));
  margin: 0 auto;
  padding: 28px 0 80px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(235, 252, 255, 0.9)),
    rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.brand {
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
}

.topbar-copy {
  color: var(--muted);
  font-size: 0.94rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.topbar-actions form {
  margin: 0;
  display: inline-flex;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  margin-bottom: 12px;
  line-height: 1.04;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: -0.03em;
}

h2 {
  color: var(--ink);
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  margin-bottom: 10px;
}

h3 {
  color: var(--ink);
}

p.lead {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.7;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.card {
  display: block;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(17, 94, 89, 0.04);
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 165, 168, 0.35);
  box-shadow: var(--shadow-md);
}

.card p {
  margin-top: 8px;
  color: var(--muted);
}

form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.grid-three {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

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

label {
  font-weight: 700;
  color: var(--ink);
}

.form-input,
.form-select,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea,
select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
}

.form-input:focus,
.form-select:focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(14, 165, 168, 0.6);
  box-shadow: 0 0 0 4px rgba(14, 165, 168, 0.14);
}

.help {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.45;
}

.errors {
  font-size: 0.94rem;
  color: var(--danger);
  line-height: 1.45;
}

.alert {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 14px;
  border: 1px solid rgba(5, 150, 105, 0.18);
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.1), rgba(20, 184, 166, 0.08));
  color: var(--success);
  box-shadow: var(--shadow-sm);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease;
  box-shadow: 0 4px 14px rgba(14, 116, 144, 0.08);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-color: rgba(0, 0, 0, 0.02);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
}

.btn-small {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  border-color: rgba(14, 165, 168, 0.35);
  background: rgba(240, 253, 250, 0.95);
  color: var(--primary-dark);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.2);
}

.summary {
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(14, 165, 168, 0.08), rgba(15, 117, 200, 0.08));
}

.summary ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.filters {
  margin-top: 22px;
}

.table-wrap {
  width: 100%;
  margin-top: 22px;
  overflow-x: auto;
  border: 1px solid rgba(14, 165, 168, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.vehicle-preview-panel {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
}

.vehicle-preview-thumb {
  width: min(100%, 320px);
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(14, 165, 168, 0.08), rgba(15, 117, 200, 0.06));
}

.vehicle-preview-thumb.hidden {
  display: none;
}

.vehicle-preview-meta {
  display: grid;
  gap: 4px;
}

.vehicle-preview-code {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.booking-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.booking-table th,
.booking-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(17, 94, 89, 0.08);
  line-height: 1.5;
}

.booking-table th:last-child,
.booking-table td:last-child {
  width: auto;
}

.booking-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(135deg, rgba(14, 165, 168, 0.12), rgba(15, 117, 200, 0.1));
  color: var(--ink);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.booking-table tr:hover td {
  background: rgba(244, 253, 255, 0.86);
}

.status {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: 0.9rem;
}

.status-pending {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
  color: #a16207;
}

.status-confirmed {
  background: var(--success-soft);
  border-color: rgba(5, 150, 105, 0.24);
  color: var(--success);
}

.status-active {
  background: rgba(15, 117, 200, 0.12);
  border-color: rgba(15, 117, 200, 0.22);
  color: var(--secondary);
}

.status-completed {
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(100, 116, 139, 0.22);
  color: #4b5563;
}

.status-cancelled {
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.2);
  color: #b91c1c;
}

.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.table-actions form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  width: auto;
  min-width: 0;
}

.table-actions .btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.table-actions .action-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
}

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

.message-row {
  display: grid;
  grid-template-columns: 120px 1fr 180px;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(17, 94, 89, 0.04);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.message-row:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 168, 0.35);
  box-shadow: var(--shadow-sm);
}

.message-subject {
  margin-bottom: 6px;
  font-weight: 800;
}

.message-meta {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.message-body {
  margin-top: 22px;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  white-space: pre-wrap;
  line-height: 1.65;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 117, 200, 0.1);
  border: 1px solid rgba(15, 117, 200, 0.18);
  color: var(--secondary);
  font-size: 0.88rem;
  font-weight: 700;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}

.checkbox-input {
  width: auto;
}

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

.customer-table th,
.customer-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.customer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  width: 100%;
}

.customer-toolbar > * {
  flex: 1 1 220px;
}

.agenda-calendar-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 22px;
}

.agenda-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  min-width: 1080px;
}

.agenda-weekday,
.agenda-day {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  padding: 12px;
}

.agenda-weekday {
  text-align: center;
  font-weight: 800;
  color: var(--secondary);
  background: linear-gradient(135deg, rgba(14, 165, 168, 0.1), rgba(15, 117, 200, 0.09));
}

.agenda-day {
  min-height: 150px;
}

.agenda-day.outside-month {
  opacity: 0.45;
}

.agenda-day.today {
  outline: 2px solid rgba(245, 158, 11, 0.6);
  outline-offset: 2px;
}

.agenda-day.busy {
  background: rgba(15, 117, 200, 0.06);
  border-color: rgba(15, 117, 200, 0.24);
}

.agenda-day-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  display: flex;
  justify-content: space-between;
  align-items: start;
  text-align: left;
  cursor: pointer;
}

.agenda-day-number {
  font-size: 1.04rem;
  font-weight: 800;
}

.agenda-count {
  color: var(--muted);
  font-size: 0.88rem;
}

.agenda-events {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.agenda-event {
  display: grid;
  gap: 4px;
  padding: 9px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  font-size: 0.9rem;
  line-height: 1.35;
}

.agenda-event small {
  color: var(--muted);
}

.agenda-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(18, 48, 71, 0.42);
}

.agenda-modal.show {
  display: flex;
}

.agenda-modal-panel {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.agenda-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}

.agenda-modal-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.3rem;
  line-height: 1;
}

code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(15, 117, 200, 0.08);
  color: var(--secondary);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .shell {
    width: min(100% - 20px, 100%);
  }
}

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
