/* acompanhamento-uso.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #f0f2f6;
  --surface: #ffffff;
  --sf2:     #f6f8fb;
  --sf3:     #edf0f5;
  --bd:      #dde1e9;
  --bd2:     #c8cdd8;
  --txt:     #0f1623;
  --txt2:    #46526a;
  --txt3:    #8892a4;
  --a1:      #152e58;
  --a2:      #1b4080;
  --a3:      #2359a8;
  --a4:      #3b7cd4;
  --a5:      #e8f0fb;
  --a6:      #c4d8f5;
}

html, body {
  height: 100%; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 13px;
  line-height: 1.4;
}

/* ── QUANDO EMBED (dentro de iframe) ── */
body.embed html, body.embed {
  overflow: hidden;
}

.page {
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto auto;
  gap: 8px;
  padding: 10px 20px 8px;
}

/* ── TÍTULO ── */
.page-title { display: flex; align-items: baseline; gap: 12px; }
.page-title h1 { font-size: 15px; font-weight: 500; color: var(--txt); }
.page-title p  { font-size: 11px; color: var(--txt3); }

/* ── FILTROS ── */
.filter-card {
  background: var(--surface); border: 1px solid var(--bd);
  border-radius: 9px; padding: 7px 16px;
}
.filter-row { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: nowrap; }
.filter-left { display: flex; gap: 20px; align-items: center; flex-wrap: nowrap; }
.fg { display: flex; align-items: center; gap: 6px; }
.fg-label { font-size: 9px; color: var(--txt3); text-transform: uppercase; letter-spacing: .6px; font-weight: 500; white-space: nowrap; }
.pills { display: flex; gap: 3px; }
.pill {
  padding: 3px 9px; border-radius: 5px; font-size: 11px;
  cursor: pointer; border: 1px solid var(--bd);
  background: var(--surface); color: var(--txt2);
  transition: all .12s; user-select: none; font-family: inherit; line-height: 1.4;
}
.pill.on  { background: var(--a2); color: #fff; border-color: var(--a2); }
.pill:hover:not(.on) { background: var(--sf2); border-color: var(--bd2); }
select.mes-sel {
  padding: 3px 24px 3px 9px; border-radius: 5px; font-size: 11px;
  border: 1px solid var(--bd); background: var(--surface); color: var(--txt2);
  appearance: none; font-family: inherit; cursor: pointer; line-height: 1.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%238892a4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.ctx-line {
  font-size: 10px; color: var(--txt3); white-space: nowrap;
  padding: 3px 10px; background: var(--sf2); border-radius: 20px;
  border: 1px solid var(--bd); flex-shrink: 0;
}
.ctx-line strong { color: var(--txt2); font-weight: 500; }

/* ── KPIs ── */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 8px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--bd);
  border-radius: 9px; padding: 10px 14px;
  border-left: 3px solid var(--a4);
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.kpi-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.kpi-card.k0 { border-left-color: #152e58; }
.kpi-card.k1 { border-left-color: #1b4080; }
.kpi-card.k2 { border-left-color: #2359a8; }
.kpi-card.k3 { border-left-color: #3b7cd4; }
.kpi-card.k4 { border-left-color: #68a1e2; }
.kpi-card.k5 { border-left-color: #9dc3ed; }
.kpi-label { font-size: 9px; color: var(--txt3); text-transform: uppercase; letter-spacing: .6px; font-weight: 500; margin-bottom: 4px; }
.kpi-value { font-size: 22px; font-weight: 400; color: var(--txt); line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-sub   { font-size: 10px; color: var(--txt3); margin-top: 3px; }

/* ── SEÇÃO CENTRAL ── */
.mid-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  min-height: 0;
}

.mid-panel {
  background: var(--surface); border: 1px solid var(--bd);
  border-radius: 9px; padding: 12px 14px;
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}

.panel-hdr {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px; flex-shrink: 0;
}
.panel-title { font-size: 10px; font-weight: 600; color: var(--txt2); text-transform: uppercase; letter-spacing: .6px; }
.panel-badge {
  font-size: 9px; color: var(--txt3); background: var(--sf3);
  border: 1px solid var(--bd); border-radius: 20px; padding: 1px 8px;
}
.panel-badge.under { background: #fff5e6; color: #a05a1a; border-color: #f5d5a8; }

/* meses */
.month-list { display: flex; flex-direction: column; flex: 1; overflow: hidden; justify-content: space-between; }
.m-row {
  display: flex; align-items: center; gap: 8px; padding: 2px 0;
  border-bottom: 1px solid var(--sf3); cursor: pointer; border-radius: 4px;
  transition: background .1s;
}
.m-row:last-child { border-bottom: none; }
.m-row:hover { background: var(--sf2); }
.m-name { font-size: 11px; color: var(--txt2); width: 64px; flex-shrink: 0; }
.m-bar-bg { flex: 1; height: 5px; background: var(--sf3); border-radius: 3px; overflow: hidden; }
.m-bar-fill { height: 100%; border-radius: 3px; background: var(--a4); transition: width .4s; }
.m-bar-fill.peak { background: var(--a1); }
.m-val { font-size: 11px; font-weight: 500; color: var(--txt); width: 44px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.m-val.peak { color: var(--a2); }
.months-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 6px; border-top: 1px solid var(--bd); flex-shrink: 0; margin-top: 4px;
}
.mf-label { font-size: 11px; color: var(--txt2); font-weight: 500; }
.mf-val   { font-size: 12px; font-weight: 500; color: var(--txt); font-variant-numeric: tabular-nums; }

/* 3 KPIs centrais */
.mid-kpis {
  width: 175px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px; min-height: 0;
}
.mid-kpi {
  background: var(--surface); border: 1px solid var(--bd);
  border-radius: 9px; padding: 12px 14px;
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  min-height: 0; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.mid-kpi:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.mk-tag {
  display: inline-block; font-size: 8px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; padding: 2px 7px; border-radius: 20px; margin-bottom: 6px;
}
.mk-tag.high { background: var(--a5); color: var(--a2); }
.mk-tag.mid  { background: var(--sf3); color: var(--txt3); }
.mk-tag.low  { background: #fff0e6; color: #b05a1a; }
.mk-month { font-size: 11px; color: var(--txt3); margin-bottom: 2px; }
.mk-val   { font-size: 20px; font-weight: 500; color: var(--txt); line-height: 1; font-variant-numeric: tabular-nums; }
.mid-kpi.high-card .mk-val { color: var(--a1); }
.mid-kpi.low-card  .mk-val { color: #b05a1a; }
.mk-sub   { font-size: 10px; color: var(--txt3); margin-top: 3px; }

/* gerentes */
.ger-list { display: flex; flex-direction: column; flex: 1; overflow: hidden; justify-content: space-between; }
.ger-item {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 5px; border-radius: 6px;
  cursor: pointer; transition: background .1s;
}
.ger-item:hover { background: var(--sf2); }
.ger-item:hover .ger-name { color: var(--a2); }
.ger-rank { font-size: 9px; color: var(--txt3); width: 12px; text-align: center; flex-shrink: 0; }
.ger-avatar {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: var(--a5); color: var(--a2);
  display: flex; align-items: center; justify-content: center;
  font-size: 7px; font-weight: 700;
}
.ger-avatar.top3 { background: var(--a2); color: #fff; }
.ger-name { font-size: 11px; color: var(--txt); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .1s; }
.ger-bar-bg { width: 80px; height: 4px; background: var(--sf3); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.ger-bar-fill { height: 100%; border-radius: 2px; }
.ger-val { font-size: 11px; font-weight: 500; color: var(--txt); width: 40px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ger-arrow { font-size: 9px; color: var(--txt3); flex-shrink: 0; opacity: 0; transition: opacity .1s; }
.ger-item:hover .ger-arrow { opacity: 1; }

/* bottom */
.bottom-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; min-height: 0; }
.panel { background: var(--surface); border: 1px solid var(--bd); border-radius: 9px; padding: 11px 14px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.pb-list  { display: flex; flex-direction: column; flex: 1; overflow: hidden; justify-content: space-between; }
.usr-list { display: flex; flex-direction: column; flex: 1; overflow: hidden; justify-content: space-between; }

.pb-item { cursor: pointer; border-radius: 4px; transition: background .1s; padding: 1px 2px; }
.pb-item:hover { background: var(--sf2); }
.pb-row  { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 2px; }
.pb-name { font-size: 11px; color: var(--txt2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-num  { font-size: 11px; font-weight: 500; color: var(--txt); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.pb-bar  { height: 4px; background: var(--sf3); border-radius: 2px; overflow: hidden; }
.pb-fill { height: 100%; border-radius: 2px; }

.usr-item { cursor: pointer; border-radius: 4px; transition: background .1s; padding: 1px 2px; }
.usr-item:hover { background: var(--sf2); }
.usr-row  { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.usr-av   { width: 20px; height: 20px; border-radius: 50%; background: var(--a5); color: var(--a2); display: flex; align-items: center; justify-content: center; font-size: 7px; font-weight: 700; flex-shrink: 0; }
.usr-av.top { background: var(--a1); color: #fff; }
.usr-name { font-size: 11px; color: var(--txt); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usr-val  { font-size: 11px; font-weight: 500; color: var(--txt); font-variant-numeric: tabular-nums; }

.foot { text-align: center; font-size: 10px; color: var(--txt3); padding: 2px 0 4px; }
.foot a { color: var(--a3); text-decoration: none; }

/* ── MODAIS ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,22,35,.45); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: 12px; border: 1px solid var(--bd);
  width: 520px; max-width: 95vw; max-height: 88vh;
  overflow: hidden; display: flex; flex-direction: column;
}
.modal-box-wide { width: 680px; }
.modal-head {
  background: var(--a1); padding: 18px 22px;
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.modal-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.modal-head-info { flex: 1; }
.modal-name { font-size: 15px; font-weight: 500; color: #fff; }
.modal-sub  { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 1px; }
.modal-close {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: none; color: #fff;
  font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s; flex-shrink: 0;
}
.modal-close:hover { background: rgba(255,255,255,.24); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px; margin-bottom: 16px; }
.mstat { background: var(--sf2); border-radius: 8px; padding: 10px 12px; border: 1px solid var(--bd); }
.mstat-lbl { font-size: 9px; color: var(--txt3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.mstat-val { font-size: 18px; font-weight: 500; color: var(--txt); font-variant-numeric: tabular-nums; line-height: 1; }
.mstat-sub { font-size: 10px; color: var(--txt3); margin-top: 2px; }
.modal-sec-title { font-size: 10px; font-weight: 600; color: var(--txt3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.modal-months { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; margin-bottom: 14px; }
.mm-item { background: var(--sf2); border-radius: 6px; padding: 7px 8px; border: 1px solid var(--bd); text-align: center; }
.mm-item.peak { background: var(--a5); border-color: var(--a6); }
.mm-item-m { font-size: 9px; color: var(--txt3); }
.mm-item-v { font-size: 12px; font-weight: 500; color: var(--txt); font-variant-numeric: tabular-nums; }
.mm-item.peak .mm-item-v { color: var(--a2); }
.modal-rank { background: var(--sf2); border-radius: 8px; padding: 11px 13px; border: 1px solid var(--bd); }
.mrb-label { font-size: 11px; color: var(--txt2); margin-bottom: 7px; }
.mrb-track { height: 7px; background: var(--sf3); border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.mrb-fill  { height: 100%; border-radius: 4px; background: var(--a3); }
.mrb-sub   { font-size: 10px; color: var(--txt3); }

.modal-obras-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.modal-obra-item {
  background: var(--sf2); border: 1px solid var(--bd); border-radius: 7px;
  padding: 8px 10px; cursor: pointer; transition: border-color .12s;
}
.modal-obra-item:hover { border-color: var(--a4); }
.moi-nome { font-size: 11px; font-weight: 500; color: var(--txt); }
.moi-val  { font-size: 10px; color: var(--txt3); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* modal KPI detalhe */
.kpi-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.kpi-detail-item {
  background: var(--sf2); border: 1px solid var(--bd); border-radius: 8px;
  padding: 12px 14px; cursor: pointer; transition: border-color .12s, transform .12s;
}
.kpi-detail-item:hover { border-color: var(--a4); transform: translateY(-1px); }
.kdi-label { font-size: 10px; color: var(--txt3); margin-bottom: 4px; }
.kdi-val   { font-size: 18px; font-weight: 500; color: var(--txt); font-variant-numeric: tabular-nums; }
.kdi-sub   { font-size: 10px; color: var(--txt3); margin-top: 2px; }

/* modal obra detalhe */
.obra-detail-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; cursor: pointer; border-radius: 5px; padding: 2px 4px; transition: background .1s; }
.obra-detail-bar-row:hover { background: var(--sf2); }
.odb-label { font-size: 12px; color: var(--txt2); width: 90px; flex-shrink: 0; }
.odb-track { flex: 1; height: 6px; background: var(--sf3); border-radius: 3px; overflow: hidden; }
.odb-fill  { height: 100%; border-radius: 3px; }
.odb-val   { font-size: 12px; font-weight: 500; color: var(--txt); width: 44px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* usuário detalhe */
.usr-detail-card {
  background: var(--sf2); border: 1px solid var(--bd); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: border-color .12s;
}
.usr-detail-card:hover { border-color: var(--a4); }
.udc-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.udc-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--a5); color: var(--a2); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.udc-avatar.top { background: var(--a1); color: #fff; }
.udc-name  { font-size: 13px; font-weight: 500; color: var(--txt); }
.udc-cargo { font-size: 11px; color: var(--txt3); }
.udc-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.udc-stat  { background: var(--surface); border-radius: 6px; padding: 6px 8px; border: 1px solid var(--bd); text-align: center; }
.udc-stat-lbl { font-size: 9px; color: var(--txt3); }
.udc-stat-val { font-size: 13px; font-weight: 500; color: var(--txt); font-variant-numeric: tabular-nums; }
