:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #17202f;
  --muted: #657084;
  --line: #dfe5ef;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #d97706;
  --danger: #dc2626;
  --success: #15803d;
  --sidebar: #111827;
  --shadow: 0 18px 40px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 268px;
  background: var(--sidebar);
  color: #f8fafc;
  padding: 22px 16px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  overflow-x: hidden;
}
.sidebar .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 222px;
  height: 104px;
  margin: 0 auto 22px;
  overflow: hidden;
}
.sidebar .logo img {
  display: block;
  width: 210px;
  height: 99px;
  max-width: 210px;
  max-height: 99px;
  object-fit: contain;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}
.nav { display: grid; gap: 4px; }
.nav a {
  color: #cbd5e1;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.nav a.active, .nav a:hover { background: #1f2937; color: #fff; }

.main { margin-left: 268px; width: calc(100% - 268px); }
.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}
.topbar h1 { margin: 0; font-size: 24px; line-height: 1.2; }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 26px 28px 42px; }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(6, minmax(150px, 1fr)); }
.two-col { grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.card h2, .card h3 { margin: 0 0 14px; }
.stat strong { display: block; font-size: 26px; margin-top: 8px; }
.stat span { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.btn, button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}
.btn.primary, button.primary { background: var(--brand); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: #edf7f5; color: var(--brand-dark); }
.btn.danger-soft, button.danger-soft { background: #fee2e2; color: #991b1b; }
.btn.full { width: 100%; }
.icon-btn { background: #eef2f7; color: var(--ink); display: none; width: 42px; padding: 0; }
.user-pill { color: var(--muted); font-size: 13px; background: #f1f5f9; padding: 10px 12px; border-radius: 8px; }

label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.checks { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px; }
.checks label { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.checks input { width: auto; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 10px; vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #e2e8f0; color: #334155; font-size: 12px; font-weight: 800; }
.badge.available, .badge.confirmed, .badge.completed { background: #dcfce7; color: #166534; }
.badge.rented, .badge.delivered { background: #dbeafe; color: #1d4ed8; }
.badge.pending, .badge.maintenance { background: #fef3c7; color: #92400e; }
.badge.cancelled, .badge.passive { background: #fee2e2; color: #991b1b; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.day { min-height: 118px; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px; }
.day:nth-child(7n) { border-right: 0; }
.day strong { display: block; margin-bottom: 7px; }
.event { display: block; margin-top: 5px; padding: 6px; border-radius: 6px; background: #edf7f5; color: var(--brand-dark); font-size: 12px; font-weight: 700; }
.event.reserved { background: #fee2e2; color: #991b1b; }

.alert { border-radius: 8px; padding: 11px 13px; margin-bottom: 14px; font-weight: 700; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.danger { background: #fee2e2; color: #991b1b; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f7fafc, #e8f3f1);
}
.auth-shell { width: min(980px, 100%); display: grid; grid-template-columns: .9fr 1.1fr; gap: 22px; align-items: center; }
.install-shell { width: min(1120px, 100%); }
.auth-brand h1 { font-size: 42px; margin: 18px 0 10px; }
.auth-brand p { color: var(--muted); font-size: 17px; line-height: 1.6; }
.auth-logo {
  width: 280px;
  height: 132px;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
.thumb {
  width: 92px;
  height: 62px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
}
.caravan-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}
.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.source-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 24px; display: grid; gap: 14px; }

@media (max-width: 1200px) {
  .stats, .three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; }
  .icon-btn { display: inline-grid; place-items: center; }
  .topbar { align-items: flex-start; padding: 14px 16px; }
  .content { padding: 18px 16px 30px; }
  .stats, .three, .form-grid.two, .auth-shell { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar { grid-template-columns: 1fr; }
  .day { border-right: 0; }
  .top-actions { width: 100%; justify-content: flex-start; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .toolbar form, .toolbar .btn { display: none !important; }
  .main { margin: 0; width: 100%; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  #print-area { font-size: 14px; }
}
