:root {
  --bg: #f4f7f4;
  --panel: #ffffff;
  --panel-2: #f8fbf8;
  --ink: #1f2923;
  --muted: #637067;
  --line: #dbe4dd;
  --primary: #18794e;
  --primary-2: #0f5f3b;
  --accent: #d17b0f;
  --cyan: #177e89;
  --red: #b64242;
  --violet: #6554c0;
  --shadow: 0 18px 45px rgba(27, 44, 34, 0.12);
  --radius: 8px;
  --sidebar: #15261c;
  --sidebar-2: #20362a;
}

/* Dashboard premium e shell SaaS */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #15803d;
  --primary-2: #166534;
  --accent: #f59e0b;
  --cyan: #0284c7;
  --violet: #7c3aed;
  --red: #dc2626;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --sidebar: #ffffff;
  --sidebar-2: #f8fafc;
}

body {
  background:
    radial-gradient(circle at 16% 0%, rgba(21, 128, 61, 0.09), transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(2, 132, 199, 0.08), transparent 28%),
    var(--bg);
}

.app-shell {
  grid-template-columns: 282px minmax(0, 1fr);
  transition: grid-template-columns 300ms ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 86px minmax(0, 1fr);
}

.sidebar {
  color: var(--ink);
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  border-right: 1px solid var(--line);
  box-shadow: 14px 0 38px rgba(15, 23, 42, 0.04);
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  padding: 8px 6px 18px;
  border-bottom: 0;
}

.brand img,
.login-brand img {
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(21, 128, 61, 0.14);
}

.brand strong {
  color: var(--primary-2);
  font-size: 16px;
  line-height: 1.15;
}

.brand span,
.sidebar-user span {
  color: var(--muted);
}

.sidebar-collapse-btn {
  color: var(--primary-2);
  background: #ecfdf5;
  border-color: #bbf7d0;
}

body.sidebar-collapsed .brand {
  grid-template-columns: 48px;
  justify-content: center;
}

body.sidebar-collapsed .brand div,
body.sidebar-collapsed .sidebar-collapse-btn,
body.sidebar-collapsed .nav-btn span,
body.sidebar-collapsed .sidebar-user > div:first-child {
  display: none;
}

.side-nav {
  gap: 8px;
}

.nav-btn {
  position: relative;
  min-height: 48px;
  border-radius: 12px;
  color: var(--ink);
  padding: 11px 13px;
  transition: transform 200ms ease, background 200ms ease, color 200ms ease, box-shadow 200ms ease;
}

.nav-btn:hover {
  color: var(--primary-2);
  background: #ecfdf5;
  transform: translateX(2px);
}

.nav-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #15803d, #047857);
  box-shadow: 0 14px 28px rgba(21, 128, 61, 0.22);
}

body.sidebar-collapsed .nav-btn {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .nav-btn:hover::after {
  content: attr(title);
  position: absolute;
  left: 62px;
  z-index: 30;
  min-width: max-content;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 700;
}

.sidebar-user {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.sidebar-user-actions .icon-btn {
  color: var(--primary-2);
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.sidebar-user-actions .icon-btn:hover {
  background: #dcfce7;
}

body.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: 10px 6px;
}

body.sidebar-collapsed .sidebar-user-actions {
  display: grid;
}

.topbar {
  min-height: 86px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.82);
  background: rgba(248, 250, 252, 0.88);
}

.topbar h1 {
  font-size: 26px;
  font-weight: 800;
}

.topbar-actions {
  align-items: center;
}

.notification-btn {
  position: relative;
  border-radius: 12px;
}

.notification-btn em {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--primary);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.topbar-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #15803d);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.16);
  font-weight: 800;
}

.content {
  width: min(1540px, 100%);
}

.btn,
.icon-btn,
input,
select,
textarea {
  border-radius: 12px;
}

.btn {
  min-height: 42px;
  font-weight: 750;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.btn-primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, #15803d, #047857);
  box-shadow: 0 14px 26px rgba(21, 128, 61, 0.18);
}

.dashboard-surface {
  display: grid;
  gap: 18px;
  animation: dashboardEnter 420ms ease both;
}

@keyframes dashboardEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-command-bar,
.dash-card,
.dash-kpi {
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.dashboard-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
}

.breadcrumb {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-command-bar h2 {
  margin: 5px 0 4px;
  font-size: 28px;
}

.dashboard-command-bar p {
  margin: 0;
  color: var(--muted);
}

.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.period-control {
  min-width: 154px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.period-control select {
  min-height: 40px;
  border: 0;
  padding-inline: 2px;
  box-shadow: none;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 16px;
}

.dash-kpi {
  position: relative;
  min-height: 172px;
  overflow: hidden;
  padding: 20px;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.dash-kpi:hover,
.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 58px rgba(15, 23, 42, 0.11);
}

.dash-kpi-top {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.dash-kpi-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--primary);
  background: #dcfce7;
}

.dash-kpi-blue .dash-kpi-icon {
  color: #2563eb;
  background: #dbeafe;
}

.dash-kpi-cyan .dash-kpi-icon {
  color: #0284c7;
  background: #e0f2fe;
}

.dash-kpi-violet .dash-kpi-icon {
  color: #7c3aed;
  background: #ede9fe;
}

.dash-kpi-amber .dash-kpi-icon {
  color: #d97706;
  background: #fef3c7;
}

.dash-kpi strong {
  display: block;
  margin-top: 14px;
  font-size: 26px;
}

.dash-kpi p {
  min-height: 20px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.dash-delta {
  font-weight: 800;
}

.dash-delta.positive {
  color: var(--primary);
}

.dash-delta.negative {
  color: var(--red);
}

.sparkline {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  width: calc(100% - 36px);
  height: 42px;
}

.sparkline polyline,
.sparkline path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.4;
}

.sparkline-blue polyline {
  stroke: #2563eb;
}

.sparkline-cyan polyline {
  stroke: #0284c7;
}

.sparkline-violet polyline {
  stroke: #7c3aed;
}

.sparkline-amber polyline {
  stroke: #f59e0b;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 3fr);
  gap: 18px;
}

.dashboard-insights-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr) minmax(0, 1.18fr);
  gap: 18px;
}

.dash-card {
  min-width: 0;
  padding: 20px;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.dash-card-head.compact {
  align-items: center;
}

.dash-card h3 {
  margin: 0;
  font-size: 17px;
}

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

.dash-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.link-button {
  border: 0;
  color: var(--primary-2);
  background: transparent;
  font-weight: 800;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend-line {
  width: 28px;
  height: 6px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 999px;
  vertical-align: middle;
}

.legend-line.green {
  background: var(--primary);
}

.legend-line.blue {
  background: #2563eb;
}

.line-chart {
  width: 100%;
  height: 300px;
}

.chart-gridline {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.line-area {
  fill: url(#litersArea);
}

.line-path {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-path.green,
.chart-point.green {
  stroke: var(--primary);
  fill: var(--primary);
}

.line-path.blue,
.chart-point.blue {
  stroke: #2563eb;
  fill: #2563eb;
}

.chart-point {
  stroke: #ffffff;
  stroke-width: 2;
}

.alert-stack,
.dash-bar-list,
.driver-ranking {
  display: grid;
  gap: 14px;
}

.alert-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
}

.alert-item > div {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #2563eb;
}

.alert-item.success > div {
  background: var(--primary);
}

.alert-item.warning > div {
  background: #f59e0b;
}

.alert-item.neutral > div {
  background: #7c3aed;
}

.alert-item strong,
.alert-item small {
  display: block;
}

.alert-item small {
  margin-top: 4px;
  color: var(--muted);
}

.dash-doughnut-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.dash-doughnut {
  width: 144px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.dash-doughnut span {
  width: 86px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  text-align: center;
}

.dash-doughnut strong,
.dash-doughnut small {
  display: block;
}

.dash-doughnut small {
  color: var(--muted);
  font-size: 11px;
}

.dash-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
}

.dash-bar-label span {
  color: var(--ink);
  font-weight: 800;
}

.dash-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.dash-bar-track span {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--primary);
}

.driver-ranking article {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.rank-medal {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e2e8f0;
  font-weight: 900;
}

.rank-1 {
  background: #fef3c7;
  color: #92400e;
}

.rank-2 {
  background: #e2e8f0;
  color: #334155;
}

.rank-3 {
  background: #fed7aa;
  color: #9a3412;
}

.driver-ranking b {
  white-space: nowrap;
}

.dash-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dashboard-search {
  max-width: 460px;
  min-width: 280px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.dashboard-search input {
  border: 0;
  box-shadow: none;
}

.dashboard-table-wrap {
  border-radius: 14px;
}

.dashboard-table th button {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.dashboard-table tbody tr {
  transition: background 160ms ease;
}

.dashboard-table tbody tr:hover {
  background: #f8fafc;
}

.dash-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.dash-pagination > div {
  display: flex;
  gap: 8px;
}

@media (max-width: 1180px) {
  .dashboard-kpi-grid,
  .dashboard-main-grid,
  .dashboard-insights-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-main-grid .dash-card-large,
  .dashboard-table-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  body.sidebar-collapsed .app-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-command-bar,
  .dash-table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-toolbar,
  .dashboard-kpi-grid,
  .dashboard-main-grid,
  .dashboard-insights-grid {
    grid-template-columns: 1fr;
  }

  .dash-doughnut-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(24, 121, 78, 0.08), transparent 240px),
    var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(21, 38, 28, 0.86), rgba(24, 121, 78, 0.74)),
    var(--login-bg-image, url("./assets/semed.jpg")) center / cover;
}

.login-panel {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

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

.login-brand img,
.brand img {
  width: 58px;
  height: 48px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
  padding: 3px;
}

.login-brand strong,
.brand strong {
  display: block;
  font-size: 18px;
}

.login-brand span,
.brand span {
  display: block;
  color: var(--muted);
  margin-top: 2px;
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-link {
  width: fit-content;
  justify-self: center;
  border: 0;
  color: var(--primary-2);
  background: transparent;
  padding: 2px 4px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-link:hover {
  color: var(--primary);
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  padding: 9px 10px;
  outline: none;
}

input[readonly] {
  cursor: not-allowed;
  color: var(--primary-2);
  background: var(--panel-2);
  border-style: dashed;
  font-weight: 700;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24, 121, 78, 0.14);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.login-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.remember-login {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -2px;
  color: var(--primary-2);
  font-size: 13px;
  font-weight: 700;
}

.remember-login input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.remember-login[hidden] {
  display: none !important;
}

.developer-credit {
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
}

.login-credit {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--primary-2);
  text-align: center;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 16px;
  color: #eef6ef;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
}

.brand {
  padding: 6px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand span {
  color: rgba(238, 246, 239, 0.72);
}

.side-nav {
  display: grid;
  gap: 5px;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  padding: 9px 11px;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-btn.active {
  box-shadow: inset 3px 0 0 #ffc857;
}

.nav-btn svg,
.btn svg,
.icon-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke: currentColor;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

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

.sidebar-user span {
  color: rgba(238, 246, 239, 0.72);
  font-size: 12px;
}

.sidebar-user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-user-actions .icon-btn {
  color: #eef6ef;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-user-actions .icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 78px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 244, 0.92);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

body[data-environment]:not([data-environment="producao"]) .topbar h1::after {
  content: "TESTE";
  display: inline-flex;
  margin-left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #7a4300;
  background: rgba(209, 123, 15, 0.16);
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

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

.topbar .main-credit {
  margin-top: 3px;
  color: var(--primary-2);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.content {
  width: min(1440px, 100%);
  padding: 24px 28px 42px;
}

.btn,
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  min-height: 38px;
  padding: 8px 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

.btn-primary:hover {
  background: var(--primary-2);
}

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

.btn-ghost {
  background: rgba(255, 255, 255, 0.72);
}

.btn-soft {
  border-color: rgba(24, 121, 78, 0.18);
  color: var(--primary-2);
  background: rgba(24, 121, 78, 0.1);
}

.icon-btn {
  width: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.toolbar,
.filter-bar,
.page-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-heading {
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-heading h2 {
  margin: 0;
  font-size: 20px;
}

.page-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-bar {
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.filter-bar label {
  min-width: 170px;
  flex: 1;
}

.search-field {
  min-width: 260px;
  flex: 1 1 280px;
}

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

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

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

.kpi-card,
.panel,
.stat-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(35, 51, 41, 0.06);
}

.kpi-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
}

.kpi-icon.green {
  background: var(--primary);
}

.kpi-icon.amber {
  background: var(--accent);
}

.kpi-icon.cyan {
  background: var(--cyan);
}

.kpi-icon.violet {
  background: var(--violet);
}

.kpi-icon.red {
  background: var(--red);
}

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

.kpi-card strong {
  display: block;
  margin-top: 2px;
  font-size: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

.dashboard-grid-requests {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

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

.dashboard-request-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.dashboard-request-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
}

.dashboard-request-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dashboard-request-title strong {
  font-size: 14px;
}

.dashboard-request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-request-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.ranking-grid h4 {
  margin: 0 0 12px;
  font-size: 13px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

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

.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

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

.chart-wrap {
  min-height: 240px;
  display: grid;
  align-items: end;
}

.bar-chart {
  width: 100%;
  height: 260px;
}

.chart-axis {
  fill: var(--muted);
  font-size: 11px;
}

.fuel-dashboard-grid {
  display: grid;
  gap: 16px;
}

.fuel-dashboard-grid h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13px;
}

.fuel-dashboard-grid .donut-row {
  grid-template-columns: 128px 1fr;
  gap: 14px;
}

.fuel-dashboard-grid .donut {
  width: 122px;
}

.fuel-dashboard-grid .donut span {
  width: 76px;
  font-size: 12px;
}

.donut-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  width: 160px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0 60%, var(--accent) 60% 82%, var(--cyan) 82% 100%);
}

.donut span {
  width: 92px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  font-weight: 700;
}

.legend {
  display: grid;
  gap: 9px;
}

.legend-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.hbar-list {
  display: grid;
  gap: 12px;
}

.hbar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.hbar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2ed;
}

.hbar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

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

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

th {
  color: var(--muted);
  background: #f6faf6;
  font-weight: 700;
}

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

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

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

.ticket-list-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.ticket-id,
.ticket-info-grid div {
  min-width: 0;
}

.ticket-id span,
.ticket-info-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.ticket-id strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
}

.ticket-id small {
  display: inline-flex;
  margin-top: 7px;
}

.ticket-status {
  min-height: 22px;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: #eef3ef;
  font-size: 11px;
  font-weight: 700;
}

.ticket-status.pending {
  color: #7a4300;
  background: rgba(209, 123, 15, 0.15);
}

.ticket-status.approved {
  color: var(--primary-2);
  background: rgba(24, 121, 78, 0.14);
}

.ticket-status.refused {
  color: var(--red);
  background: rgba(182, 66, 66, 0.12);
}

.ticket-status.emitted {
  color: #fff;
  background: var(--primary);
}

.ticket-status.voided {
  color: #111;
  background: repeating-linear-gradient(135deg, rgba(182, 66, 66, 0.18), rgba(182, 66, 66, 0.18) 6px, rgba(182, 66, 66, 0.08) 6px, rgba(182, 66, 66, 0.08) 12px);
  border: 1px solid rgba(182, 66, 66, 0.35);
}

.ticket-info-grid {
  display: grid;
  grid-template-columns: 84px minmax(110px, 1.3fr) 92px 92px;
  gap: 10px;
  min-width: 0;
  align-items: start;
}

.ticket-info-grid.history {
  grid-template-columns: 80px minmax(140px, 1fr);
}

.ticket-info-grid.approval {
  grid-template-columns: minmax(140px, 1.2fr) 90px minmax(120px, 1fr) 130px;
}

.tickets-panel {
  margin-top: 16px;
}

.approval-panel {
  border-color: rgba(209, 123, 15, 0.28);
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
}

.ticket-list-wide {
  gap: 8px;
}

.ticket-list-item-wide {
  grid-template-columns: 86px minmax(0, 1fr) auto;
}

.ticket-info-grid.ticket-single {
  grid-template-columns: 82px 92px minmax(150px, 1.2fr) 110px 92px;
}

.ticket-info-grid strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.ticket-action {
  justify-self: end;
}

.ticket-action-stack {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.ticket-filter-bar label {
  min-width: 190px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--primary-2);
  background: rgba(24, 121, 78, 0.1);
}

.badge.warn {
  color: #7a4300;
  background: rgba(209, 123, 15, 0.14);
}

.badge.red {
  color: var(--red);
  background: rgba(182, 66, 66, 0.1);
}

.contract-limits-panel {
  margin-top: 18px;
}

.contract-limit-list {
  display: grid;
  gap: 12px;
}

.contract-limit-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.contract-limit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.contract-limit-head span,
.contract-fuel-title span,
.contract-fuel-metrics span,
.contract-fuel-preview span,
.contract-fuel-preview small {
  color: var(--muted);
  font-size: 12px;
}

.contract-limit-head strong,
.contract-fuel-title strong {
  display: block;
  margin-top: 2px;
}

.contract-fuel-list,
.contract-fuel-preview {
  display: grid;
  gap: 10px;
}

.contract-fuel-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--panel-2);
}

.contract-fuel-row.attention {
  border-left-color: var(--accent);
  background: rgba(209, 123, 15, 0.08);
}

.contract-fuel-row.alert {
  border-left-color: #b66a00;
  background: rgba(209, 123, 15, 0.14);
}

.contract-fuel-row.exceeded {
  border-left-color: var(--red);
  background: rgba(182, 66, 66, 0.10);
}

.contract-fuel-row.no-quota {
  border-left-color: var(--muted);
}

.contract-fuel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.contract-fuel-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 8px;
}

.contract-fuel-metrics > div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.contract-fuel-metrics strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.contract-quota-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 41, 35, 0.12);
}

.contract-quota-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.contract-fuel-row.attention .contract-quota-meter span,
.contract-fuel-row.alert .contract-quota-meter span {
  background: var(--accent);
}

.contract-fuel-row.exceeded .contract-quota-meter span {
  background: var(--red);
}

.contract-fuel-preview {
  padding: 14px;
  border: 1px solid rgba(24, 121, 78, 0.22);
  border-radius: 8px;
  background: rgba(24, 121, 78, 0.07);
}

.contract-fuel-preview h3 {
  margin: 0;
  font-size: 16px;
}

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

.contract-fuel-preview-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.contract-fuel-preview-item strong {
  display: block;
  margin: 4px 0;
  font-size: 18px;
}

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

.audit-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(35, 51, 41, 0.045);
}

.audit-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--primary-2);
  background: rgba(24, 121, 78, 0.09);
}

.audit-main {
  min-width: 0;
}

.audit-card-head,
.audit-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-card-head strong {
  font-size: 15px;
}

.audit-card-head span,
.audit-meta span {
  color: var(--muted);
  font-size: 12px;
}

.audit-main p {
  margin: 4px 0 7px;
  color: var(--ink);
  font-size: 13px;
}

.audit-meta span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
}

.audit-detail {
  display: grid;
  gap: 14px;
}

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

.audit-json-grid h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.audit-json-grid pre {
  min-height: 180px;
  max-height: 340px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--panel-2);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 16px;
}

.stat-strip div {
  padding: 14px 16px;
  background: var(--panel);
}

.stat-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-strip strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(21, 38, 28, 0.48);
}

.modal-card {
  width: min(980px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 18px;
}

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

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .span-3 {
  grid-column: 1 / -1;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-note strong {
  color: var(--ink);
}

.reset-delivery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
}

.location-field {
  align-items: start;
}

.location-field input[data-location-input] {
  width: 100%;
  min-width: 0;
}

.location-combo {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-action-btn {
  width: 40px;
  min-height: 40px;
}

.location-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(21, 38, 28, 0.56);
}

.location-picker-card {
  width: min(620px, 100%);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.location-picker-header h3 {
  margin: 0;
  font-size: 17px;
}

.location-picker-body {
  display: grid;
  gap: 14px;
  padding: 18px;
  overflow: auto;
}

.location-add,
.location-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.location-list {
  display: grid;
  gap: 8px;
}

.location-row {
  grid-template-columns: minmax(0, 1fr) 38px 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.location-row-edit {
  grid-template-columns: minmax(0, 1fr) 38px 38px;
}

.location-select {
  min-height: 38px;
  border: 0;
  color: var(--ink);
  background: transparent;
  padding: 0 4px;
  text-align: left;
}

.location-select:hover {
  color: var(--primary-2);
}

.total-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(24, 121, 78, 0.22);
  border-radius: var(--radius);
  background: rgba(24, 121, 78, 0.08);
}

.total-preview strong {
  font-size: 22px;
}

.ticket-preview {
  width: min(80mm, 100%);
  max-width: 320px;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid #111;
  border-radius: 4px;
  color: #111;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.ticket-preview *,
.thermal-ticket-print * {
  font-weight: 700;
}

.ticket-head {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 6px;
  align-items: center;
  border-bottom: 2px solid #111;
  padding-bottom: 5px;
  margin-bottom: 5px;
  text-align: center;
}

.ticket-head img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: grayscale(1) contrast(1.12);
}

.ticket-head strong,
.report-print strong {
  display: block;
}

.ticket-head span {
  display: block;
  margin-top: 1px;
}

.ticket-head strong,
.ticket-head span {
  white-space: nowrap;
}

.ticket-lines {
  display: grid;
  gap: 0;
}

.ticket-lines div {
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  gap: 5px;
  align-items: start;
  border-bottom: 1px dashed #333;
  padding: 3px 0;
}

.ticket-lines span {
  text-transform: uppercase;
}

.ticket-lines strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.ticket-lines .ticket-liters {
  grid-template-columns: 1fr;
  gap: 1px;
  padding: 5px 0;
  border-top: 2px solid #111;
  border-bottom: 2px solid #111;
  text-align: center;
}

.ticket-lines .ticket-liters strong {
  text-align: center;
  font-size: 24px;
  line-height: 1.1;
}

.ticket-lines .ticket-void-row {
  color: #111;
  background: #f1f1f1;
  border: 2px solid #111;
  padding: 4px;
}

.ticket-lines .ticket-void-row strong {
  text-align: right;
}

.ticket-total {
  margin-top: 6px;
  padding: 6px;
  color: #111;
  background: #fff;
  border: 2px solid #111;
  border-radius: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
}

.ticket-void-note {
  margin-top: 6px;
  padding: 6px;
  border: 2px solid #111;
  text-align: center;
  font-size: 12px;
  line-height: 1.25;
  color: #111;
  background: #fff;
}

.ticket-void-note small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
}

.ticket-authenticity {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
}

.ticket-authenticity strong,
.ticket-authenticity span,
.ticket-authenticity small {
  display: block;
}

.ticket-authenticity span {
  margin-top: 2px;
  color: #111;
  font-size: 10px;
}

.ticket-authenticity small {
  margin-top: 3px;
  font-size: 10px;
}

.ticket-qr {
  display: grid;
  place-items: center;
}

.ticket-qr-code {
  width: 74px;
  height: 74px;
}

.signature {
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
}

.verification-mode .app-shell {
  grid-template-columns: 1fr;
}

.verification-mode .sidebar,
.verification-mode .topbar-actions,
.verification-mode #menuToggle {
  display: none;
}

.verification-mode .main {
  min-height: 100vh;
}

.verification-panel {
  max-width: 860px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(35, 51, 41, 0.06);
}

.verification-state {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.verification-state .btn-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
}

.verification-state.valid .btn-icon {
  background: var(--primary);
}

.verification-state.invalid .btn-icon {
  background: var(--red);
}

.verification-state.loading .btn-icon {
  background: var(--cyan);
}

.verification-state h2 {
  margin: 0;
}

.verification-state p {
  margin: 4px 0 0;
  color: var(--muted);
}

.verification-state small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.verification-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.verification-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.verification-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.verification-grid strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

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

.settings-grid .span-2 {
  grid-column: span 2;
}

.setting-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(35, 51, 41, 0.06);
}

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

.brand-preview {
  grid-row: span 2;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.brand-preview img {
  width: 70px;
  height: 58px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
}

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

.brand-preview span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(72px, 1fr));
  gap: 10px;
}

.color-field {
  min-width: 0;
}

.color-field input {
  min-height: 38px;
  padding: 4px;
}

.setting-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-form .span-3 {
  grid-column: 1 / -1;
}

.danger-zone {
  border-color: rgba(182, 66, 66, 0.28);
  background: rgba(182, 66, 66, 0.05);
}

.technical-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.technical-info div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.technical-info span,
.technical-info strong {
  display: block;
}

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

.technical-info p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.setting-tile {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.setting-tile h3 {
  margin: 0;
  font-size: 16px;
}

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

.connection-form {
  display: grid;
  gap: 12px;
}

.secure-connection {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}

.secure-connection div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.secure-connection span,
.secure-connection small {
  color: var(--muted);
  font-size: 12px;
}

.secure-connection strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.connection-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 13px;
}

.connection-status.ok {
  border-color: rgba(24, 121, 78, 0.28);
  color: var(--primary-2);
  background: rgba(24, 121, 78, 0.08);
}

.connection-status.error {
  border-color: rgba(182, 66, 66, 0.3);
  color: var(--red);
  background: rgba(182, 66, 66, 0.07);
}

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--sidebar);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.mobile-only {
  display: none;
}

.print-mount {
  display: none;
}

.official-report {
  --report-primary: var(--primary);
  --report-primary-2: var(--primary-2);
  --report-accent: var(--accent);
  --report-ink: #1f2923;
  --report-panel: #fff;
  background: #fff;
  color: var(--report-ink);
}

.official-report-header {
  display: grid;
  grid-template-columns: 88px 1fr minmax(130px, 180px);
  gap: 14px;
  align-items: center;
  border-top: 8px solid var(--report-primary);
  border-bottom: 3px solid var(--report-accent);
  padding: 14px 0 12px;
}

.official-report-logo-box {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: 2px solid color-mix(in srgb, var(--report-primary) 30%, #fff);
  border-left: 7px solid var(--report-primary);
  background: #fff;
}

.official-report-logo {
  max-width: 70px;
  max-height: 70px;
  object-fit: contain;
}

.official-report-heading {
  min-width: 0;
}

.official-report-heading strong {
  display: block;
  font-size: 10px;
  line-height: 1.35;
  text-transform: uppercase;
}

.official-report-heading h1 {
  margin: 8px 0 4px;
  color: var(--report-primary-2);
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: uppercase;
}

.official-report-heading p,
.official-report-meta span,
.official-report-summary span,
.official-filter-grid span,
.official-report-footer span {
  color: #56645d;
}

.official-report-heading p {
  margin: 0;
  font-size: 11px;
}

.official-report-meta {
  display: grid;
  gap: 4px;
  justify-items: end;
  align-content: center;
  border-left: 3px solid color-mix(in srgb, var(--report-accent) 55%, #fff);
  padding-left: 12px;
  text-align: right;
}

.official-report-meta span {
  font-size: 9px;
  text-transform: uppercase;
}

.official-report-meta strong {
  font-size: 11px;
}

.official-report-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.official-report-summary div {
  border: 1px solid color-mix(in srgb, var(--report-primary) 18%, #d9e1dd);
  border-left: 5px solid var(--report-primary);
  padding: 8px 10px;
  background: color-mix(in srgb, var(--report-primary) 5%, #fff);
}

.official-report-summary span,
.official-filter-grid span {
  display: block;
  margin-bottom: 3px;
  font-size: 8.5px;
  text-transform: uppercase;
}

.official-report-summary strong {
  font-size: 13px;
}

.official-report-filters {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #d7dfda;
  background: #fbfdfc;
}

.official-report-filters h2 {
  margin: 0 0 8px;
  color: var(--report-primary-2);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.official-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px 10px;
}

.official-filter-grid strong {
  font-size: 10px;
  line-height: 1.25;
  word-break: break-word;
}

.official-report-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.official-report-table th,
.official-report-table td {
  border: 1px solid #9aa7a0;
  padding: 4px;
  font-size: 8px;
  line-height: 1.25;
  vertical-align: top;
  word-break: break-word;
}

.official-report-table th {
  background: var(--report-primary-2);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
}

.official-report-table tfoot th {
  background: color-mix(in srgb, var(--report-accent) 18%, #fff);
  color: var(--report-ink);
}

.official-report-empty {
  padding: 18px;
  color: #56645d;
  text-align: center;
}

.official-report-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 2px solid var(--report-primary);
}

.official-report-footer strong {
  display: block;
  margin-top: 4px;
  font-size: 10px;
}

.official-signature {
  text-align: center;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 280px;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-grid;
  }

  .topbar {
    padding: 14px 18px;
  }

  .topbar-actions {
    display: none;
  }

  .content {
    width: 100%;
    padding: 18px 18px 34px;
  }

  .page-heading {
    align-items: stretch;
  }

  .page-heading > div:first-child {
    min-width: 0;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar .btn {
    flex: 1 1 220px;
  }

  .filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    align-items: end;
  }

  .filter-bar label,
  .ticket-filter-bar label {
    min-width: 0;
    width: 100%;
  }

  .filter-bar .btn {
    width: 100%;
  }

  .ticket-list-item,
  .ticket-list-item-wide {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ticket-info-grid,
  .ticket-info-grid.ticket-single,
  .ticket-info-grid.history,
  .ticket-info-grid.approval {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ticket-action {
    justify-self: stretch;
  }

  .ticket-action-stack {
    min-width: 0;
  }

  .ticket-action .btn,
  .ticket-action .icon-btn {
    width: 100%;
  }

  .dashboard-grid,
  .audit-summary,
  .settings-grid,
  .settings-form,
  .technical-info {
    grid-template-columns: 1fr;
  }

  .settings-grid .span-2 {
    grid-column: auto;
  }

  .contract-fuel-metrics,
  .contract-fuel-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .color-grid {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar-actions {
    display: none;
  }

  .kpi-grid,
  .audit-summary,
  .stat-strip,
  .form-grid,
  .settings-form,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .brand-preview,
  .technical-info,
  .ticket-authenticity,
  .verification-state,
  .contract-fuel-metrics,
  .contract-fuel-preview-grid,
  .color-grid {
    grid-template-columns: 1fr;
  }

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

  .donut-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .form-grid .span-2,
  .form-grid .span-3 {
    grid-column: auto;
  }

  .ticket-list-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .dashboard-request-card,
  .ranking-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-request-actions {
    justify-content: stretch;
  }

  .dashboard-request-actions .btn {
    flex: 1;
  }

  .audit-card,
  .audit-json-grid {
    grid-template-columns: 1fr;
  }

  .audit-card > .btn {
    width: 100%;
  }

  .ticket-info-grid,
  .ticket-info-grid.ticket-single,
  .ticket-info-grid.history,
  .ticket-info-grid.approval {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ticket-action {
    justify-self: stretch;
  }

  .ticket-action .btn {
    width: 100%;
  }

  .ticket-action .icon-btn {
    width: 100%;
  }

  .location-add {
    grid-template-columns: 1fr;
  }

  .page-heading {
    align-items: stretch;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar .btn,
  .filter-bar .btn {
    flex: 1;
  }
}

@media print {
  @page official-report {
    size: A4 landscape;
    margin: 8mm;
  }

  @page thermal-ticket {
    size: 80mm 210mm;
    margin: 1.5mm;
  }

  body.printing > *:not(.print-mount) {
    display: none !important;
  }

  body.printing .print-mount {
    display: block;
    color: #111;
    background: #fff;
    padding: 0;
  }

  .print-page {
    width: 100%;
    padding: 18mm;
    font-family: Arial, sans-serif;
  }

  .thermal-ticket-print {
    page: thermal-ticket;
    width: 72mm;
    max-width: 72mm;
    margin: 0 auto;
    padding: 0;
    color: #111;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9.2pt;
    line-height: 1.1;
    box-sizing: border-box;
    overflow: hidden;
  }

  .thermal-ticket-print .ticket-head,
  .thermal-ticket-print .ticket-lines div,
  .thermal-ticket-print .ticket-total,
  .thermal-ticket-print .ticket-authenticity,
  .thermal-ticket-print .signature {
    break-inside: avoid;
  }

  .thermal-ticket-print .ticket-head {
    grid-template-columns: 10.5mm minmax(0, 1fr);
    gap: 1.5mm;
    padding-bottom: 1.6mm;
    margin-bottom: 1.5mm;
  }

  .thermal-ticket-print .ticket-head img {
    width: 10mm;
    height: 10mm;
  }

  .thermal-ticket-print .ticket-head strong,
  .thermal-ticket-print .ticket-head span {
    white-space: nowrap;
    line-height: 1.08;
    font-size: 8.8pt;
  }

  .thermal-ticket-print .ticket-lines div {
    grid-template-columns: 37% minmax(0, 1fr);
    gap: 1.6mm;
    padding: 0.9mm 0;
  }

  .thermal-ticket-print .ticket-lines .ticket-liters strong {
    font-size: 20pt;
    line-height: 1;
  }

  .thermal-ticket-print .ticket-lines .ticket-liters {
    padding: 1.8mm 0;
  }

  .thermal-ticket-print .ticket-total {
    margin-top: 1.8mm;
    padding: 1.8mm;
    font-size: 13pt;
  }

  .thermal-ticket-print .ticket-authenticity {
    grid-template-columns: 21mm minmax(0, 1fr);
    gap: 1.8mm;
    margin-top: 1.8mm;
    padding: 1.8mm;
  }

  .thermal-ticket-print .ticket-qr-code {
    width: 20mm;
    height: 20mm;
  }

  .thermal-ticket-print .ticket-authenticity span,
  .thermal-ticket-print .ticket-authenticity small {
    font-size: 7pt;
    line-height: 1.1;
  }

  .thermal-ticket-print .ticket-authenticity span {
    margin-top: 0.8mm;
  }

  .thermal-ticket-print .ticket-authenticity small {
    margin-top: 1mm;
  }

  .thermal-ticket-print .signature {
    margin-top: 6mm;
    font-size: 8pt;
    line-height: 1.05;
  }

  .print-page table {
    min-width: 0;
    width: 100%;
    border-collapse: collapse;
  }

  .print-page th,
  .print-page td {
    border: 1px solid #777;
    padding: 6px;
    font-size: 10px;
  }

  .print-page th {
    background: #eee;
    color: #111;
  }

  .official-report {
    page: official-report;
    padding: 8mm;
  }

  .official-report-header,
  .official-report-summary,
  .official-report-filters,
  .official-report-footer {
    break-inside: avoid;
  }

  .official-report-header {
    grid-template-columns: 82px 1fr 160px;
    gap: 12px;
  }

  .official-report-summary {
    grid-template-columns: repeat(4, 1fr);
  }

  .official-filter-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .official-report-table {
    page-break-inside: auto;
  }

  .official-report-table thead {
    display: table-header-group;
  }

  .official-report-table tfoot {
    display: table-footer-group;
  }

  .official-report-table tr {
    break-inside: avoid;
  }

  .official-report .official-report-table th,
  .official-report .official-report-table td {
    padding: 3.5px;
    font-size: 7.4px;
  }

  .official-report .official-report-table th {
    background: var(--report-primary-2);
    color: #fff;
  }

  .official-report .official-report-table tfoot th {
    background: color-mix(in srgb, var(--report-accent) 18%, #fff);
    color: var(--report-ink);
  }
}

/* Ajustes de estabilidade do menu lateral e uso no APK */
.sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  min-height: 32px;
  color: #166534;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  box-shadow: none;
}

.sidebar-collapse-btn:hover,
.sidebar-collapse-btn:focus-visible {
  color: #0f172a;
  background: #fbbf24;
  border-color: #fde68a;
}

body.sidebar-collapsed .sidebar-collapse-btn {
  display: inline-grid;
  position: static;
  margin: 8px auto 0;
  z-index: 4;
  width: 28px;
  height: 28px;
  min-height: 28px;
  color: #166534;
  background: rgba(236, 253, 245, 0.92);
  border: 1px solid #86efac;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

body.sidebar-collapsed .brand {
  position: relative;
}

@media (max-width: 1060px) {
  body.menu-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(15, 23, 42, 0.38);
  }

  body.menu-open .sidebar {
    width: min(88vw, 320px);
  }

  body.menu-open.sidebar-collapsed .brand {
    display: flex;
    justify-content: space-between;
  }

  body.menu-open.sidebar-collapsed .brand div,
  body.menu-open.sidebar-collapsed .nav-btn span,
  body.menu-open.sidebar-collapsed .sidebar-user > div:first-child {
    display: block;
  }

  body.menu-open.sidebar-collapsed .sidebar-collapse-btn {
    position: static;
    display: inline-grid;
  }

  body.menu-open.sidebar-collapsed .nav-btn {
    justify-content: flex-start;
    padding: 9px 11px;
  }

  body.menu-open.sidebar-collapsed .sidebar-user {
    justify-content: space-between;
    padding: 12px;
  }

  body.menu-open.sidebar-collapsed .sidebar-user-actions {
    display: flex;
  }
}

/* Aproximação visual com a identidade de Mazagão: vermelho, dourado e base clara. */
:root {
  --bg: #fffaf0;
  --panel: #ffffff;
  --panel-2: #fff7ed;
  --ink: #18181b;
  --muted: #6b5f59;
  --line: #f1d59d;
  --primary: #d90404;
  --primary-2: #8b0000;
  --accent: #ffc400;
  --cyan: #f97316;
  --violet: #7f1d1d;
  --red: #b00000;
  --shadow: 0 18px 46px rgba(127, 29, 29, 0.09);
  --sidebar: #fffefa;
  --sidebar-2: #fff7ed;
}

body {
  background: linear-gradient(180deg, #fffdf8 0%, var(--bg) 46%, #fff7ed 100%);
}

.sidebar {
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 196, 0, 0.12), rgba(217, 4, 4, 0.035) 34%, transparent 72%),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  border-right: 1px solid rgba(217, 4, 4, 0.12);
  box-shadow: 12px 0 34px rgba(127, 29, 29, 0.06);
}

.brand {
  border-bottom: 1px solid rgba(217, 4, 4, 0.1);
}

.brand img,
.login-brand img {
  border: 1px solid rgba(255, 196, 0, 0.65);
  border-radius: 16px;
  box-shadow: 0 12px 26px rgba(217, 4, 4, 0.13);
}

.brand strong,
.login-credit,
.topbar .main-credit {
  color: var(--primary-2);
}

.brand span,
.sidebar-user span {
  color: var(--muted);
}

.nav-btn {
  color: #372018;
  border-radius: 14px;
}

.nav-btn svg,
.btn svg,
.icon-btn svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-btn > svg {
  width: 20px;
  height: 20px;
  padding: 5px;
  border-radius: 12px;
  color: var(--primary-2);
  background: rgba(255, 196, 0, 0.16);
  box-sizing: content-box;
}

.nav-btn:hover {
  color: var(--primary-2);
  background: rgba(255, 196, 0, 0.14);
}

.nav-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 15px 30px rgba(217, 4, 4, 0.22);
}

.nav-btn.active > svg {
  color: #7f1d1d;
  background: linear-gradient(135deg, #fff3b0, var(--accent));
}

.sidebar-collapse-btn,
.sidebar-user-actions .icon-btn {
  color: var(--primary-2);
  border-color: rgba(255, 196, 0, 0.64);
  background: rgba(255, 196, 0, 0.16);
}

.sidebar-collapse-btn:hover,
.sidebar-collapse-btn:focus-visible,
.sidebar-user-actions .icon-btn:hover {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

body.sidebar-collapsed .sidebar-collapse-btn {
  color: var(--primary-2);
  background: #fff7cc;
  border-color: rgba(255, 196, 0, 0.8);
}

.sidebar-user {
  color: var(--ink);
  border-color: rgba(217, 4, 4, 0.13);
  background: rgba(255, 255, 255, 0.82);
}

.topbar {
  background: rgba(255, 250, 240, 0.9);
  border-bottom: 1px solid rgba(217, 4, 4, 0.11);
}

.dashboard-command-bar,
.dash-card,
.dash-kpi,
.panel,
.card,
.metric,
.table-wrap {
  border-color: rgba(217, 4, 4, 0.1);
}

.btn-primary {
  border-color: var(--primary);
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 26px rgba(217, 4, 4, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f11212, var(--primary-2));
}

.btn-soft {
  border-color: rgba(255, 196, 0, 0.52);
  color: var(--primary-2);
  background: rgba(255, 196, 0, 0.14);
}

.btn-ghost:hover,
.icon-btn:hover {
  border-color: rgba(217, 4, 4, 0.18);
  color: var(--primary-2);
}

.dash-kpi-icon,
.kpi-icon.green,
.dashboard-request-icon {
  color: var(--primary-2);
  background: rgba(255, 196, 0, 0.18);
}

.dash-kpi-blue .dash-kpi-icon,
.kpi-icon.cyan {
  color: #9a3412;
  background: rgba(249, 115, 22, 0.14);
}

.dash-kpi-cyan .dash-kpi-icon,
.kpi-icon.amber {
  color: #a16207;
  background: rgba(255, 196, 0, 0.18);
}

.dash-kpi-violet .dash-kpi-icon,
.kpi-icon.violet {
  color: var(--primary-2);
  background: rgba(217, 4, 4, 0.1);
}

.dash-kpi-amber .dash-kpi-icon,
.kpi-icon.red {
  color: var(--primary);
  background: rgba(217, 4, 4, 0.09);
}

.sparkline polyline,
.sparkline path {
  stroke: var(--primary);
}

.sparkline-blue polyline,
.chart-line-blue {
  stroke: var(--cyan);
}

.sparkline-cyan polyline,
.sparkline-violet polyline {
  stroke: var(--accent);
}

.dash-bar-track span,
.hbar-fill {
  background: linear-gradient(90deg, var(--primary), var(--accent)) !important;
}
