:root{
  --bg0:#061e20;
  --bg1:#0b2b2d;
  --card:#0f3a3d;
  --card2:#0c3134;
  --stroke:rgba(255,255,255,.10);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.66);
  --muted2:rgba(255,255,255,.50);
  --accent:#56e0d1;
  --accent2:#f8c35a;
  --bad:#ff5a6a;
  --warn:#ffd04b;
  --mid:#ff9f43;
  --ok:#4be48a;
  --neutral:rgba(255,255,255,.38);
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --radius:18px;
  --radiusSm:12px;
  --gap:14px;
  --fontBody:"Bahnschrift","Segoe UI Variable Text","Segoe UI","Calibri",sans-serif;
  --fontHead:"Palatino Linotype",Palatino,serif;
}

*{box-sizing:border-box}
html,body{height:100%; overflow-x:hidden}
body{
  margin:0;
  color:var(--text);
  font-family:var(--fontBody);
  letter-spacing:.2px;
  overflow-x:hidden;
  background: radial-gradient(1100px 600px at 15% 10%, rgba(86,224,209,.20), transparent 60%),
              radial-gradient(900px 600px at 80% 30%, rgba(248,195,90,.18), transparent 62%),
              linear-gradient(180deg, var(--bg1), var(--bg0));
}

.bg{
  position:fixed; inset:0;
  background:
    radial-gradient(800px 420px at 30% 30%, rgba(255,255,255,.06), transparent 70%),
    radial-gradient(700px 420px at 75% 75%, rgba(255,255,255,.05), transparent 70%);
  pointer-events:none;
  filter:saturate(1.05);
}

.authGate{
  position:fixed; inset:0;
  z-index:9998;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  background: rgba(6,30,32,.55);
  backdrop-filter: blur(10px);
}

.smallGate{
  position:fixed; inset:0;
  z-index:10000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background: rgba(6,30,32,.92);
  backdrop-filter: blur(8px);
}
.smallGate[hidden]{display:none}
.smallGateCard{
  width:100%;
  max-width:560px;
}

.authGateFooter{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  padding: 0 18px;
  text-align: center;
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.4;
}
.authGateFooter a,
.authGateFooter a:visited{
  color: rgba(86,224,209,.95);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.authGateFooter a:hover{color: rgba(86,224,209,1)}

.authCard{
  width:100%;
  max-width:560px;
}

body.auth-locked .appShell{display:none}
body.auth-locked .authGate{display:flex}

.appShell{
  position:relative;
  display:grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: 74px 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  min-height:100vh;
  max-width:100vw;
}

.topbar{
  grid-area:topbar;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 16px 18px;
  border-bottom:1px solid var(--stroke);
  backdrop-filter: blur(10px);
  background: rgba(6,30,32,.55);
}

.brand{display:flex; gap:12px; align-items:center}
.mark{
  width:44px; height:44px;
  border-radius: 14px;
  display:grid; place-items:center;
  background: linear-gradient(145deg, rgba(86,224,209,.22), rgba(255,255,255,.04));
  border:1px solid var(--stroke);
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.mark svg{width:26px; height:26px; color:rgba(255,255,255,.90)}
.brandName{font-family:var(--fontHead); font-size:18px; line-height:1; letter-spacing:.4px}
.brandTag{font-size:12px; color:var(--muted); margin-top:4px}

.topActions{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end}

.sidebar{
  grid-area:sidebar;
  padding:16px;
  border-right:1px solid var(--stroke);
  background: rgba(6,30,32,.40);
  backdrop-filter: blur(10px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow:auto;
  padding-right:6px;
}
.nav a{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px;
  border-radius: 14px;
  color:var(--text);
  text-decoration:none;
  border:1px solid transparent;
  background: rgba(255,255,255,.03);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.nav a:hover{transform: translateY(-1px); background: rgba(255,255,255,.05); border-color: var(--stroke)}
.nav a.active{background: rgba(86,224,209,.12); border-color: rgba(86,224,209,.22)}
.nav .meta{font-size:12px; color:var(--muted)}

.sideFooter{
  margin-top:auto;
  padding-top:14px;
  display:flex; gap:8px; flex-wrap:wrap;
}
.sideCopyright{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid rgba(255,255,255,.06);
  color: var(--muted2);
  font-size:12px;
}
.sideCopyright .sub{
  margin-top:4px;
  font-size:11px;
  color: var(--muted2);
}
.linkBtn{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  color: var(--muted2);
  font: inherit;
  cursor:pointer;
}
.linkBtn:hover{color: var(--muted); text-decoration: underline}
a.linkBtn, a.linkBtn:visited{color: var(--muted2)}

.authCard a,
.authCard a:visited{
  color: rgba(86,224,209,.95);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.authCard a:hover{color: rgba(86,224,209,1)}
.authCard a:focus-visible{
  outline: 2px solid rgba(86,224,209,.75);
  outline-offset: 2px;
  border-radius: 8px;
}
.pill{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color:var(--muted);
}

.main{grid-area:main; padding: 18px 18px 24px; overflow-x:hidden}
.view{max-width: 1200px}

.row{display:flex; gap:var(--gap); flex-wrap:wrap}
.col{flex:1; min-width:0}
.row > .col{min-width:200px}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
}
.cardHead{
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
  margin-bottom:10px;
}
.cardTitle{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-family:var(--fontHead);
  font-size:16px;
  letter-spacing:.3px;
}
.cardSub{color:var(--muted); font-size:12px; margin-top:4px}

.grid{
  display:grid;
  grid-template-columns: repeat(12,1fr);
  gap: var(--gap);
}
.grid > *{min-width:0}

.span6{grid-column: span 6}
.span4{grid-column: span 4}
.span3{grid-column: span 3}
.span8{grid-column: span 8}
.span12{grid-column: span 12}

.kpis{display:grid; grid-template-columns: repeat(4,1fr); gap:10px}
.kpi{
  padding:10px 10px 9px;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
}
.kpiLabel{font-size:11px; color:var(--muted)}
.kpiValue{font-size:16px; margin-top:4px}
.kpiHint{font-size:11px; color:var(--muted2); margin-top:3px}

.statusDot{width:10px; height:10px; border-radius:999px; display:inline-block; margin-right:8px}
.dotOk{background: var(--ok)}
.dotWarn{background: var(--warn)}
.dotMid{background: var(--mid)}
.dotBad{background: var(--bad)}
.dotNeutral{background: var(--neutral)}

.btn{
  white-space:nowrap;
  appearance:none;
  border:1px solid rgba(86,224,209,.35);
  background: rgba(86,224,209,.14);
  color: var(--text);
  border-radius: 14px;
  padding: 9px 12px;
  cursor:pointer;
  font-weight:600;
  letter-spacing:.2px;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{transform: translateY(-1px); background: rgba(86,224,209,.18); border-color: rgba(86,224,209,.55)}
.btn.subtle{
  background: rgba(255,255,255,.04);
  border-color: var(--stroke);
  color: var(--text);
  font-weight:600;
}
.btn.subtle:hover{background: rgba(255,255,255,.06)}
.btn.danger{
  background: rgba(255,90,106,.12);
  border-color: rgba(255,90,106,.30);
}
.btn.danger:hover{background: rgba(255,90,106,.18); border-color: rgba(255,90,106,.48)}

.iconBtn{
  appearance:none;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 12px;
  width:34px; height:34px;
  cursor:pointer;
}

label{display:block; font-size:12px; color:var(--muted); margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
input,select,textarea{
  width:100%;
  padding: 10px 10px;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: rgba(6,30,32,.45);
  color: var(--text);
  outline:none;
}
input[type="checkbox"],input[type="radio"]{
  width:auto;
  padding:0;
  border:none;
  background:transparent;
  border-radius:4px;
  box-shadow:none;
}

/* Remove controles de incremento/decremento (spinners) dos campos numéricos */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"]{
  appearance: textfield;
  -moz-appearance: textfield;
}

/* Campo calculado (resultado) */
.calculatedField[readonly]{
  background: rgba(255,255,255,.04);
  border-style: dashed;
  color: rgba(255,255,255,.72);
  cursor: default;
  caret-color: transparent;
}
.calculatedField[readonly]::selection{background: rgba(86,224,209,.22)}
.calculatedField[readonly]:focus{
  border-color: rgba(255,255,255,.22);
}
textarea{min-height: 90px; resize: vertical}
input::placeholder,textarea::placeholder{color: rgba(255,255,255,.36)}
input:focus,select:focus,textarea:focus{border-color: rgba(86,224,209,.40)}
.help{font-size:12px; color:var(--muted2); margin-top:6px}

.chartSelector{
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
}
.chartSelector .chartOption{
  display:flex;
  align-items:center;
  gap:8px;
  margin:0;
  color:var(--text);
  font-size:13px;
}
.chartSelector .chartOption input[type="checkbox"]{
  width:16px;
  height:16px;
  margin:0;
  accent-color: var(--accent);
}

.table{
  width:100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing:0;
  overflow:hidden;
  border-radius: var(--radius);
  border:1px solid var(--stroke);
}
.table th,.table td{
  text-align:left;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size:13px;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.table th{color: var(--muted); font-size:12px; letter-spacing:.3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; overflow-wrap: normal; word-break: normal; hyphens: none}
.table tr:last-child td{border-bottom:none}
.table tr:hover td{background: rgba(255,255,255,.03)}
.colVolume{min-width: 92px}
.colFiltration{min-width: 92px}
.actionsCell{
  min-width: 190px;
  width: 1%;
  text-align: right;
  white-space: nowrap;
}
.actionsCell .actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.toastHost{
  position:fixed;
  top: 86px;
  right: 16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast{
  width: min(340px, calc(100vw - 32px));
  border-radius: 16px;
  border:1px solid var(--stroke);
  background: rgba(6,30,32,.85);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 10px 10px;
}
.toastTitle{font-weight:700}
.toastBody{font-size:12px; color: var(--muted); margin-top:4px}

.dlg{
  width:min(760px, 92vw);
  border:1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(6,30,32,.92);
  color: var(--text);
  box-shadow: var(--shadow);
}
.dlg::backdrop{background: rgba(0,0,0,.55)}
.dlgForm{margin:0; padding: 12px 12px}
.dlgHead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding-bottom:10px;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.dlgTitle{font-family:var(--fontHead); font-size:16px}
.dlgBody{padding: 12px 0 10px}
.dlgActions{display:flex; justify-content:flex-end; gap:10px; padding-top:10px; border-top:1px solid rgba(255,255,255,.06)}

/* Upgrade de plano */
.planList{display:flex; flex-direction:column; gap:10px}
.planOption{
  border:1px solid var(--stroke);
  border-radius: 16px;
  padding: 12px 12px;
  background: rgba(255,255,255,.03);
}
.planOption.recommended{border-color: rgba(255,208,75,.45); background: rgba(255,208,75,.06)}
.planOption.current{border-color: rgba(75,228,138,.40); background: rgba(75,228,138,.06)}
.planName{font-weight:800}
.planCurrent{font-weight:800; font-size:14px}

.badge{
  display:inline-flex; align-items:center; gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color:var(--muted);
  font-size:12px;
}

.hr{height:1px; background: rgba(255,255,255,.08); margin: 12px 0}

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

@media (max-width: 980px){
  .actionsCell{min-width: 0; text-align:left; white-space: normal}
  .actionsCell .actions{justify-content:flex-start}
  .appShell{
    grid-template-columns: 1fr;
    grid-template-rows: 74px auto 1fr;
    grid-template-areas:
      "topbar"
      "sidebar"
      "main";
  }
  .sidebar{
    border-right:none;
    border-bottom:1px solid var(--stroke);
    overflow:visible;
  }
  .nav{flex-direction:row; flex-wrap:wrap; overflow:visible}
  .nav a{flex:1; min-width: 140px}
  .sideFooter{margin-top:14px}
  .toastHost{top: 132px}

  .span3,.span4,.span6,.span8{grid-column: span 12}
  .kpis{grid-template-columns: repeat(2,1fr)}
}









