/* =========================================================
   Painel CD — Design system (CSS puro, sem framework)
   ========================================================= */

:root {
  --color-bg: #f3f5f9;
  --color-surface: #ffffff;
  --color-surface-alt: #f8fafc;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;

  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-text-faint: #94a3b8;

  --color-sidebar-bg: #0b1220;
  --color-sidebar-bg-active: #16213a;
  --color-sidebar-text: #cbd5e1;
  --color-sidebar-text-active: #ffffff;
  --color-sidebar-border: #1e293b;

  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-soft: #eff6ff;

  --color-success: #15803d;
  --color-success-bg: #dcfce7;
  --color-warning: #b45309;
  --color-warning-bg: #fef3c7;
  --color-danger: #b91c1c;
  --color-danger-bg: #fee2e2;
  --color-neutral-bg: #f1f5f9;

  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-md: 0 4px 12px -2px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.06);
  --shadow-lg: 0 12px 24px -8px rgb(15 23 42 / 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --sidebar-width: 248px;
  --topbar-height: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

button { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 8px; }

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar-brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-mark img { width: 100%; height: 100%; display: block; }

.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand-text strong { color: #fff; font-size: 14px; }
.sidebar-brand-text span { font-size: 11px; color: var(--color-text-faint); }

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
  padding: 14px 10px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-sidebar-text);
  margin-bottom: 2px;
}

.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }

.sidebar-link:hover { background: var(--color-sidebar-bg-active); color: #fff; }

.sidebar-link.active {
  background: var(--color-primary);
  color: #fff;
}
.sidebar-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--color-sidebar-border);
  font-size: 12px;
  color: var(--color-text-faint);
}

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title h1 { font-size: 18px; font-weight: 600; }
.topbar-title p { font-size: 12.5px; color: var(--color-text-muted); margin-top: 2px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.topbar-clock { font-size: 12.5px; color: var(--color-text-muted); text-align: right; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-primary);
  color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

.user-chip-name { font-size: 12.5px; font-weight: 600; }

.btn-logout {
  border: none; background: transparent; cursor: pointer;
  color: var(--color-text-muted); font-size: 12px;
  padding: 4px 6px; border-radius: 6px;
}
.btn-logout:hover { background: var(--color-neutral-bg); color: var(--color-danger); }

.content {
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.menu-toggle { display: none; }

/* ---------- Cards ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.card-header h2 { font-size: 14.5px; font-weight: 600; }
.card-header p { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

.card-body { padding: 18px 20px; }
.card-body.no-pad { padding: 0; }

/* ---------- KPI grid ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (min-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card .kpi-icon {
  position: absolute; top: 16px; right: 16px;
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-primary-soft); color: var(--color-primary);
}
.kpi-card .kpi-icon svg { width: 17px; height: 17px; }

.kpi-card.tone-danger .kpi-icon { background: var(--color-danger-bg); color: var(--color-danger); }
.kpi-card.tone-warning .kpi-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.kpi-card.tone-success .kpi-icon { background: var(--color-success-bg); color: var(--color-success); }

.kpi-label {
  font-size: 12.5px; color: var(--color-text-muted); font-weight: 500;
  margin-bottom: 8px;
}
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-sub { font-size: 12px; color: var(--color-text-faint); margin-top: 6px; }

.kpi-value.skeleton, .value-skeleton {
  display: inline-block; height: 24px; width: 80px;
  background: linear-gradient(90deg, #eef1f5 25%, #e4e8ee 37%, #eef1f5 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- Grids / layout helpers ---------- */

.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.grid-2.equal { grid-template-columns: 1fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--color-surface-alt); }
.data-table tbody tr:last-child td { border-bottom: none; }

.cell-strong { font-weight: 600; }
.cell-muted { color: var(--color-text-muted); }
.cell-mono { font-variant-numeric: tabular-nums; }

.table-empty, .table-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-neutral { background: var(--color-neutral-bg); color: var(--color-text-muted); }
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary); }

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--color-surface-alt); }

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

.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.segmented {
  display: inline-flex;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.segmented button {
  border: none;
  background: var(--color-surface);
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-right: 1px solid var(--color-border-strong);
}
.segmented button:last-child { border-right: none; }
.segmented button.active { background: var(--color-primary); color: #fff; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--color-text-muted); }

.input, select.input {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  font-size: 13px;
  color: var(--color-text);
  min-width: 0;
}
.input:focus, select.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

/* ---------- Multi-select ---------- */

.multiselect { position: relative; }

.multiselect-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; cursor: pointer; text-align: left;
  font-family: inherit;
}
.multiselect-trigger .chev { width: 14px; height: 14px; color: var(--color-text-faint); flex-shrink: 0; transition: transform 0.12s ease; }
.multiselect.open .multiselect-trigger .chev { transform: rotate(180deg); }
.multiselect.open .multiselect-trigger { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }

.multiselect-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multiselect-trigger-label.placeholder { color: var(--color-text-faint); }

.multiselect-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 100%; width: max-content; max-width: 280px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.multiselect-option {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.multiselect-option:hover { background: var(--color-surface-alt); }
.multiselect-option input[type="checkbox"] { accent-color: var(--color-primary); width: 15px; height: 15px; flex-shrink: 0; }

.multiselect-footer {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 9px 2px; margin-top: 4px;
  border-top: 1px solid var(--color-border);
}
.multiselect-footer button {
  border: none; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--color-primary); padding: 4px;
}
.multiselect-footer button:hover { text-decoration: underline; }

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

/* ---------- Alerts / banners ---------- */

.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.banner-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.banner-warning { background: var(--color-warning-bg); color: var(--color-warning); }

/* ---------- Login page (split-screen) ---------- */

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--color-surface);
}

.login-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px;
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(56,189,248,0.28), transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(37,99,235,0.4), transparent 50%),
    linear-gradient(165deg, #0b1220 0%, #101a30 55%, #0b1220 100%);
}

.login-brand-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 30% 20%, black, transparent 65%);
  pointer-events: none;
}

.login-brand-panel-inner { position: relative; max-width: 440px; }

.login-brand-mark-lg { width: 52px; height: 52px; margin-bottom: 32px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); }
.login-brand-mark-lg img { width: 100%; height: 100%; display: block; }

.login-brand-eyebrow {
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #7dd3fc; margin-bottom: 14px;
}

.login-brand-tagline {
  font-size: 32px; font-weight: 700; line-height: 1.28; letter-spacing: -0.015em;
  margin-bottom: 36px;
}

.login-brand-features { position: relative; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.login-brand-features li { display: flex; align-items: flex-start; gap: 13px; font-size: 14px; color: rgba(255,255,255,0.82); line-height: 1.5; }
.login-brand-features .feature-check {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 8px; margin-top: 1px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center;
}
.login-brand-features .feature-check svg { width: 13px; height: 13px; color: #7dd3fc; }

.login-brand-footer { position: relative; font-size: 12px; color: rgba(255,255,255,0.4); }

.login-form-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}

.login-form-card { width: 100%; max-width: 372px; }

.login-form-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-form-mobile-brand strong { font-size: 15px; font-weight: 700; }

.login-form-header { margin-bottom: 30px; }
.login-form-header h2 { font-size: 25px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
.login-form-header p { font-size: 13.5px; color: var(--color-text-muted); }

.login-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-size: 12.5px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.login-footnote {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: var(--color-text-faint);
}

.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon-wrap .input-icon {
  position: absolute; left: 12px; width: 17px; height: 17px;
  color: var(--color-text-faint); pointer-events: none;
}
.input-with-icon { padding-left: 38px; }
.input-with-action { padding-right: 42px; }
.input-action {
  position: absolute; right: 5px; width: 30px; height: 30px; border: none; background: transparent;
  color: var(--color-text-faint); cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.input-action:hover { background: var(--color-neutral-bg); color: var(--color-text-muted); }
.input-action svg { width: 17px; height: 17px; }

.btn-lg { padding: 11px 14px; font-size: 14px; }

@media (max-width: 880px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { padding: 32px 20px; min-height: 100vh; align-items: flex-start; }
  .login-form-card { margin-top: 48px; }
  .login-form-mobile-brand { display: flex; }
}

/* ---------- Planta 3D ---------- */

.p3d-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 16px 20px; margin-bottom: 16px; position: relative;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.p3d-filtros-toggle { display: none; align-items: center; gap: 6px; flex-shrink: 0; }
.p3d-filtros-badge {
  background: var(--color-primary); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 6px; line-height: 1.4;
}
.p3d-filtros-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.p3d-toolbar-actions { display: flex; gap: 10px; margin-left: auto; }

@media (max-width: 720px) {
  .p3d-toolbar {
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px;
  }
  .p3d-busca-field { flex: 1 1 100%; order: 1; }
  .p3d-busca-field label { display: none; }
  .p3d-filtros-toggle { display: inline-flex; order: 2; }
  .p3d-toolbar-actions { order: 3; margin-left: 0; flex: 1 1 auto; }
  .p3d-toolbar-actions .btn { flex: 1 1 0; }
  .p3d-toolbar-actions .btn span:last-child { white-space: nowrap; }

  .p3d-filtros-fields {
    display: none;
    order: 4;
    position: absolute;
    top: calc(100% + 6px); left: 14px; right: 14px;
    flex-direction: column; align-items: stretch; gap: 12px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    padding: 16px; z-index: 25;
  }
  .p3d-filtros-fields.open { display: flex; }
  .p3d-filtros-fields .field { min-width: 0 !important; width: 100%; }
}

@media (max-width: 420px) {
  .p3d-toolbar-actions { flex-direction: column; }
}

.p3d-stage { padding: 0; overflow: hidden; }
.p3d-canvas-area { position: relative; height: 620px; background: #eef1f6; }
.p3d-canvas-area canvas { display: block; width: 100%; height: 100%; }

.p3d-legend {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(11,18,32,0.55); backdrop-filter: blur(6px);
  padding: 12px 14px; border-radius: 12px;
}
.p3d-legend .legend-item { color: #fff; }
.legend-dot-empty { width: 12px; height: 12px; border-radius: 4px; border: 1.5px dashed #cbd5e1; background: transparent; flex-shrink: 0; }

.p3d-camera-controls {
  position: absolute; bottom: 14px; left: 14px; z-index: 3;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.p3d-cam-btn {
  border: none; cursor: pointer;
  background: rgba(11,18,32,0.55); backdrop-filter: blur(6px);
  color: #fff; font-size: 12px; font-weight: 600; font-family: inherit;
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
}
.p3d-cam-btn:hover { background: rgba(11,18,32,0.78); }

.p3d-rua-label {
  padding: 3px 10px;
  background: rgba(11,18,32,0.72);
  color: #fff;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  white-space: nowrap;
  transform: translate(-50%, -100%);
}

.p3d-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 3;
  font-size: 12px; color: #fff; background: rgba(11,18,32,0.55); backdrop-filter: blur(6px);
  padding: 7px 14px; border-radius: 999px; display: flex; gap: 14px; white-space: nowrap;
}

.p3d-panel {
  position: absolute; top: 14px; left: 14px; z-index: 4;
  width: 290px; max-width: calc(100% - 28px);
  background: var(--color-surface); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 16px 16px 14px;
  max-height: calc(100% - 28px); overflow-y: auto;
}
.p3d-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-weight: 700; font-size: 14.5px;
}
.p3d-panel-close {
  border: none; background: var(--color-neutral-bg); width: 24px; height: 24px;
  border-radius: 7px; cursor: pointer; color: var(--color-text-muted); flex-shrink: 0;
}
.p3d-panel-close:hover { background: var(--color-border); }

.p3d-lote-item { padding: 9px 0; border-bottom: 1px solid var(--color-border); font-size: 12.5px; }
.p3d-lote-item:last-child { border-bottom: none; }
.p3d-lote-item .row { display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; }
.p3d-lote-item .row span:first-child { color: var(--color-text-muted); }

.p3d-valor-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.p3d-valor-row:last-child { border-bottom: none; }

.p3d-loading {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--color-bg); font-size: 13px; color: var(--color-text-muted);
}

.p3d-page:fullscreen,
.p3d-page.p3d-fullscreen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--color-bg);
  padding: 16px;
  width: 100vw;
  height: 100vh;
}
.p3d-page:fullscreen .p3d-toolbar,
.p3d-page.p3d-fullscreen .p3d-toolbar { margin-bottom: 0; flex-shrink: 0; }
.p3d-page:fullscreen .p3d-stage,
.p3d-page.p3d-fullscreen .p3d-stage { flex: 1; min-height: 0; }
.p3d-page:fullscreen .p3d-canvas-area,
.p3d-page.p3d-fullscreen .p3d-canvas-area { height: 100%; }

@media (max-width: 720px) {
  .p3d-canvas-area { height: 460px; }
  .p3d-panel { width: calc(100% - 28px); }
  .p3d-hint { display: none; }
  .p3d-camera-controls { bottom: 10px; left: 10px; right: 10px; }
  .p3d-cam-btn { font-size: 11px; padding: 6px 10px; }
}

/* ---------- Chart containers ---------- */

.chart-box { position: relative; height: 260px; }
.chart-box.small { height: 200px; }

.legend-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend-item .legend-value { margin-left: auto; font-weight: 600; }

/* ---------- Progress bar (ruptura) ---------- */

.progress-track {
  width: 100%; height: 7px; border-radius: 999px;
  background: var(--color-neutral-bg);
  overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 999px; }

/* ---------- Empty / loading states ---------- */

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid var(--color-border-strong);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh;
}

/* ---------- Utility ---------- */

.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-success { color: var(--color-success); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-16 { margin-bottom: 16px; }
.fw-600 { font-weight: 600; }
.small { font-size: 12px; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .grid-2, .grid-2.equal { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--color-border);
    background: var(--color-surface); cursor: pointer; margin-right: 10px;
  }
  .topbar-clock { display: none; }
}

@media (max-width: 720px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-title p { display: none; }
  .user-chip-name { display: none; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filters-bar { padding: 14px 16px; }
  .filters-bar .field { flex: 1 1 140px; min-width: 140px; }
  .chart-box { height: 220px; }
}

@media (max-width: 480px) {
  .kpi-value { font-size: 22px; }
  .login-form-header h2 { font-size: 21px; }
}
