:root {
  --bg: #edf2f7;
  --chrome: #f8fafc;
  --chrome-2: #eef3f8;
  --chrome-3: #dde6f0;
  --ink: #172033;
  --muted: #64748b;
  --line: #d4dce8;
  --line-strong: #aeb9c8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --nav: #f4f7fb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --rail: 188px;
  --editor: 392px;
  --status: 30px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.12), transparent 30%),
    linear-gradient(140deg, #f8fbff 0%, #edf2f7 50%, #e5edf7 100%);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 12px;
  overscroll-behavior: none;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid #c7d1df;
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  color: var(--ink);
  background: #fff;
  outline: 0;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

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

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #344055;
  font-weight: 650;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

th,
td {
  height: 34px;
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 10px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 36px;
  color: #334155;
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

tbody tr {
  background: #fff;
}

tbody tr:nth-child(even) {
  background: #fbfdff;
}

tbody tr:hover {
  background: #eff6ff;
}

.glyph {
  display: inline-grid;
  width: 18px;
  min-width: 18px;
  place-items: center;
  font-family: "Segoe MDL2 Assets";
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
}

.window-shell {
  display: grid;
  position: fixed;
  inset: 0;
  grid-template-rows: 54px 54px minmax(0, 1fr) var(--status);
  width: 100%;
  height: 100%;
  padding: 12px;
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  border: 1px solid rgba(30, 41, 59, 0.85);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(135deg, #10233f 0%, #1d4ed8 56%, #2563eb 100%);
  box-shadow: var(--shadow);
}

.app-title,
.window-meta,
.command-bar,
.view-header,
.pane-title,
.status-bar,
.cmd-button,
.nav-item,
.view-badges,
.toolbar-line,
.actions,
.kpi-strip {
  display: flex;
  align-items: center;
}

.app-title {
  gap: 12px;
  min-width: 0;
}

.app-title div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.app-title strong {
  font-size: 15px;
  letter-spacing: 0.1px;
}

.app-title span:last-child {
  color: #dbeafe;
  font-size: 11px;
}

.app-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.window-meta {
  gap: 8px;
  min-width: 0;
}

.window-meta > span:not(.window-button) {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 5px 10px;
  color: #e0edff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  white-space: nowrap;
}

.window-button {
  display: grid;
  width: 30px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  line-height: 1;
}

.command-bar {
  gap: 8px;
  min-width: 0;
  border-right: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 #fff;
  backdrop-filter: blur(10px);
}

.cmd-button {
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 0 12px;
  color: #243044;
  background: linear-gradient(#ffffff, #f1f5f9);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  font-weight: 700;
  transition: transform 0.12s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.cmd-button:hover {
  border-color: #9ab6e8;
  background: #fff;
  box-shadow: 0 5px 16px rgba(37, 99, 235, 0.12);
}

.cmd-button.primary {
  border-color: var(--accent-dark);
  color: #fff;
  background: linear-gradient(135deg, #2f6feb, #1d4ed8);
}

.cmd-button.primary:hover {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.cmd-button.danger {
  color: var(--danger);
}

.cmd-button:active {
  transform: translateY(1px);
}

.cmd-separator {
  width: 1px;
  height: 30px;
  margin: 0 4px;
  background: #d5deea;
}

.cmd-fill {
  flex: 1 1 auto;
}

.app-body {
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line-strong);
  background: rgba(239, 246, 255, 0.55);
}

.nav-rail {
  display: flex;
  flex: 0 0 var(--rail);
  flex-direction: column;
  gap: 6px;
  height: 100%;
  border-right: 1px solid #d7dfeb;
  padding: 14px 10px;
  background: rgba(248, 250, 252, 0.92);
}

.nav-item {
  justify-content: flex-start;
  gap: 10px;
  height: 42px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 0 12px;
  color: #334155;
  background: transparent;
  font-weight: 700;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav-item:hover {
  border-color: #d6e4ff;
  background: #fff;
}

.nav-item.active {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: linear-gradient(135deg, #ffffff, #eff6ff);
  box-shadow: inset 4px 0 0 var(--accent), 0 8px 18px rgba(37, 99, 235, 0.1);
}

.content-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 14px;
}

.view-frame {
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 1px solid #d7dfeb;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.view-header {
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 13px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(#ffffff, #f8fafc);
}

.view-header > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.view-header strong {
  font-size: 21px;
  font-weight: 750;
}

.view-header span {
  color: var(--muted);
}

.view-badges {
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--editor);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.list-pane,
.editor-pane {
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.list-pane {
  border-right: 1px solid #e2e8f0;
}

.pane-title {
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 13px;
  background: #fbfdff;
}

.pane-title strong {
  color: #1f2937;
  font-weight: 800;
}

.pane-title span {
  color: var(--muted);
  font-size: 11px;
}

.main-host,
.form-host {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #fff;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
}

.main-host {
  padding: 12px;
}

.form-host {
  padding: 12px;
  background: #f8fafc;
}

.dashboard-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.kpi-strip {
  gap: 10px;
  min-width: 0;
}

.kpi-card {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid #d9e4f2;
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.8), rgba(255, 255, 255, 0.96)),
    #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 31px;
  line-height: 1;
}

.toolbar-line {
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  margin-bottom: 10px;
}

.toolbar-line strong {
  font-size: 14px;
}

.table-box {
  height: 100%;
  min-height: 0;
  border: 1px solid #d5deea;
  border-radius: var(--radius-md);
  overflow: auto;
  background: #fff;
  box-shadow: inset 0 1px 0 #fff;
}

.toolbar-line + .table-box {
  height: calc(100% - 48px);
}

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

.group-box {
  border: 1px solid #d7dfeb;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.group-title {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px;
  color: #1e293b;
  background: linear-gradient(#ffffff, #f8fafc);
  font-weight: 800;
}

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

.full {
  grid-column: 1 / -1;
}

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

.btn,
.table-action {
  min-height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
  color: #243044;
  background: linear-gradient(#fff, #f3f6fa);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  font-weight: 750;
}

.btn:hover,
.table-action:hover {
  border-color: #9ab6e8;
  background: #fff;
}

.btn.primary {
  border-color: var(--accent-dark);
  color: #fff;
  background: linear-gradient(135deg, #2f6feb, #1d4ed8);
}

.btn.danger {
  color: var(--danger);
}

.table-action {
  min-height: 26px;
  padding: 0 9px;
  font-size: 11px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0 9px;
  color: #334155;
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 800;
}

.badge.ok,
.badge.ativo,
.badge.executado,
.badge.recebida {
  border-color: #bbf7d0;
  color: #166534;
  background: #ecfdf3;
}

.badge.baixo,
.badge.aberta,
.badge.aguardando,
.badge.alta,
.badge.em-manutencao {
  border-color: #fde68a;
  color: #92400e;
  background: #fffbeb;
}

.badge.zerado,
.badge.urgente,
.badge.cancelada,
.badge.critica,
.badge.inativo {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.quick-panel {
  display: grid;
  gap: 10px;
}

.quick-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  border: 1px solid #d5deea;
  border-radius: var(--radius-md);
  padding: 11px 12px;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
  color: #243044;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
}

.quick-button:hover {
  border-color: #bfdbfe;
  background: #fff;
}

.quick-button span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.route-list {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.route-card {
  border: 1px solid #cfd9e6;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.route-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(#ffffff, #f8fafc);
}

.route-card header div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.route-card header strong,
.route-vehicle strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-card header span,
.route-note,
.route-vehicle span {
  color: var(--muted);
  font-size: 11px;
}

.route-vehicle {
  min-width: 160px;
  text-align: right;
}

.route-note {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfdff;
  line-height: 1.35;
}

.empty-state {
  display: grid;
  height: 100%;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.error {
  color: var(--danger);
  font-weight: 800;
}

.status-bar {
  gap: 7px;
  min-width: 0;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 5px 10px;
  color: #334155;
  background: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  box-shadow: 0 8px 22px rgba(35, 47, 65, 0.12);
}

.status-bar span {
  min-width: 0;
  white-space: nowrap;
}

.status-bar span:not(.status-fill) {
  border-right: 1px solid #d7dfeb;
  padding-right: 10px;
}

.status-fill {
  flex: 1 1 auto;
}

/* PWA install — mínimo, sem redesenhar o app */
.frota-install-hint {
  margin: 0;
  padding: 4px 12px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 1180px) {
  :root {
    --rail: 162px;
    --editor: 346px;
  }

  .cmd-button {
    min-width: 76px;
    padding-right: 9px;
    padding-left: 9px;
  }
}

@media print {
  .title-bar,
  .command-bar,
  .nav-rail,
  .editor-pane,
  .status-bar {
    display: none;
  }

  .window-shell,
  .app-body,
  .content-stage,
  .view-frame,
  .work-grid,
  .list-pane,
  .main-host {
    position: static;
    display: block;
    width: auto;
    height: auto;
    overflow: visible;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}
