:root {
  color-scheme: dark;
  --bg: #071017;
  --surface: #101d26;
  --surface-2: #142631;
  --surface-3: #0d1821;
  --border: #29404d;
  --text: #f4f7f8;
  --muted: #9eb0ba;
  --green: #38c96d;
  --blue: #3aa9ff;
  --yellow: #f1b72b;
  --red: #ff594f;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(12, 25, 34, 0.74), transparent 320px),
    radial-gradient(circle at 12% 0%, rgba(56, 201, 109, 0.12), transparent 25rem),
    radial-gradient(circle at 88% 4%, rgba(58, 169, 255, 0.1), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
}

.public-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 16px;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
}

.public-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 310px;
  background: url("/assets/brand/dadalto-bi-pattern.svg") center top / cover no-repeat;
  opacity: 0.62;
  pointer-events: none;
}

.app-topbar,
.demo-alert,
.filters,
.view-tabs,
.dashboard {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.app-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.public-brand {
  display: inline-grid;
  margin-bottom: 12px;
  width: min(278px, 72vw);
  padding: 8px 12px;
  border: 1px solid rgba(56, 201, 109, 0.18);
  border-radius: 10px;
  background: rgba(7, 16, 23, 0.48);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.public-brand img {
  display: block;
  width: 100%;
  height: auto;
}

.app-topbar h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1;
}

.app-topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

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

.top-actions a,
.view-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(13, 24, 33, 0.86);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.top-actions a:first-child,
.view-tabs button.active {
  border-color: rgba(56, 201, 109, 0.58);
  background: rgba(56, 201, 109, 0.1);
  color: #99efb3;
}

.demo-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(241, 183, 43, 0.34);
  border-radius: var(--radius);
  background: rgba(241, 183, 43, 0.08);
  color: #ffe1a0;
  font-size: 13px;
  line-height: 1.4;
}

.demo-alert strong {
  color: #fff0bd;
  font-size: 12px;
  text-transform: uppercase;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(12, 24, 33, 0.78);
}

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

.field label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0b1821;
  color: var(--text);
  padding: 0 9px;
  outline: none;
}

.field input:focus,
.field select:focus,
.view-tabs button:focus-visible,
.top-actions a:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(56, 201, 109, 0.14);
  outline: none;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-tabs button {
  cursor: pointer;
}

.dashboard {
  display: grid;
  gap: 16px;
  min-width: 0;
}

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

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

.kpi-card,
.metric-card,
.fleet-card,
.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 33, 43, 0.94), rgba(9, 18, 26, 0.94));
  box-shadow: var(--shadow);
}

.kpi-card {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 142px;
  padding: 15px;
}

.gauge {
  width: 104px;
  height: 82px;
}

.gauge path {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
}

.gauge .track {
  stroke: #223742;
}

.gauge .ok {
  stroke: var(--green);
}

.gauge .warn {
  stroke: var(--yellow);
}

.gauge .bad {
  stroke: var(--red);
}

.kpi-card span,
.metric-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.kpi-card strong,
.metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: 23px;
  line-height: 1;
}

.kpi-card em,
.metric-card em {
  display: block;
  margin-top: 8px;
  color: #bfd0d7;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.metric-card {
  padding: 15px;
}

.metric-card.positive {
  border-color: rgba(56, 201, 109, 0.34);
}

.metric-card.warning {
  border-color: rgba(241, 183, 43, 0.34);
}

.grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.main-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.85fr);
}

.two-one {
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.8fr);
}

.panel {
  padding: 17px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.1;
}

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

.panel-head strong {
  color: #cce7d6;
}

.bar-chart {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 104px;
  gap: 10px;
  align-items: center;
  color: #cbd8de;
  font-size: 12px;
}

.bar-stack {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #21343f;
}

.bar-stack i,
.bar-stack b {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar-stack i {
  background: rgba(241, 183, 43, 0.22);
}

.bar-stack b {
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.risk-list,
.rank-list,
.driver-list,
.root-list,
.audit-list,
.approval-list {
  display: grid;
  gap: 9px;
}

.risk-item,
.rank-row,
.driver-row,
.root-row,
.audit-item,
.approval-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(8, 17, 24, 0.62);
}

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

.rank-row,
.driver-row,
.root-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.audit-item {
  grid-template-columns: 14px minmax(0, 1fr) auto;
}

.approval-row {
  grid-template-columns: 58px 72px minmax(0, 1fr) auto;
}

.risk-item b,
.rank-row b,
.driver-row b,
.root-row b {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(58, 169, 255, 0.34);
  border-radius: 50%;
  color: #9bd6ff;
  font-size: 12px;
}

.risk-item strong,
.rank-row strong,
.driver-row strong,
.root-row strong,
.approval-row strong {
  display: block;
  color: #eef7f5;
  font-size: 13px;
}

.risk-item span,
.rank-row span,
.driver-row span,
.root-row span,
.approval-row span,
.audit-item em,
.rank-row em,
.driver-row em,
.root-row em,
.approval-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.rank-row span,
.driver-row span,
.root-row span {
  display: grid;
  color: #eef7f5;
  font-weight: 800;
}

.rank-row strong,
.driver-row strong,
.root-row strong {
  white-space: nowrap;
}

.pill {
  padding: 6px 8px;
  border: 1px solid rgba(58, 169, 255, 0.35);
  border-radius: 999px;
  color: #9bd6ff;
  font-size: 11px;
  font-weight: 850;
}

.pill.ok {
  border-color: rgba(56, 201, 109, 0.42);
  color: #9af0b2;
}

.pill.warn,
.fleet-card > b.warn {
  border-color: rgba(241, 183, 43, 0.42);
  color: #f8d677;
}

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

.issue-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(8, 17, 24, 0.62);
}

.issue-card.yellow {
  border-color: rgba(241, 183, 43, 0.28);
}

.issue-card.red {
  border-color: rgba(255, 89, 79, 0.3);
}

.issue-card.blue {
  border-color: rgba(58, 169, 255, 0.28);
}

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

.issue-card strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.issue-card em {
  display: block;
  margin-top: 5px;
  color: #bfd0d7;
  font-size: 11px;
  font-style: normal;
}

.mini-columns {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  min-height: 245px;
  gap: 10px;
}

.mini-column {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 7px;
  align-items: end;
  min-width: 0;
  height: 245px;
}

.mini-column span {
  display: block;
  width: 100%;
  min-height: 10px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.mini-column b,
.mini-column em {
  display: block;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-column b {
  color: #eff8f5;
  font-size: 11px;
}

.mini-column em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

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

.fleet-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
}

.fleet-card strong {
  display: block;
  font-size: 15px;
}

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

.fleet-card > b {
  display: inline-grid;
  width: 48px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(56, 201, 109, 0.42);
  border-radius: 6px;
  color: #9af0b2;
  font-size: 13px;
}

.fleet-card dl {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.fleet-card dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.fleet-card dd {
  margin: 3px 0 0;
  color: #d8e4e8;
  font-size: 12px;
}

.audit-item > span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.audit-item > span.done {
  background: var(--green);
}

.audit-item > span.hold {
  background: var(--yellow);
}

.audit-item strong {
  display: block;
  font-size: 13px;
}

.audit-item b,
.approval-row b {
  padding: 6px 8px;
  border: 1px solid rgba(241, 183, 43, 0.32);
  border-radius: 999px;
  color: #f8d677;
  font-size: 11px;
}

.audit-item b {
  border-color: rgba(56, 201, 109, 0.32);
  color: #9af0b2;
}

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

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

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

th,
td {
  padding: 11px 10px;
  border-top: 1px solid var(--border);
  color: #cbd8de;
  font-size: 12px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

td strong {
  display: block;
  color: #eef7f5;
}

td span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}

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

  .kpi-grid,
  .metric-grid,
  .fleet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-grid,
  .two-one {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 700px) {
  .public-shell {
    padding: 16px 10px;
  }

  .app-topbar,
  .demo-alert {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-topbar h1 {
    font-size: 31px;
  }

  .filters,
  .kpi-grid,
  .metric-grid,
  .fleet-grid,
  .issue-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    grid-template-columns: 96px 1fr;
    min-height: 132px;
  }

  .gauge {
    width: 96px;
  }

  .bar-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .bar-row strong {
    grid-column: 2;
  }

  .mini-columns {
    min-height: 190px;
    overflow-x: auto;
  }

  .mini-column {
    min-width: 58px;
    height: 190px;
  }

  .fleet-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .approval-row {
    grid-template-columns: 1fr auto;
  }

  .approval-row em {
    grid-column: 1 / -1;
  }
}
