:root {
  --bg: #0a0c18;
  --panel: rgba(18, 21, 40, 0.9);
  --border: rgba(255, 255, 255, 0.07);
  --primary: #7c5bff;
  --accent: #00d4ff;
  --text: #f5f6ff;
  --muted: #b8bfd7;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 0;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, rgba(124, 91, 255, 0.08), transparent 25%),
              radial-gradient(circle at 80% 0%, rgba(0, 212, 255, 0.08), transparent 22%),
              var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

input,
select,
textarea,
button {
  font: inherit;
  max-width: 100%;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-width: 0;
}

.sidebar {
  background: linear-gradient(180deg, rgba(17, 19, 32, 0.92), rgba(10, 12, 24, 0.96));
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.logo {
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 18px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}

.menu a:hover,
.menu a.active {
  background: rgba(124, 91, 255, 0.12);
  color: var(--text);
}

.session {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.logout {
  margin-top: 8px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.content {
  padding: 28px 32px 40px;
  min-width: 0;
  width: 100%;
}

.header .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
}

.header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.cards {
  margin: 22px 0 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.card h3 {
  margin: 0 0 6px;
  font-size: 26px;
}

.card-value {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  margin: 0;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel h4 {
  margin: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.panel-number {
  margin: 4px 0 0;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.panel-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-link {
  text-decoration: none;
  color: var(--text);
  background: rgba(124, 91, 255, 0.22);
  border: 1px solid rgba(124, 91, 255, 0.42);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.panel-link:hover {
  background: rgba(124, 91, 255, 0.34);
  border-color: rgba(124, 91, 255, 0.6);
  transform: translateY(-1px);
}

.section-panel {
  min-height: auto;
}

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

.section-head h2 {
  margin: 0;
  font-size: 22px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
  background: rgba(10, 13, 26, 0.45);
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.data-table th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
}

.data-table tbody tr:hover {
  background: rgba(124, 91, 255, 0.08);
}

.text-right {
  text-align: right !important;
}

.empty-state {
  margin: 0;
  padding: 14px 2px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.status-pill--ok {
  background: rgba(14, 159, 110, 0.2);
  border-color: rgba(14, 159, 110, 0.6);
  color: #9ff0cc;
}

.status-pill--off {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.55);
  color: #ffb4b4;
}

.status-pill--warn {
  background: rgba(202, 138, 4, 0.2);
  border-color: rgba(202, 138, 4, 0.6);
  color: #ffe7a5;
}

.status-pill--info {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.6);
  color: #cbe2ff;
}

.row-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.row-link:hover {
  text-decoration: underline;
}

.fake-chart {
  height: 180px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 91, 255, 0.15), rgba(0, 212, 255, 0.12));
  border: 1px dashed rgba(255, 255, 255, 0.25);
}

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

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

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #061624;
  background: linear-gradient(135deg, #5eead4, #22d3ee);
  border-color: rgba(94, 234, 212, 0.52);
}

.btn-primary:hover {
  border-color: rgba(94, 234, 212, 0.75);
}

.btn-ghost {
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.34);
}

.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.52);
}

.modelos-kpis {
  margin: 20px 0 14px;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.kpi-card {
  min-height: 0;
  padding: 20px;
  gap: 6px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 14px;
}

.kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-value {
  margin: 2px 0 0;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text);
}

.kpi-foot {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modelos-panel,
.modelos-table-panel {
  animation: panel-enter 220ms ease-out;
}

.modelos-filters {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-field {
  min-width: 170px;
  flex: 1 1 170px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-field--grow {
  flex: 2 1 320px;
}

.filter-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input-control,
.select-control {
  width: 100%;
  color: var(--text);
  background: rgba(10, 13, 26, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-control::placeholder {
  color: rgba(184, 191, 215, 0.75);
}

.input-control:focus,
.select-control:focus {
  border-color: rgba(34, 211, 238, 0.72);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
}

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

.section-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.table-index {
  color: var(--muted);
  width: 64px;
  font-variant-numeric: tabular-nums;
}

.cell-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cell-title {
  font-weight: 700;
}

.cell-meta {
  color: var(--muted);
  font-size: 12px;
}

.modelos-table-panel .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(10, 13, 26, 0.92);
  backdrop-filter: blur(6px);
}

.table-pagination {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.modelos-form-panel {
  position: relative;
  margin-bottom: 18px;
  border-color: rgba(96, 165, 250, 0.2);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 13, 26, 0.98)),
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.16), transparent 42%);
  box-shadow:
    0 18px 40px rgba(2, 6, 23, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.modelos-form-panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.58), rgba(59, 130, 246, 0.08));
}

.modelos-form-panel .section-title {
  color: #f8fafc;
}

.modelos-form-panel .section-subtitle {
  color: rgba(148, 163, 184, 0.9);
}

.modelos-form-panel .form-grid {
  gap: 16px;
}

.modelos-form-panel .form-actions {
  padding-top: 2px;
}

.pagination-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-link {
  min-width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.page-link:hover {
  border-color: rgba(34, 211, 238, 0.72);
  background: rgba(34, 211, 238, 0.2);
}

.page-link.is-current {
  background: rgba(34, 211, 238, 0.3);
  border-color: rgba(34, 211, 238, 0.82);
  color: #d7fcff;
}

.page-link.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-separator {
  color: var(--muted);
  font-size: 13px;
}

.page-muted {
  color: var(--muted);
  font-size: 12px;
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modelos-panel,
  .modelos-table-panel {
    animation: none;
  }
}

@media (max-width: 768px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    top: auto;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 14px;
  }
  .menu {
    flex: initial;
    min-width: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-x: visible;
    overflow-y: visible;
    gap: 8px;
    padding-bottom: 0;
    scroll-snap-type: none;
  }
  .menu a {
    flex: initial;
    white-space: normal;
  }
  .session {
    flex: initial;
    margin-top: 8px;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .content { padding: 20px 18px 32px; }
  .modelos-header { flex-direction: column; align-items: stretch; }
  .modelos-filters { flex-direction: column; align-items: stretch; }
  .filter-field,
  .filter-field--grow { width: 100%; }
  .filter-actions { margin-left: 0; width: 100%; }
  .filter-actions .btn { flex: 1 1 auto; }
  .table-pagination { flex-direction: column; align-items: flex-start; }
  .data-table { min-width: 560px; }
}

@media (max-width: 640px) {
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .logo {
    font-size: 16px;
  }

  .menu {
    width: 100%;
    margin-inline: -2px;
  }

  .session {
    justify-content: flex-start;
  }

  .content {
    padding: 16px 12px 28px;
  }

  .header h1 {
    font-size: 24px;
    overflow-wrap: anywhere;
  }

  .section-head,
  .panel-header,
  .panel-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .cards,
  .grid,
  .modelos-kpis {
    grid-template-columns: 1fr;
  }

  .btn,
  .panel-link {
    min-height: 38px;
  }
}
