/* COPEL SPA — design tokens clonados do Nostro (simionicosta.com.br), adaptados. */
:root {
  --bg: #070b14;
  --bg-soft: #0b1120;
  --surface: rgba(14, 22, 39, .86);
  --surface-solid: #0e1627;
  --surface-raised: #121d32;
  --line: rgba(148, 163, 184, .14);
  --line-strong: rgba(148, 163, 184, .24);
  --text: #edf4ff;
  --muted: #90a3bd;
  --muted-2: #667891;
  --primary: #6d8cff;
  --primary-2: #8f6dff;
  --cyan: #45d7ff;
  --green: #35e0a1;
  --amber: #ffca63;
  --red: #ff6b7d;
  --shadow: 0 24px 60px rgba(0, 0, 0, .28);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --sidebar-width: 248px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% -10%, rgba(109, 140, 255, .17), transparent 30%),
    radial-gradient(circle at 95% 4%, rgba(69, 215, 255, .10), transparent 28%),
    radial-gradient(circle at 65% 108%, rgba(143, 109, 255, .11), transparent 30%),
    var(--bg);
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(109, 140, 255, .34);
  outline-offset: 2px;
}
.hide { display: none !important; }

/* Login: permanece a única superfície visível antes da autenticação. */
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr);
}
.login-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(42px, 7vw, 96px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
}
.login-hero::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  left: 25%;
  bottom: -220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 140, 255, .24), transparent 68%);
  pointer-events: none;
}
.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 13px;
}
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(77, 118, 255, .27), inset 0 1px rgba(255, 255, 255, .36);
}
.brand-copy strong { display: block; font-size: 19px; letter-spacing: -.45px; }
.brand-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.hero-copy { position: relative; z-index: 1; max-width: 660px; }
.hero-kicker {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.hero-copy h1 {
  max-width: 620px;
  margin: 14px 0 18px;
  font-size: clamp(38px, 5.5vw, 72px);
  line-height: .98;
  letter-spacing: -3.5px;
}
.hero-copy p {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.7;
}
.hero-status {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: #b8c6da;
  font-size: 12px;
}
.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(53, 224, 161, .09), 0 0 17px rgba(53, 224, 161, .45);
}
.login-panel {
  padding: 32px;
  display: grid;
  place-items: center;
  background: rgba(7, 11, 20, .44);
  backdrop-filter: blur(16px);
}
.login-card {
  width: min(100%, 430px);
  padding: clamp(28px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(18, 28, 49, .95), rgba(9, 15, 27, .94));
  box-shadow: var(--shadow);
}
.login-card .brand { display: none; margin-bottom: 32px; }
.login-card h2 { margin: 0 0 8px; font-size: 27px; letter-spacing: -.8px; }
.login-intro { margin: 0 0 28px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { color: #c5d2e5; font-size: 11px; font-weight: 750; letter-spacing: .04em; }
.field input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  outline: 0;
  background: rgba(255, 255, 255, .035);
  color: var(--text);
}
.field input::placeholder { color: var(--muted-2); }
.field input:focus { border-color: rgba(109, 140, 255, .65); box-shadow: 0 0 0 3px rgba(109, 140, 255, .10); }
.primary-button {
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: linear-gradient(110deg, var(--primary), #758cff 55%, var(--primary-2));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(85, 112, 226, .22);
  transition: transform .16s ease, box-shadow .16s ease;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 18px 36px rgba(85, 112, 226, .28); }
.primary-button:disabled { cursor: wait; opacity: .7; transform: none; }
.login-error {
  min-height: 19px;
  margin-top: 13px;
  color: var(--red);
  text-align: center;
  font-size: 12px;
}
.login-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

/* Shell autenticado: sidebar fixa no desktop e drawer no mobile. */
.dashboard { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  padding: 21px 15px 18px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(7, 11, 20, .91);
  backdrop-filter: blur(22px);
  transition: transform .22s ease;
}
.sidebar .brand { padding: 4px 9px 22px; }
.sidebar .brand-mark { width: 42px; height: 42px; border-radius: 14px; }
.nav-label {
  margin: 18px 10px 8px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.nav { display: grid; gap: 5px; }
.nav-button {
  width: 100%;
  min-height: 46px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: color .16s ease, background .16s ease;
}
.nav-button:hover { color: var(--text); background: rgba(255, 255, 255, .045); }
.nav-button.active {
  color: #fff;
  background: linear-gradient(100deg, rgba(109, 140, 255, .22), rgba(69, 215, 255, .07));
  box-shadow: inset 0 0 0 1px rgba(109, 140, 255, .18);
}
.nav-icon {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  font-size: 14px;
}
.nav-button.active .nav-icon { color: #c3ceff; background: rgba(109, 140, 255, .17); }
.nav-count {
  min-width: 25px;
  height: 22px;
  margin-left: auto;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--green);
  background: rgba(53, 224, 161, .09);
  font-size: 9px;
  font-weight: 800;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 10px 3px;
  border-top: 1px solid var(--line);
}
.sync-state { display: flex; align-items: center; gap: 10px; }
.sync-copy strong { display: block; font-size: 11px; }
.sync-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  border: 0;
  background: rgba(2, 5, 11, .68);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.main-shell {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 74px;
  padding: 13px 27px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 20, .75);
  backdrop-filter: blur(20px);
}
.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  cursor: pointer;
}
.topbar-heading { min-width: 0; }
.topbar-heading span {
  display: block;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.topbar-heading strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.live-chip {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(53, 224, 161, .15);
  border-radius: 12px;
  background: rgba(53, 224, 161, .055);
  color: #bcefdc;
  font-size: 10px;
  font-weight: 700;
}
.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #596fe7, #8b62db);
  font-size: 11px;
  font-weight: 850;
  box-shadow: inset 0 1px rgba(255, 255, 255, .25);
}
.logout-button {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  color: var(--muted);
  cursor: pointer;
}
.logout-button:hover { color: var(--text); border-color: var(--line-strong); }

/* Conteúdo e componentes operacionais. */
.content { padding: 30px 28px 50px; }
.panel { display: none; animation: panel-in .22s ease; }
.panel.active { display: block; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.eyebrow {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.page-heading h1 {
  margin: 7px 0 5px;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: -1.3px;
}
.subtitle { max-width: 720px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.updated {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}
.updated strong { display: block; margin-bottom: 4px; color: var(--green); font-size: 11px; }
.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-column { grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); }
.section-row { margin-top: 16px; }
.card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(18, 28, 49, .88), rgba(10, 17, 30, .84));
  box-shadow: var(--shadow);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, .028), transparent 31%);
}
.card-padding { padding: 19px; }
.card-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.card-title { margin: 0; font-size: 14px; letter-spacing: -.2px; }
.card-description { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.pairing-card { padding: 24px; }
.pairing-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 17, 31, .48);
}
.pairing-status-copy { display: grid; gap: 5px; }
.pairing-status-copy strong { font-size: 14px; }
.pairing-status-copy span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.status-details { margin-top: 16px; display: grid; gap: 8px; }
.status-detail { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 10px; }
.status-detail strong { color: #c5d2e5; font-weight: 700; }
.notice-stale {
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 202, 99, .22);
  border-radius: 11px;
  background: rgba(245, 158, 11, .08);
  color: var(--amber);
  font-size: 10px;
}
.kpi { min-height: 154px; padding: 17px; }
.kpi-top { position: relative; display: flex; align-items: center; justify-content: space-between; }
.kpi-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(109, 140, 255, .12);
  color: #c1cdff;
  font-size: 15px;
}
.kpi-state {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(53, 224, 161, .08);
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}
.kpi-value { position: relative; margin-top: 16px; font-size: 29px; font-weight: 850; letter-spacing: -1.15px; }
.kpi-label { position: relative; margin-top: 3px; color: var(--muted); font-size: 10px; }
.kpi-detail { position: relative; margin-top: 12px; color: var(--muted-2); font-size: 9px; line-height: 1.4; }
.chart-wrap { position: relative; height: 285px; }
canvas { display: block; width: 100%; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.dot-primary { background: var(--primary); }
.legend-dot.dot-cyan { background: var(--cyan); }
.capacity-layout { display: grid; gap: 18px; }
.capacity-ring {
  --value: 0;
  position: relative;
  width: 154px;
  height: 154px;
  margin: 2px auto 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--value) * 1%), rgba(255, 255, 255, .055) 0);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, .16);
}
.capacity-ring::before {
  content: "";
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--surface-solid);
  box-shadow: 0 0 0 1px var(--line);
}
.ring-copy { position: absolute; text-align: center; }
.ring-copy strong { display: block; font-size: 24px; letter-spacing: -.8px; }
.ring-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.capacity-list { display: grid; gap: 11px; }
.capacity-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.capacity-row span { color: var(--muted); font-size: 10px; }
.capacity-row strong { font-size: 10px; }
.bar-track { grid-column: 1 / 3; height: 5px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, .06); }
.bar-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan)); }
.bar-fill.fill-green { background: linear-gradient(90deg, var(--green), var(--cyan)); }
.mini-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mini-stat { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .023); }
.mini-stat span { color: var(--muted); font-size: 9px; }
.mini-stat strong { display: block; margin-top: 7px; font-size: 16px; }
.mini-stat small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 8px; line-height: 1.4; }
.table-card { overflow: hidden; }
.table-header { padding: 19px; margin: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 650px; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; }
th {
  color: var(--muted-2);
  background: rgba(255, 255, 255, .018);
  font-size: 8px;
  letter-spacing: .11em;
  text-transform: uppercase;
}
td { color: #cbd8e9; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  text-transform: capitalize;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--green); background: rgba(53, 224, 161, .08); }
.badge-warning { color: var(--amber); background: rgba(255, 202, 99, .08); }
.badge-error { color: var(--red); background: rgba(255, 107, 125, .08); }
.badge-neutral { color: var(--muted); background: rgba(148, 163, 184, .08); }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; font-size: 11px; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--text); font-size: 13px; }
.loading-line {
  position: fixed;
  inset: 0 0 auto var(--sidebar-width);
  z-index: 50;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  background: transparent;
  transition: opacity .15s;
}
.loading-line.active { opacity: 1; }
.loading-line::after {
  content: "";
  display: block;
  width: 36%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--primary), transparent);
  animation: loading 1.2s infinite ease-in-out;
}
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(360%); } }

/* O layout se comprime antes de virar drawer, sem esconder informação. */
@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  :root { --sidebar-width: 0px; }
  .login-view { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-panel { min-height: 100vh; padding: 20px; }
  .login-card .brand { display: inline-flex; }
  .sidebar { width: min(82vw, 280px); transform: translateX(-102%); }
  .dashboard.menu-open .sidebar { transform: translateX(0); }
  .dashboard.menu-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  .main-shell { margin-left: 0; }
  .menu-button { display: grid; place-items: center; }
  .content { padding: 24px 18px 42px; }
  .topbar { padding: 12px 18px; }
  .loading-line { left: 0; }
  .live-chip span:last-child { display: none; }
}
@media (max-width: 560px) {
  .login-card { padding: 28px 22px; }
  .topbar-heading { display: none; }
  .topbar-actions { gap: 7px; }
  .logout-button { width: 42px; padding: 0; font-size: 0; }
  .logout-button::before { content: "↗"; font-size: 16px; transform: rotate(45deg); }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .updated { text-align: left; }
  .kpi-grid, .mini-grid { grid-template-columns: 1fr; }
  .kpi { min-height: 140px; }
  .content { padding-inline: 14px; }
  .chart-wrap { height: 235px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
