:root{
  --bg:#06131d;
  --panel:#0b2b42;
  --panel2:#103851;
  --line:#00a6d6;
  --text:#f4f9fc;
  --muted:#a9c0cf;
  --accent:#00b7ef;
  --yellow:#ffd100;
  --green:#2dd4a3;
  --red:#ff6475;
  --shadow:0 10px 25px rgba(0,0,0,.18);
}

*{box-sizing:border-box}

html,body{
  margin:0;
  min-height:100%;
  background:radial-gradient(circle at top right,#0d3853 0,#06131d 38%);
  color:var(--text);
  font-family:Arial,sans-serif
}

body{overflow-x:hidden}
.page{padding:16px;max-width:1800px;margin:auto}

.hero,.toolbar,.kpi,.order-card,.panel,.alert-card{
  border:1px solid rgba(0,183,239,.35);
  background:linear-gradient(180deg,rgba(16,56,81,.97),rgba(8,38,58,.97));
  box-shadow:var(--shadow)
}

.hero{
  display:flex;
  align-items:center;
  gap:18px;
  border-radius:18px;
  padding:17px 22px
}

.header-logo-box{
  width:120px;min-width:120px;height:72px;
  display:flex;align-items:center;justify-content:center;
  border-radius:14px;background:#fff
}

.header-logo{max-width:98px;max-height:52px;object-fit:contain}
.header-text{min-width:0}
.header-text h1{margin:0 0 5px;font-size:32px}
.header-text p{margin:0 0 7px;color:#d5e5ee;font-size:15px}
.header-text #lastUpdate,.system-version{
  display:block;color:var(--accent);font-size:12px;font-weight:700;margin-top:3px
}
.tv-badge{
  margin-left:auto;border:1px solid var(--accent);border-radius:999px;
  padding:8px 13px;color:var(--accent);font-weight:800;font-size:12px
}

.eyebrow{
  color:var(--accent);font-size:11px;font-weight:800;
  text-transform:uppercase;letter-spacing:.1em
}
h2{margin:5px 0 0;font-size:20px}

.kpis{
  display:grid;grid-template-columns:repeat(4,minmax(180px,1fr));
  gap:12px;margin:14px 0
}
.kpi{
  border-radius:16px;padding:15px;color:var(--text);
  cursor:pointer;text-align:left;transition:.18s ease
}
.kpi:hover,.kpi.active{
  border-color:var(--accent);transform:translateY(-1px);
  box-shadow:0 0 18px rgba(0,183,239,.18)
}
.kpi span,.kpi small,.kpi strong{display:block}
.kpi span{font-weight:800}
.kpi small{color:var(--muted);margin:5px 0}
.kpi strong{font-size:34px;color:var(--accent)}

.operational-alerts{
  display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:13px
}
.alert-card{
  min-height:70px;border-radius:16px;padding:14px 17px;
  display:flex;align-items:center;justify-content:space-between;gap:15px
}
.alert-card span{font-size:14px;font-weight:800}
.alert-card strong{font-size:29px;color:var(--accent);white-space:nowrap}
.alert-card.is-critical{border-color:rgba(255,100,117,.8);box-shadow:0 0 20px rgba(255,100,117,.2)}
.alert-card.is-priority{border-color:rgba(255,23,68,.8);box-shadow:0 0 20px rgba(255,23,68,.18)}

.toolbar{
  display:grid;grid-template-columns:1fr 240px 150px;
  gap:10px;margin:12px 0;border-radius:14px;padding:12px
}
input,select,button{font:inherit}
input,select{
  width:100%;padding:11px;border:1px solid rgba(0,183,239,.35);
  border-radius:10px;background:#071d2c;color:white
}
#export{
  border:0;border-radius:10px;background:linear-gradient(90deg,#008dc1,#00b7ef);
  color:white;font-weight:800;cursor:pointer
}

.insights{
  display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:14px 0
}
.panel{border-radius:16px;padding:15px;min-height:225px}
.movement-panel{grid-column:1/-1;min-height:190px}
.panel-title{
  display:flex;justify-content:space-between;align-items:flex-start;
  gap:15px;margin-bottom:13px
}
.movement-kpis{display:flex;gap:10px;flex-wrap:wrap}
.movement-kpis span{
  padding:7px 10px;border-radius:9px;background:rgba(255,255,255,.05);
  color:var(--muted);font-size:10px
}
.movement-kpis strong{display:block;color:var(--accent);font-size:18px;margin-top:2px}

.bar-chart{display:flex;flex-direction:column;gap:10px}
.bar-row{
  display:grid;grid-template-columns:minmax(150px,240px) 1fr 46px;
  gap:10px;align-items:center
}
.bar-label{
  font-size:12px;font-weight:700;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap
}
.bar-track{height:10px;border-radius:999px;background:rgba(255,255,255,.08);overflow:hidden}
.bar-fill{height:100%;border-radius:999px;background:linear-gradient(90deg,#00a6d6,#00d4ff)}
.bar-value{text-align:right;font-weight:800;color:var(--accent)}

.movement-chart{display:flex;flex-direction:column;gap:7px}
.movement-row{
  display:grid;grid-template-columns:88px 1fr;gap:10px;align-items:center;
  padding:5px 7px;border-radius:9px
}
.movement-row.today{background:rgba(0,183,239,.08);border:1px solid rgba(0,183,239,.25)}
.movement-date{font-size:10px;font-weight:800}
.movement-bars{display:flex;flex-direction:column;gap:5px}
.movement-bar-group{display:grid;grid-template-columns:65px 1fr 32px;gap:7px;align-items:center}
.movement-bar-label,.movement-bar-value{font-size:9px;font-weight:700}
.movement-bar-bg{height:7px;border-radius:999px;background:rgba(255,255,255,.08);overflow:hidden}
.movement-bar-fill{height:100%;border-radius:999px}
.movement-bar-fill.in{background:var(--accent)}
.movement-bar-fill.out{background:var(--green)}

.section-heading{
  display:flex;justify-content:space-between;align-items:end;
  gap:16px;margin:18px 2px 10px
}
.section-heading #shownLabel{color:var(--muted);font-size:12px}
.cards{display:grid;grid-template-columns:repeat(3,minmax(280px,1fr));gap:12px}
.order-card{
  border-radius:16px;padding:15px;min-height:245px;position:relative;
  overflow:hidden;transition:.18s ease
}
.order-card:hover{transform:translateY(-2px)}
.order-card.priority-card{
  border-color:#ff1744;box-shadow:0 0 22px rgba(255,23,68,.25)
}
.order-card.critical-card{
  border-color:rgba(255,100,117,.85);box-shadow:0 0 22px rgba(255,100,117,.18)
}
.card-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.card-top h3{margin:0;font-size:18px}
.badge{
  padding:6px 9px;border-radius:999px;font-size:10px;
  font-weight:900;height:max-content;white-space:nowrap
}
.badge.producao{background:#5c1520;color:#ffb0b9}
.badge.aguardando{background:#51430b;color:#ffe884}
.badge.liberada{background:#123f34;color:#9af5d7}
.customer{margin:12px 0 8px;font-size:16px;font-weight:800}
.time-row{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  border-radius:9px;padding:8px 10px;margin-bottom:9px;
  background:rgba(255,255,255,.045)
}
.time-row span{font-size:10px;color:var(--muted);text-transform:uppercase}
.time-row strong{font-size:15px;color:var(--accent)}
.time-row.critical strong{color:#ff7a88}
.priority-button{
  position:absolute;right:13px;bottom:12px;width:35px;height:35px;
  border:1px solid rgba(0,183,239,.4);border-radius:10px;
  background:#0a2e46;color:white;cursor:pointer;font-size:16px
}
.priority-card .priority-button{border-color:#ff1744;background:#5b1322}
.info{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding-right:42px}
.info div{padding:8px;border-radius:9px;background:rgba(255,255,255,.045)}
.info span{display:block;color:var(--muted);font-size:8px;text-transform:uppercase}
.info strong{display:block;margin-top:3px;font-size:11px;word-break:break-word}
.empty{text-align:center;padding:40px;color:var(--muted)}
.tv-page-info{text-align:right;color:var(--muted);font-size:11px;margin:3px 2px 8px}

html.embed-mode,html.embed-mode body{
  width:100%!important;min-width:0!important;max-width:none!important;
  margin:0!important;overflow-x:hidden!important
}
html.embed-mode .page{width:100%!important;max-width:none!important;margin:0!important;padding:12px!important}

html.tv-mode body{overflow:hidden}
html.tv-mode .page{max-width:none;height:100vh;padding:8px;display:flex;flex-direction:column}
html.tv-mode .hero{padding:9px 14px;min-height:70px}
html.tv-mode .header-logo-box{width:88px;min-width:88px;height:50px}
html.tv-mode .header-logo{max-width:72px;max-height:38px}
html.tv-mode .header-text h1{font-size:24px}
html.tv-mode .header-text p{font-size:11px}
html.tv-mode .header-text #lastUpdate,html.tv-mode .system-version{font-size:8px}
html.tv-mode .tv-badge{display:block!important}
html.tv-mode .kpis{margin:8px 0;gap:8px}
html.tv-mode .kpi{padding:9px 11px}
html.tv-mode .kpi span{font-size:12px}
html.tv-mode .kpi small{font-size:8px}
html.tv-mode .kpi strong{font-size:25px}
html.tv-mode .operational-alerts{gap:8px;margin-bottom:8px}
html.tv-mode .alert-card{min-height:48px;padding:8px 11px}
html.tv-mode .alert-card span{font-size:10px}
html.tv-mode .alert-card strong{font-size:22px}
html.tv-mode .toolbar{display:none}
html.tv-mode .insights{display:none}
html.tv-mode .section-heading{margin:5px 2px 7px}
html.tv-mode .section-heading h2{font-size:14px}
html.tv-mode .eyebrow{font-size:8px}
html.tv-mode .cards-section{min-height:0;flex:1;display:flex;flex-direction:column}
html.tv-mode .cards{grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(2,1fr);gap:8px;min-height:0;flex:1}
html.tv-mode .order-card{min-height:0;padding:10px}
html.tv-mode .card-top h3{font-size:13px}
html.tv-mode .badge{font-size:7px;padding:4px 6px}
html.tv-mode .customer{font-size:11px;margin:7px 0 5px}
html.tv-mode .time-row{padding:5px 7px;margin-bottom:5px}
html.tv-mode .time-row span{font-size:7px}
html.tv-mode .time-row strong{font-size:11px}
html.tv-mode .info{gap:4px;padding-right:31px}
html.tv-mode .info div{padding:5px}
html.tv-mode .info span{font-size:6px}
html.tv-mode .info strong{font-size:8px}
html.tv-mode .priority-button{width:27px;height:27px;right:8px;bottom:8px;font-size:12px}

@media(max-width:1200px){
  .cards{grid-template-columns:repeat(2,minmax(260px,1fr))}
}
@media(max-width:900px){
  .kpis{grid-template-columns:repeat(2,1fr)}
  .insights{grid-template-columns:1fr}
  .movement-panel{grid-column:auto}
}
@media(max-width:700px){
  .hero{align-items:flex-start}
  .header-logo-box{width:95px;min-width:95px;height:62px}
  .header-text h1{font-size:25px}
  .toolbar{grid-template-columns:1fr}
  .cards,.kpis,.operational-alerts{grid-template-columns:1fr}
  .bar-row{grid-template-columns:120px 1fr 36px}
}


/* =====================================================
   MODO TV AVANÇADO V9
===================================================== */

.hero-actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
}

.fullscreen-button{
  border:1px solid rgba(0,183,239,.45);
  border-radius:999px;
  padding:8px 12px;
  background:rgba(0,183,239,.10);
  color:#fff;
  font-weight:800;
  cursor:pointer;
  font-size:11px;
}

html.tv-mode,
html.tv-mode body{
  width:100%;
  height:100%;
  overflow:hidden!important;
}

html.tv-mode .page{
  width:100vw!important;
  height:100vh!important;
  max-width:none!important;
  margin:0!important;
  padding:7px!important;
  display:grid!important;
  grid-template-rows:auto auto auto auto 1fr!important;
  gap:7px!important;
}

html.tv-mode .hero{
  min-height:64px!important;
  max-height:64px!important;
  padding:7px 12px!important;
}

html.tv-mode .header-logo-box{
  width:80px!important;
  min-width:80px!important;
  height:45px!important;
}

html.tv-mode .header-logo{
  max-width:66px!important;
  max-height:34px!important;
}

html.tv-mode .header-text h1{
  font-size:22px!important;
}

html.tv-mode .header-text p{
  font-size:10px!important;
  margin-bottom:3px!important;
}

html.tv-mode .header-text #lastUpdate,
html.tv-mode .system-version{
  font-size:7px!important;
  margin-top:1px!important;
}

html.tv-mode .hero-actions{
  gap:5px!important;
}

html.tv-mode .tv-badge,
html.tv-mode .fullscreen-button{
  padding:5px 8px!important;
  font-size:8px!important;
}

html.tv-mode .kpis{
  margin:0!important;
  gap:7px!important;
  min-height:62px!important;
}

html.tv-mode .kpi{
  min-height:62px!important;
  padding:7px 10px!important;
}

html.tv-mode .kpi span{
  font-size:11px!important;
}

html.tv-mode .kpi small{
  font-size:7px!important;
  margin:2px 0!important;
}

html.tv-mode .kpi strong{
  font-size:23px!important;
  line-height:1!important;
}

html.tv-mode .operational-alerts{
  margin:0!important;
  gap:7px!important;
  min-height:45px!important;
}

html.tv-mode .alert-card{
  min-height:45px!important;
  max-height:45px!important;
  padding:6px 10px!important;
}

html.tv-mode .alert-card span{
  font-size:9px!important;
}

html.tv-mode .alert-card strong{
  font-size:20px!important;
}

html.tv-mode .tv-page-info{
  display:block!important;
  margin:0!important;
  min-height:14px!important;
  line-height:14px!important;
  font-size:8px!important;
}

html.tv-mode .cards-section{
  min-height:0!important;
  overflow:hidden!important;
  display:grid!important;
  grid-template-rows:auto 1fr!important;
}

html.tv-mode .section-heading{
  margin:0 2px 4px!important;
  min-height:24px!important;
}

html.tv-mode .section-heading h2{
  font-size:13px!important;
}

html.tv-mode .section-heading #shownLabel{
  font-size:8px!important;
}

html.tv-mode .cards{
  min-height:0!important;
  height:100%!important;
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  grid-template-rows:repeat(2,minmax(0,1fr))!important;
  gap:7px!important;
  overflow:hidden!important;
}

html.tv-mode .order-card{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  max-height:none!important;
  padding:8px!important;
  overflow:hidden!important;
}

html.tv-mode .card-top h3{
  font-size:12px!important;
}

html.tv-mode .badge{
  font-size:6px!important;
  padding:3px 5px!important;
}

html.tv-mode .customer{
  font-size:10px!important;
  margin:5px 0 4px!important;
}

html.tv-mode .time-row{
  padding:4px 6px!important;
  margin-bottom:4px!important;
}

html.tv-mode .time-row span{
  font-size:6px!important;
}

html.tv-mode .time-row strong{
  font-size:10px!important;
}

html.tv-mode .info{
  grid-template-columns:1fr 1fr!important;
  gap:3px!important;
  padding-right:27px!important;
}

html.tv-mode .info div{
  padding:4px!important;
  min-height:30px!important;
}

html.tv-mode .info span{
  font-size:5px!important;
}

html.tv-mode .info strong{
  font-size:7px!important;
  line-height:1.08!important;
}

html.tv-mode .priority-button{
  width:24px!important;
  height:24px!important;
  right:6px!important;
  bottom:6px!important;
  font-size:10px!important;
  padding:0!important;
}

html.tv-mode .empty{
  font-size:11px!important;
  padding:20px!important;
}

@media (max-width:1366px), (max-height:768px){
  html.tv-mode .page{
    padding:5px!important;
    gap:5px!important;
  }

  html.tv-mode .hero{
    min-height:56px!important;
    max-height:56px!important;
  }

  html.tv-mode .header-text h1{
    font-size:19px!important;
  }

  html.tv-mode .kpis{
    min-height:54px!important;
  }

  html.tv-mode .kpi{
    min-height:54px!important;
  }

  html.tv-mode .alert-card{
    min-height:40px!important;
    max-height:40px!important;
  }

  html.tv-mode .cards{
    gap:5px!important;
  }
}
