:root {
  --bg: #f2f5f4;
  --surface: #ffffff;
  --surface-strong: #f8fbfa;
  --ink: #17201d;
  --muted: #60706b;
  --line: #dce6e2;
  --line-strong: #c9d7d2;
  --teal: #087f73;
  --teal-strong: #05695f;
  --teal-soft: #e6f4f1;
  --amber: #b97310;
  --amber-soft: #fff3d8;
  --red: #b73835;
  --red-soft: #fdeceb;
  --blue: #315c9b;
  --blue-soft: #eaf1fb;
  --slate: #14221f;
  --shadow: 0 12px 28px rgba(23, 32, 29, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
a.disabled {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

.icon-sprite,
.hidden-input {
  display: none;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.app-shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 18px;
  background: var(--slate);
  color: #f7fbfa;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #ecfaf7;
  background: var(--teal);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

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

.brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand small {
  margin-top: 3px;
  color: #acc3bd;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 0 10px;
  color: #c9d8d4;
  text-decoration: none;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 650;
}

.nav-link:hover,
.nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  color: #c6d9d4;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note strong {
  color: #ffffff;
  font-size: 13px;
}

.sidebar-note span {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

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

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

h1 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.topbar p,
.section-header p,
.panel-header p,
.panel > p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.language-switcher select {
  min-width: 104px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
  font-weight: 800;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(390px, 32vw);
  height: 42px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}

.button,
.icon-button,
.segment,
.car-segment {
  border: 0;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.button.primary:hover {
  background: var(--teal-strong);
}

.button.secondary {
  color: var(--teal-strong);
  background: var(--teal-soft);
  border-color: #c5e5df;
}

.button.ghost:hover {
  background: var(--surface-strong);
}

.button.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f0c9c8;
}

.full-width {
  width: 100%;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

.icon-actions {
  gap: 6px;
  flex-wrap: nowrap;
}

.icon-actions .icon-button {
  width: 34px;
  height: 34px;
  border-radius: 6px;
}

.icon-actions .button {
  min-height: 34px;
  padding: 0 10px;
}

.icon-button-view {
  color: #24566a;
  background: #eef7f8;
  border-color: #cde5e9;
}

.icon-button-whatsapp {
  color: #087f55;
  background: #e5f7ef;
  border-color: #bfe8d5;
}

.icon-button-edit {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #cbdaf1;
}

.icon-button-danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f0c9c8;
}

.icon-button-print,
.icon-button-contract {
  color: var(--teal-strong);
  background: var(--teal-soft);
  border-color: #c5e5df;
}

.section {
  scroll-margin-top: 24px;
  margin-bottom: 28px;
}

.section-header,
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  position: relative;
  overflow: hidden;
  display: grid;
  width: 100%;
  gap: 10px;
  min-height: 122px;
  padding: 16px;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-link {
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.metric-link:hover,
.metric-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--metric-accent, var(--teal));
  box-shadow: 0 18px 34px rgba(23, 32, 29, 0.12);
  outline: 0;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--metric-accent, var(--teal));
}

.metric::after {
  content: "";
  position: absolute;
  right: -26px;
  top: -30px;
  width: 96px;
  height: 96px;
  background: color-mix(in srgb, var(--metric-accent, var(--teal)) 14%, transparent);
  border-radius: 50%;
}

.metric-tone-teal { --metric-accent: #087f73; --metric-soft: #e6f4f1; }
.metric-tone-blue { --metric-accent: #315c9b; --metric-soft: #eaf1fb; }
.metric-tone-amber { --metric-accent: #b97310; --metric-soft: #fff3d8; }
.metric-tone-red { --metric-accent: #b73835; --metric-soft: #fdeceb; }
.metric-tone-orange { --metric-accent: #d85b2f; --metric-soft: #fff0e8; }
.metric-tone-mint { --metric-accent: #0e9f6e; --metric-soft: #e8f7ef; }
.metric-tone-violet { --metric-accent: #7555b8; --metric-soft: #f1edfb; }
.metric-tone-cyan { --metric-accent: #147c9c; --metric-soft: #e8f6fb; }
.metric-tone-slate { --metric-accent: #43504c; --metric-soft: #eef2f1; }
.metric-tone-green { --metric-accent: #2f855a; --metric-soft: #e9f6ee; }
.metric-tone-indigo { --metric-accent: #4f46a5; --metric-soft: #efeffd; }

.metric-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric-top svg {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 5px;
  color: var(--metric-accent, var(--teal));
  background: var(--metric-soft, var(--teal-soft));
  border-radius: 50%;
}

.metric strong {
  position: relative;
  z-index: 1;
  font-size: 28px;
  line-height: 1;
  color: var(--metric-accent, var(--ink));
}

.metric span:last-child {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-overview {
  display: grid;
  grid-template-columns: minmax(170px, 0.7fr) 220px minmax(0, 2fr);
  align-items: center;
  gap: 22px;
  margin-bottom: 16px;
}

.overview-copy h2 {
  font-size: 19px;
}

.overview-copy p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.donut-chart {
  position: relative;
  display: grid;
  place-items: center;
  width: 210px;
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  box-shadow: 0 16px 38px rgba(23, 32, 29, 0.12);
}

.donut-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.donut-segment {
  cursor: pointer;
  transition: opacity 160ms ease, stroke-width 160ms ease, filter 160ms ease;
}

.donut-segment:hover,
.donut-segment:focus-visible {
  opacity: 0.86;
  stroke-width: 40;
  filter: drop-shadow(0 4px 7px rgba(23, 32, 29, 0.18));
  outline: 0;
}

.donut-center {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 112px;
  aspect-ratio: 1;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: inset 0 0 0 8px var(--surface-strong);
}

.donut-center strong {
  font-size: 34px;
  line-height: 1;
}

.donut-center span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.overview-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  text-align: start;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.legend-item:hover,
.legend-item:focus-visible {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: var(--line-strong);
  outline: 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-item span:nth-child(2) {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-item strong {
  font-size: 12px;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(310px, 0.8fr);
  gap: 16px;
}

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

.panel {
  padding: 18px;
}

.panel-wide {
  grid-row: span 2;
}

.accent-panel {
  color: #f9fffd;
  background: #15352f;
  border-color: #15352f;
}

.accent-panel .panel-header p,
.accent-panel .timeline-meta,
.accent-panel .reply-preview-meta {
  color: #b8d4ce;
}

.panel-icon {
  width: 26px;
  height: 26px;
  color: #73d8c8;
}

.timeline {
  display: grid;
  gap: 10px;
}

.notification-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.notification-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 11px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.notification-item {
  min-height: 60px;
}

.timeline-dot,
.notification-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 7px;
}

.notification-late .notification-icon,
.notification-urgent .notification-icon {
  color: var(--red);
  background: var(--red-soft);
}

.notification-credit .notification-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.timeline-title,
.notification-title,
.reply-preview-title {
  font-size: 14px;
  font-weight: 800;
}

.timeline-meta,
.notification-meta,
.reply-preview-meta,
.table-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.notification-item .icon-actions {
  justify-content: flex-end;
}

.mini-reply {
  display: grid;
  gap: 12px;
}

.reply-preview {
  padding: 13px;
  color: var(--ink);
  background: #ffffff;
  border-radius: 7px;
}

.reply-preview-message {
  margin-top: 10px;
  color: #263a35;
  font-size: 13px;
  line-height: 1.5;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segment,
.car-segment {
  min-height: 32px;
  padding: 0 11px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
}

.segment.active,
.car-segment.active {
  color: #ffffff;
  background: var(--teal);
}

.table-panel,
.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.compact-table table {
  min-width: 760px;
}

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

th {
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-main {
  font-weight: 800;
}

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

.vehicle-thumb {
  flex: 0 0 auto;
  width: 54px;
  height: 38px;
  object-fit: cover;
  background: #eef6f4;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.vehicle-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--teal);
}

.vehicle-thumb-empty svg {
  width: 28px;
  height: 20px;
}

.status-pill,
.car-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status-pending,
.status-confirmed,
.status-partial,
.status-planned,
.status-draft {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-active,
.status-rented,
.status-paid,
.status-ready {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-late,
.status-alert,
.status-unpaid,
.status-canceled {
  color: var(--red);
  background: var(--red-soft);
}

.status-completed,
.status-available,
.status-published,
.status-online {
  color: var(--teal-strong);
  background: var(--teal-soft);
}

.status-maintenance,
.status-inactive,
.status-closed,
.status-paused,
.status-offline {
  color: #5d6670;
  background: #edf0f2;
}

.publication-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.publication-profile {
  display: grid;
  gap: 12px;
}

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

.publication-stats span {
  display: grid;
  gap: 4px;
  padding: 10px;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
}

.publication-stats strong {
  color: var(--ink);
  font-size: 20px;
}

.copy-panel textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
}

.publication-table table {
  min-width: 920px;
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.finance-card {
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.finance-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.finance-card strong {
  font-size: 25px;
  line-height: 1.05;
}

.finance-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.finance-card.profit-positive {
  border-color: rgba(8, 127, 115, 0.25);
  background: linear-gradient(180deg, #ffffff, #f3fbf8);
}

.finance-card.profit-negative {
  border-color: rgba(183, 56, 53, 0.24);
  background: linear-gradient(180deg, #ffffff, #fff7f6);
}

.gps-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
}

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

.gps-map {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(8, 127, 115, 0.12), rgba(49, 92, 155, 0.09)),
    #f7fbfa;
}

.gps-map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  filter: saturate(0.9) contrast(0.96);
}

#gpsPins {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(20, 34, 31, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 34, 31, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
}

.map-road {
  position: absolute;
  height: 16px;
  width: 130%;
  left: -15%;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(201, 215, 210, 0.9);
  border-radius: 999px;
}

.road-a {
  top: 34%;
  transform: rotate(-16deg);
}

.road-b {
  top: 58%;
  transform: rotate(12deg);
}

.road-c {
  top: 74%;
  transform: rotate(-4deg);
}

.gps-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 58px;
  height: 42px;
  padding: 3px;
  transform: translate(-50%, -50%);
  color: var(--teal-strong);
  background: #ffffff;
  border: 2px solid #bfe3dc;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(20, 34, 31, 0.16);
  pointer-events: auto;
}

.gps-pin img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #eef6f4;
  border-radius: 9px;
}

.gps-pin svg {
  width: 30px;
  height: 22px;
}

.gps-pin.status-alert {
  color: var(--red);
  border-color: #f1b9b7;
}

.gps-pin.status-offline {
  color: #5d6670;
  border-color: #cfd6da;
}

.gps-battery {
  width: 72px;
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  background: #e7ecea;
  border-radius: 999px;
}

.gps-battery span {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}

.credit-progress {
  width: 108px;
  height: 8px;
  margin-top: 7px;
  overflow: hidden;
  background: #e4efec;
  border-radius: 999px;
}

.credit-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #f7c948);
  border-radius: inherit;
}

.compact-section-header {
  margin-bottom: 12px;
}

.gps-table table {
  min-width: 820px;
}

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

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

.car-card,
.client-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.car-media {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 12px;
  background: linear-gradient(135deg, #eef6f4, #f9fbfb);
  border: 1px solid #e2ece8;
  border-radius: 7px;
}

.car-media img {
  width: min(72%, 210px);
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
}

.car-media svg {
  width: 74px;
  height: 44px;
  color: var(--teal);
}

.photo-upload {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.photo-upload p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.photo-preview {
  display: grid;
  place-items: center;
  min-height: 112px;
  overflow: hidden;
  color: var(--teal);
  background: linear-gradient(135deg, #eef6f4, #ffffff);
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
}

.photo-preview img {
  width: 100%;
  height: 132px;
  object-fit: cover;
}

.photo-preview svg {
  width: 82px;
  height: 52px;
}

.card-title {
  font-size: 16px;
  font-weight: 850;
}

.card-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.card-line strong {
  color: var(--ink);
  text-align: right;
}

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

.client-card {
  gap: 8px;
}

.client-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #ffffff;
  background: var(--blue);
  border-radius: 7px;
  font-weight: 850;
}

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

.form-grid.single {
  grid-template-columns: 1fr;
}

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

label,
.wide-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  padding: 10px 11px;
  font-size: 14px;
}

textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8fc9c0;
  box-shadow: 0 0 0 3px rgba(8, 127, 115, 0.12);
}

.wide-label {
  margin: 14px 0 10px;
}

.reply-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 16px;
}

.reply-panel textarea {
  min-height: 245px;
  margin-bottom: 12px;
}

#replyOutput[dir="rtl"] {
  text-align: right;
}

.option-set {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.option-set legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.check-line {
  display: inline-flex;
  grid-template-columns: auto;
  align-items: center;
  gap: 7px;
}

.check-line input {
  width: 16px;
  min-height: auto;
}

dialog {
  width: min(780px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

#contractDialog {
  width: min(920px, calc(100vw - 28px));
}

#signatureDialog {
  width: min(620px, calc(100vw - 28px));
}

.contract-dialog {
  max-height: calc(100vh - 32px);
  overflow: auto;
}

dialog::backdrop {
  background: rgba(20, 34, 31, 0.46);
}

.dialog-card {
  padding: 18px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}

.contract-preview {
  --contract-ink: #4f5295;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 20px 12px;
  color: var(--contract-ink);
  background: #fffdf4;
  border: 2px solid #d7d0aa;
  border-radius: 2px;
  box-shadow: 0 12px 34px rgba(23, 36, 45, 0.14);
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.2;
}

.contract-letterhead {
  position: relative;
  display: grid;
  grid-template-columns: 96px 1fr 120px;
  align-items: center;
  min-height: 104px;
  text-align: center;
}

.contract-logo-mark {
  justify-self: center;
  width: 82px;
  height: 82px;
  border-left: 8px solid var(--contract-ink);
  border-bottom: 4px solid var(--contract-ink);
  border-radius: 50%;
  transform: rotate(34deg);
  font-size: 0;
}

.contract-brand strong,
.contract-brand span {
  display: block;
  font-weight: 950;
  font-style: italic;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.contract-brand strong {
  font-size: 34px;
}

.contract-brand span {
  margin-top: 6px;
  font-size: 32px;
}

.contract-car-icon {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 96px;
  height: 54px;
  border-bottom: 4px solid rgba(79, 82, 149, 0.38);
}

.contract-car-icon svg {
  width: 76px;
  height: 46px;
  stroke-width: 1.4;
}

.contract-letterhead h2 {
  grid-column: 1 / -1;
  margin: -2px 0 5px;
  font-size: 18px;
  font-style: italic;
  letter-spacing: 0;
}

.contract-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid var(--contract-ink);
}

.contract-panel {
  min-height: 610px;
  border-right: 2px solid var(--contract-ink);
}

.contract-panel:last-child {
  border-right: 0;
}

.contract-panel h3,
.vehicle-state h4,
.payment-box h4 {
  margin: 0;
  padding: 4px 6px;
  text-align: center;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0;
  border-bottom: 1px solid var(--contract-ink);
}

.contract-line {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 5px;
  align-items: end;
  min-height: 23px;
  padding: 3px 8px 0;
}

.contract-line span {
  color: var(--contract-ink);
  font-size: 11px;
  font-weight: 800;
}

.contract-line strong {
  min-height: 15px;
  color: #1f2857;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px dotted var(--contract-ink);
}

.contract-subtitle {
  margin-top: 5px;
  padding: 5px 8px 3px;
  text-align: center;
  font-weight: 900;
  border-top: 1px solid var(--contract-ink);
  border-bottom: 1px solid var(--contract-ink);
}

.contract-spaced {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--contract-ink);
}

.contract-inline-checks,
.vehicle-tools,
.vehicle-km {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 5px 8px;
}

.contract-inline-checks > span,
.vehicle-km span {
  font-weight: 900;
}

.contract-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
}

.contract-check i {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #1f2857;
  border: 1px solid var(--contract-ink);
  font-style: normal;
  font-size: 11px;
  line-height: 1;
}

.vehicle-state {
  border-top: 2px solid var(--contract-ink);
  border-bottom: 1px solid var(--contract-ink);
}

.vehicle-state h4 {
  border-bottom: 1px solid var(--contract-ink);
}

.fuel-gauge {
  position: relative;
  width: 76px;
  height: 34px;
  border-bottom: 2px solid var(--contract-ink);
  overflow: hidden;
}

.fuel-gauge::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -28px;
  height: 56px;
  border: 2px solid var(--contract-ink);
  border-radius: 999px 999px 0 0;
}

.fuel-gauge span {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  font-size: 10px;
}

.fuel-gauge i {
  position: absolute;
  left: 36px;
  bottom: 0;
  width: 2px;
  height: 30px;
  background: var(--contract-ink);
  transform: rotate(-56deg);
  transform-origin: bottom center;
}

.vehicle-km {
  justify-content: space-between;
  border-top: 1px solid var(--contract-ink);
}

.vehicle-km strong {
  min-width: 66px;
  min-height: 17px;
  color: #1f2857;
  border-bottom: 1px dotted var(--contract-ink);
  text-align: center;
}

.vehicle-sketch {
  position: relative;
  width: 92px;
  height: 48px;
  margin: 0 auto 4px;
  border: 2px solid var(--contract-ink);
  border-radius: 48% 48% 24% 24%;
}

.vehicle-sketch span {
  position: absolute;
  border: 1px solid var(--contract-ink);
}

.vehicle-sketch span:nth-child(1) {
  left: 22px;
  top: -9px;
  width: 46px;
  height: 16px;
  border-radius: 50% 50% 0 0;
}

.vehicle-sketch span:nth-child(2),
.vehicle-sketch span:nth-child(3) {
  bottom: -8px;
  width: 20px;
  height: 12px;
  border-radius: 999px;
}

.vehicle-sketch span:nth-child(2) {
  left: 10px;
}

.vehicle-sketch span:nth-child(3) {
  right: 10px;
}

.vehicle-state p {
  margin: 0;
  padding: 4px 8px;
  text-align: center;
  font-size: 11px;
}

.contract-notes {
  min-height: 74px;
  padding: 5px 8px;
  color: #1f2857;
  background:
    repeating-linear-gradient(180deg, transparent 0 21px, rgba(79, 82, 149, 0.55) 22px, transparent 23px);
}

.insurance-box {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  border-bottom: 1px solid var(--contract-ink);
}

.insurance-box > * {
  min-height: 28px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--contract-ink);
  border-bottom: 1px solid var(--contract-ink);
  text-align: center;
}

.insurance-box > :nth-child(3n) {
  border-right: 0;
}

.insurance-box > :nth-child(n + 4) {
  border-bottom: 0;
}

.contract-terms {
  min-height: 56px;
  margin: 0;
  padding: 6px 8px;
  font-size: 10px;
}

.payment-box {
  margin-top: 5px;
  border-top: 1px solid var(--contract-ink);
}

.payment-box h4 {
  margin: 2px auto 0;
  width: 70%;
  border: 1px solid var(--contract-ink);
  border-bottom: 1px solid var(--contract-ink);
}

.contract-signature {
  display: grid;
  place-items: start center;
  min-height: 82px;
  padding: 9px;
  border-top: 1px solid var(--contract-ink);
  text-align: center;
}

.contract-signature-image {
  max-width: 82%;
  max-height: 58px;
  margin-top: 7px;
  object-fit: contain;
}

.contract-signature.agency {
  min-height: 112px;
  align-content: space-between;
}

.contract-signature span {
  justify-self: stretch;
  text-align: left;
  border-bottom: 1px dotted var(--contract-ink);
}

.signature-dialog {
  display: grid;
  gap: 14px;
}

.signature-screen {
  padding: 10px;
  background:
    linear-gradient(rgba(8, 127, 115, 0.08) 1px, transparent 1px),
    #f8fbfa;
  background-size: 100% 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

#signatureCanvas {
  display: block;
  width: 100%;
  height: 220px;
  background: #ffffff;
  border: 1px dashed #b9c9c4;
  border-radius: 7px;
  cursor: crosshair;
  touch-action: none;
}

.contract-footer {
  padding-top: 9px;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  max-width: 340px;
  padding: 12px 14px;
  color: #ffffff;
  background: #17201d;
  border-radius: 7px;
  box-shadow: var(--shadow);
  font-size: 14px;
  transition: 160ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-strong);
  border: 1px dashed var(--line);
  border-radius: 7px;
}

@media (max-width: 1260px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-overview {
    grid-template-columns: minmax(150px, 0.8fr) 190px minmax(0, 1.6fr);
  }

  .donut-chart {
    width: 184px;
  }

  .overview-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .sidebar {
    position: static;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow: hidden;
  }

  .nav-list {
    display: flex;
    min-width: max-content;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .sidebar-note {
    display: none;
  }

  .dashboard-grid,
  .dashboard-overview,
  .reply-grid,
  .gps-grid,
  .branch-bank-grid,
  .publication-grid,
  .finance-grid {
    grid-template-columns: 1fr;
  }

  .donut-chart {
    justify-self: start;
  }

  .cards-grid,
  .client-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-box {
    width: min(100%, 420px);
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .section-header,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    width: 100%;
  }

  .topbar-actions .button,
  .topbar-actions .icon-button {
    width: 100%;
  }

  .search-box {
    grid-column: 1 / -1;
    width: 100%;
  }

  #openNewReservation {
    grid-column: 1 / -1;
  }

  .metrics-grid,
  .overview-legend,
  .publication-grid,
  .finance-grid,
  .branch-bank-grid,
  .cards-grid,
  .client-grid,
  .form-grid,
  .inline-fields,
  .contract-columns {
    grid-template-columns: 1fr;
  }

  .contract-panel {
    border-right: 0;
    border-bottom: 2px solid var(--contract-ink);
  }

  .contract-panel:last-child {
    border-bottom: 0;
  }

  .contract-letterhead {
    grid-template-columns: 64px 1fr 72px;
  }

  .contract-brand strong {
    font-size: 24px;
  }

  .contract-brand span {
    font-size: 22px;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segment,
  .car-segment {
    flex: 1 0 auto;
  }

  .timeline-item,
  .notification-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .timeline-item .status-pill {
    grid-column: 2;
    width: max-content;
  }

  .notification-item .icon-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .photo-upload {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 7mm;
  }

  body * {
    visibility: hidden;
  }

  #contractDialog,
  #contractDialog * {
    visibility: visible;
  }

  #contractDialog {
    position: absolute;
    inset: 0;
    width: 100%;
    max-height: none;
    box-shadow: none;
  }

  .contract-dialog {
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .no-print,
  .dialog-actions {
    display: none !important;
  }

  .contract-preview {
    width: 190mm;
    min-height: 275mm;
    padding: 7mm;
    box-shadow: none;
    border: 2px solid #d7d0aa;
    font-size: 11px;
  }
}
