:root {
  --bg: #f4f6f4;
  --panel: #ffffff;
  --panel-soft: #f9faf8;
  --text: #17211d;
  --muted: #66736c;
  --line: #dce2dc;
  --green: #5b8f22;
  --green-dark: #416c18;
  --plum: #9a2767;
  --blue: #25739f;
  --amber: #b56b14;
  --red: #b83232;
  --shadow: 0 14px 35px rgba(18, 31, 24, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

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

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  background: #eef2ec;
  border-right: 1px solid var(--line);
  padding: 18px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 6px 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--plum));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
}

.brand-title {
  font-weight: 700;
  line-height: 1.15;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #dfe7dd;
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.role-switch button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 8px 6px;
  color: var(--muted);
}

.role-switch button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
}

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

.nav button {
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 10px 10px;
  color: var(--muted);
}

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

.content {
  min-width: 0;
  padding: 22px 26px 36px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

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

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

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

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

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 7px;
  min-height: 36px;
  padding: 8px 12px;
}

.btn.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn.plum {
  background: var(--plum);
  color: #fff;
  border-color: var(--plum);
}

.btn.warn {
  background: var(--amber);
  color: #fff;
  border-color: var(--amber);
}

.btn.danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.panel-body {
  padding: 16px;
}

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

.field label {
  font-weight: 700;
  font-size: 12px;
  color: #334039;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cdd6ce;
  border-radius: 7px;
  padding: 10px 11px;
  min-height: 38px;
  background: #fff;
}

.field textarea {
  resize: vertical;
  min-height: 78px;
}

.call-card {
  display: grid;
  gap: 14px;
  max-width: 980px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.choice {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  min-height: 92px;
  text-align: left;
}

.choice.active {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px rgba(91, 143, 34, 0.22);
}

.choice strong {
  display: block;
  font-size: 15px;
  margin-bottom: 5px;
}

.choice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.client-list {
  display: grid;
  gap: 8px;
  max-height: 500px;
  overflow: auto;
}

.client-row,
.appointment-row,
.slot-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
  display: grid;
  gap: 5px;
}

.client-row.selected {
  border-color: var(--green);
  background: #f1f7ec;
}

.row-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #e7ece7;
  color: #334039;
  white-space: nowrap;
}

.badge.collecte {
  background: #e8f2dd;
  color: var(--green-dark);
}

.badge.livraison {
  background: #e4f0f6;
  color: #175e83;
}

.badge.vide-maison {
  background: #f4e7ef;
  color: #7c1c52;
}

.badge.apport {
  background: #f7eddf;
  color: #8b4f0e;
}

.calendar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar {
  overflow: auto;
  border-top: 1px solid var(--line);
}

.vehicle-calendar {
  min-width: 1120px;
  display: grid;
  grid-template-columns: 94px repeat(11, 1fr);
}

.calendar-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 56px;
  background: #fff;
  padding: 6px;
  position: relative;
}

.calendar-head {
  min-height: 48px;
  background: #eef3ed;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}

.time-cell {
  background: #f7f8f6;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.event {
  border-radius: 7px;
  padding: 7px;
  font-size: 12px;
  line-height: 1.25;
  color: #fff;
  min-height: 42px;
}

.event.collecte {
  background: var(--green);
}

.event.livraison {
  background: var(--blue);
}

.event.vide-maison {
  background: var(--plum);
}

.event.apport {
  background: var(--amber);
}

.agenda {
  display: grid;
  grid-template-columns: 170px repeat(5, minmax(150px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.agenda > div {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px;
  min-height: 58px;
  background: #fff;
}

.agenda .head,
.agenda .time {
  background: #eef3ed;
  font-weight: 700;
}

.apport-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.apport-slot {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  min-height: 138px;
}

.apport-slot.locked {
  background: #ecefed;
  color: #7c847f;
}

.apport-slot.filled {
  border-color: var(--green);
}

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

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

.table th {
  color: var(--muted);
  font-size: 12px;
  background: #f5f7f4;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 20px;
}

.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal .panel-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

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

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #17211d;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.print-area {
  display: none;
}

.bon-sheet {
  page-break-after: always;
  padding: 22px;
  border: 1px solid #222;
  margin-bottom: 16px;
  min-height: 520px;
}

.bon-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid #222;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.signature {
  height: 86px;
  border: 1px solid #555;
  margin-top: 8px;
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .grid.two,
  .grid.three,
  .choice-grid,
  .form-grid,
  .apport-board {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 16px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .shell,
  .toast,
  .modal-backdrop {
    display: none !important;
  }

  .print-area {
    display: block;
    font-size: 12px;
  }
}
