:root {
  --green-950: #07351a;
  --green-900: #08451f;
  --green-800: #0b5e2b;
  --green-700: #137535;
  --green-600: #238c3f;
  --green-500: #45ad4a;
  --green-100: #e9f7e8;
  --green-50: #f5fbf4;
  --ink: #17231c;
  --muted: #66746b;
  --line: #dbe6dd;
  --surface: #ffffff;
  --canvas: #f4f7f4;
  --danger: #c43d3d;
  --danger-soft: #fff0f0;
  --warning: #a76205;
  --warning-soft: #fff8e8;
  --blue: #2563a7;
  --blue-soft: #edf5ff;
  --shadow: 0 14px 35px rgba(10, 55, 27, .09);
  --shadow-sm: 0 6px 18px rgba(10, 55, 27, .07);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, .9fr) minmax(560px, 1.3fr);
  background: #fff;
}
.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 5.5rem);
  position: relative;
  z-index: 2;
}
.login-brand { width: min(420px, 92%); margin-bottom: 2.4rem; }
.login-title { margin: 0; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.08; color: var(--green-950); }
.login-subtitle { color: var(--muted); max-width: 520px; margin: .9rem 0 2rem; }
.login-form { width: min(470px, 100%); }
.login-form .field { margin-bottom: 1rem; }
.login-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 75% 20%, rgba(160, 235, 117, .36), transparent 27%),
    radial-gradient(circle at 20% 80%, rgba(83, 187, 80, .24), transparent 32%),
    linear-gradient(145deg, #07351a 0%, #0b5e2b 54%, #17873b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  padding: 3rem;
}
.login-hero::before,
.login-hero::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
}
.login-hero::before { width: 600px; height: 600px; right: -210px; top: -220px; }
.login-hero::after { width: 430px; height: 430px; left: -180px; bottom: -190px; }
.hero-card {
  width: min(660px, 100%);
  padding: clamp(2rem, 4vw, 4rem);
  border-radius: 30px;
  background: rgba(255,255,255,.11);
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 30px 80px rgba(0,0,0,.22);
  backdrop-filter: blur(15px);
  position: relative;
  z-index: 1;
}
.hero-kicker { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; opacity: .78; }
.hero-card h2 { font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1.05; margin: .8rem 0 1.1rem; }
.hero-card p { font-size: 1.05rem; max-width: 560px; color: rgba(255,255,255,.82); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-top: 2rem; }
.hero-stat { padding: 1rem; border-radius: 16px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); }
.hero-stat strong { display: block; font-size: 1.35rem; }
.hero-stat span { font-size: .82rem; opacity: .75; }
.demo-box { margin-top: 1.2rem; padding: 1rem 1.1rem; border-radius: 14px; background: var(--green-50); border: 1px solid var(--line); font-size: .88rem; }
.demo-box code { color: var(--green-800); font-weight: 700; }
.login-error { padding: .8rem 1rem; border-radius: 12px; background: var(--danger-soft); color: var(--danger); margin-bottom: 1rem; font-weight: 650; }

/* Common controls */
.field { display: flex; flex-direction: column; gap: .42rem; }
.field label { font-weight: 700; font-size: .88rem; color: #304238; }
.field-hint { color: var(--muted); font-size: .78rem; }
.input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cedbd1;
  background: #fff;
  border-radius: 11px;
  padding: .72rem .85rem;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
textarea { resize: vertical; min-height: 92px; }
.input:focus, select:focus, textarea:focus { border-color: var(--green-600); box-shadow: 0 0 0 4px rgba(35, 140, 63, .11); }
.input[readonly] { background: #f5f7f5; color: #526158; }
.input.input-negative { color: var(--danger); border-color: #efbcbc; background: var(--danger-soft); font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-2 { grid-column: span 2; }

.btn {
  border: 0;
  border-radius: 11px;
  min-height: 42px;
  padding: .68rem 1rem;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: transform .16s, box-shadow .16s, background .16s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--green-800), var(--green-600)); color: #fff; box-shadow: 0 8px 18px rgba(11,94,43,.2); }
.btn-primary:hover { box-shadow: 0 10px 24px rgba(11,94,43,.27); }
.btn-secondary { background: var(--green-100); color: var(--green-900); }
.btn-light { background: #fff; color: var(--green-900); border: 1px solid var(--line); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 34px; padding: .45rem .7rem; font-size: .82rem; border-radius: 9px; }
.btn-icon { width: 38px; padding: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }

/* App layout */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }
.sidebar {
  background: linear-gradient(180deg, #07351a 0%, #084a21 45%, #0b5e2b 100%);
  color: #fff;
  padding: 1.2rem 1rem;
  position: fixed;
  left: 0;
  top: 0;
  width: 264px;
  height: 100vh;
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-logo { padding: .7rem .55rem 1.5rem; }
.sidebar-logo img { width: 205px; height: auto; display: block; filter: none; }
.nav-label { padding: .2rem .8rem .55rem; font-size: .68rem; letter-spacing: .12em; opacity: .58; text-transform: uppercase; }
.nav-list { display: flex; flex-direction: column; gap: .3rem; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(255,255,255,.78);
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: .75rem .8rem;
  text-align: left;
  font-weight: 650;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 #9ee070; }
.nav-icon { width: 22px; height: 22px; display: inline-grid; place-items: center; flex: 0 0 22px; }
.nav-icon svg { width: 20px; height: 20px; display: block; overflow: visible; }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.13); padding: 1rem .55rem 0; }
.user-chip { display: flex; gap: .7rem; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.13); font-weight: 800; }
.user-meta strong, .user-meta span { display: block; }
.user-meta strong { font-size: .88rem; }
.user-meta span { font-size: .72rem; opacity: .64; }
.logout-link { width: 100%; margin-top: .7rem; color: rgba(255,255,255,.8); background: transparent; border: 0; text-align: left; padding: .5rem 0; }

.app-main { grid-column: 2; min-width: 0; overflow-x: hidden; }
.topbar {
  min-height: 74px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { margin: 0; font-size: 1.16rem; color: var(--green-950); }
.topbar p { margin: .1rem 0 0; font-size: .78rem; color: var(--muted); }
.mobile-menu { display: none; }
.content { width: 100%; min-width: 0; padding: 2rem; max-width: 1680px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.4rem; }
.page-header h2 { margin: 0; color: var(--green-950); font-size: clamp(1.45rem, 2.4vw, 2rem); }
.page-header p { margin: .3rem 0 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { padding: 1.1rem 1.25rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); }
.card-header h3 { margin: 0; font-size: 1rem; color: var(--green-950); }
.card-body { padding: 1.25rem; }
.grid { display: grid; gap: 1rem; min-width: 0; }
.grid > * { min-width: 0; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-grid { grid-template-columns: minmax(0, 1fr) minmax(270px, 310px); align-items: start; }
.dashboard-recent-card, .dashboard-status-card { min-width: 0; }

.dashboard-plant-history-card { margin-bottom: 1rem; }
.dashboard-status-card .card-body { padding: .9rem 1rem 1rem; }
.dashboard-status-list { display: grid; gap: .65rem; }
.dashboard-status-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .58rem .7rem; border: 1px solid var(--line); border-radius: 12px; background: #f8fbf8; }
.dashboard-status-row strong { min-width: 2rem; color: var(--green-950); font-size: 1.05rem; text-align: right; }
.dashboard-recent-card table { min-width: 0; table-layout: fixed; }
.dashboard-recent-card th:nth-child(1) { width: 20%; }
.dashboard-recent-card th:nth-child(2) { width: 27%; }
.dashboard-recent-card th:nth-child(3) { width: 12%; }
.dashboard-recent-card th:nth-child(4) { width: 13%; }
.dashboard-recent-card th:nth-child(5) { width: 14%; }
.dashboard-recent-card th:nth-child(6) { width: 14%; }
.dashboard-recent-card th:last-child { width: 124px; }
.dashboard-recent-card td { min-width: 0; overflow-wrap: anywhere; }
.dashboard-recent-card td:last-child { padding-left: .45rem; padding-right: .9rem; }
.dashboard-recent-card .table-actions { width: 100%; justify-content: flex-end; }
.dashboard-recent-card .table-actions .btn { width: 108px; max-width: 100%; white-space: nowrap; }
.dashboard-status-card .card-body { min-width: 0; }
.card-header-subtitle { margin: .2rem 0 0; color: var(--muted); font-size: .76rem; }
.energy-balance-card { margin-bottom: 1.25rem; min-width: 0; }
.energy-balance-table { min-width: 760px; }
.energy-balance { display: inline-flex; justify-content: center; min-width: 88px; padding: .32rem .55rem; border-radius: 999px; font-weight: 850; white-space: nowrap; }
.energy-balance.positive { color: var(--green-800); background: var(--green-100); }
.energy-balance.neutral { color: #64716a; background: #eef1ef; }
.energy-balance.negative { color: var(--danger); background: var(--danger-soft); }
.stats { margin-bottom: 1.25rem; }
.stat-card { padding: 1.15rem; display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; overflow: hidden; position: relative; }
.stat-card::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -35px; bottom: -42px; background: var(--green-100); }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 650; }
.stat-value { margin-top: .35rem; font-size: 1.65rem; line-height: 1; color: var(--green-950); font-weight: 850; }
.stat-detail { margin-top: .55rem; font-size: .75rem; color: var(--muted); }
.stat-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--green-100); color: var(--green-800); font-size: 1.25rem; z-index: 1; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: .8rem .9rem; text-align: left; font-size: .72rem; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; background: #f8faf8; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .88rem .9rem; border-bottom: 1px solid #edf1ed; font-size: .88rem; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfb; }
.table-title { font-weight: 750; color: #20362a; }
.table-sub { display: block; color: var(--muted); font-size: .77rem; margin-top: .12rem; }
.table-actions { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.empty-state { padding: 3rem 1.5rem; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--green-950); font-size: 1.03rem; margin-bottom: .3rem; }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .62rem; border-radius: 999px; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active, .badge-paid { background: var(--green-100); color: var(--green-800); }
.badge-open, .badge-issued { background: var(--blue-soft); color: var(--blue); }
.badge-overdue { background: var(--danger-soft); color: var(--danger); }
.badge-draft { background: #eef1ef; color: #64716a; }
.badge-registering { background: #fff3cd; color: #7a5200; }
.badge-cancelled, .badge-inactive { background: #f0f0f0; color: #747474; }
.badge-warning { background: var(--warning-soft); color: var(--warning); }

.toolbar { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.search-box { width: min(360px, 100%); position: relative; }
.search-box input { padding-left: 2.3rem; }
.search-box::before { content: "⌕"; position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.15rem; z-index: 1; }
.invoice-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(540px, 2fr) auto; align-items: end; }
.invoice-toolbar .search-box { width: 100%; }
.invoice-filter-controls { display: grid; grid-template-columns: minmax(220px, 1.25fr) minmax(180px, 1fr) minmax(190px, 1fr); gap: .7rem; }
.invoice-filter-field { display: grid; gap: .3rem; min-width: 0; }
.invoice-filter-field label { color: var(--muted); font-size: .74rem; font-weight: 750; }
.invoice-filter-field select { min-width: 0; }
.invoice-filter-count { min-width: 112px; padding-bottom: .72rem; font-size: .8rem; text-align: right; white-space: nowrap; }

/* Forms and invoice editor */
.section-card { margin-bottom: 1rem; }
.section-title { display: flex; gap: .7rem; align-items: center; }
.section-number { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--green-100); color: var(--green-800); font-weight: 850; font-size: .82rem; }
.calc-preview { background: linear-gradient(145deg, var(--green-950), var(--green-800)); color: #fff; border-radius: 18px; padding: 1.25rem; position: sticky; top: 92px; }
.calc-preview h3 { margin: 0 0 1rem; }
.calc-row { display: flex; justify-content: space-between; gap: 1rem; padding: .48rem 0; color: rgba(255,255,255,.78); font-size: .86rem; }
.calc-row strong { color: #fff; white-space: nowrap; }
.calc-row strong.preview-negative { color: #ffc2c2; }
.calc-row.total { border-top: 1px solid rgba(255,255,255,.18); margin-top: .55rem; padding-top: 1rem; font-size: 1.08rem; }
.calc-row.total strong { font-size: 1.4rem; color: #b9f68d; }
.invoice-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 1.2rem; align-items: start; }
.notice { padding: .9rem 1rem; border-radius: 12px; background: var(--blue-soft); color: #23578f; border: 1px solid #d4e7fb; font-size: .84rem; }
.notice-warning { background: var(--warning-soft); color: var(--warning); border-color: #f4ddb2; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4,26,12,.58); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 100; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; width: min(760px, 100%); max-height: 92vh; overflow-y: auto; border-radius: 20px; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.modal-lg { width: min(1060px, 100%); }
.modal-header { padding: 1.2rem 1.35rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-header h3 { margin: 0; color: var(--green-950); }
.modal-close { border: 0; background: #f2f5f2; width: 36px; height: 36px; border-radius: 10px; font-size: 1.15rem; }
.modal-body { padding: 1.35rem; }
.modal-footer { padding: 1rem 1.35rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .7rem; position: sticky; bottom: 0; background: #fff; }

/* Toast */
.toast-stack { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 200; display: flex; flex-direction: column; gap: .6rem; }
.toast { min-width: 280px; max-width: 420px; padding: .9rem 1rem; border-radius: 12px; background: #0a4721; color: #fff; box-shadow: var(--shadow); animation: toastIn .22s ease; }
.toast.error { background: #9e2929; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Report */
.report-body { background: #e9eee9; padding: 28px; }
.report-toolbar { width: min(1000px, 100%); margin: 0 auto 18px; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.report-page { width: 1000px; min-height: 1414px; margin: 0 auto; background: #fff; border: 2px solid var(--green-800); border-radius: 14px; padding: 28px; box-shadow: 0 22px 60px rgba(6,46,20,.16); color: #15231a; }
.report-header { display: grid; grid-template-columns: 160px 1fr 205px; align-items: center; gap: 18px; }
.report-logo img { width: 150px; }
.report-heading h1 { margin: 0; color: var(--green-950); font-size: 27px; line-height: 1.12; text-transform: uppercase; }
.report-heading p { margin: 8px 0 0; color: var(--green-800); font-size: 17px; font-weight: 700; }
.report-private { border: 1.5px solid var(--green-800); border-radius: 12px; padding: 13px; text-align: center; color: var(--green-950); font-weight: 800; font-size: 13px; }
.report-info { margin-top: 20px; border: 1.5px solid var(--green-800); border-radius: 10px; overflow: hidden; }
.report-info-row { display: grid; grid-template-columns: 190px 1fr; min-height: 48px; border-bottom: 1px solid var(--green-700); }
.report-info-row:last-child { border-bottom: 0; }
.report-info-label { background: #f5faf4; padding: 12px 15px; color: var(--green-950); font-weight: 800; display: flex; align-items: center; gap: 10px; }
.report-info-value { padding: 12px 17px; display: flex; align-items: center; font-size: 15px; }
.report-section-title { margin-top: 16px; background: linear-gradient(90deg, var(--green-900), var(--green-700)); color: #fff; text-align: center; padding: 8px 12px; border-radius: 7px; font-size: 17px; font-weight: 850; text-transform: uppercase; letter-spacing: .02em; }
.reading-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 12px; }
.reading-box { border: 1.5px solid var(--green-700); border-radius: 9px; overflow: hidden; text-align: center; min-height: 115px; display: flex; flex-direction: column; }
.reading-box-label { background: #f3f8f2; color: var(--green-950); padding: 9px 5px; font-weight: 800; font-size: 12px; min-height: 51px; display: grid; place-items: center; }
.reading-box-value { flex: 1; display: grid; place-items: center; padding: 10px 5px; font-size: 19px; font-weight: 850; }
.report-calculation { border: 1.5px solid var(--green-700); border-radius: 9px; padding: 13px 24px; margin-top: 0; text-align: center; }
.report-formula { font-size: 20px; font-weight: 800; padding: 6px 0; }
.report-formula + .report-formula { border-top: 1px solid var(--green-700); }
.report-formula strong { color: var(--green-800); }
.admin-energy-summary { display: grid; grid-template-columns: minmax(230px, 1.25fr) 2fr; margin-top: 9px; border: 1px dashed #8bbf93; border-radius: 9px; overflow: hidden; background: #f8fcf8; }
.admin-energy-heading { display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 6px 11px; background: #eaf6e9; color: var(--green-950); font-size: 11px; }
.admin-energy-heading span { color: var(--muted); font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.admin-energy-values { display: grid; grid-template-columns: repeat(4, 1fr); }
.admin-energy-values > div { display: flex; flex-direction: column; justify-content: center; padding: 5px 8px; text-align: center; border-left: 1px solid var(--line); }
.admin-energy-values span, .admin-energy-values strong { display: block; }
.admin-energy-values span { color: var(--muted); font-size: 8px; text-transform: uppercase; font-weight: 750; }
.admin-energy-values strong { margin-top: 1px; color: var(--green-900); font-size: 11px; }
.admin-energy-values > div.negative { background: var(--danger-soft); }
.admin-energy-values > div.negative strong { color: var(--danger); }
.charges-table { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-top: 12px; }
.charges-table .charge-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 13px; border-bottom: 1px solid var(--line); font-size: 13px; }
.charges-table .charge-row:last-child { border-bottom: 0; }
.charges-table .energy-row { background: #fbfdfb; font-size: 14px; }
.cemig-charges { border-bottom: 1px solid var(--line); }
.cemig-charges-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 13px; background: #edf7ec; color: var(--green-950); font-size: 13px; font-weight: 850; text-transform: uppercase; }
.cemig-charges-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.cemig-charge-item { min-width: 0; padding: 8px 10px; text-align: center; border-right: 1px solid var(--line); background: #fff; }
.cemig-charge-item:last-child { border-right: 0; }
.cemig-charge-label { display: block; min-height: 32px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.cemig-charge-value { display: block; margin-top: 3px; color: var(--green-950); font-size: 14px; }
.payment-area { display: grid; grid-template-columns: 1fr 310px; gap: 14px; margin-top: 13px; }
.amount-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.amount-card { border: 1.5px solid var(--green-700); border-radius: 10px; overflow: hidden; text-align: center; }
.amount-card-title { background: linear-gradient(90deg, var(--green-900), var(--green-700)); color: #fff; padding: 7px; font-weight: 800; font-size: 12px; text-transform: uppercase; min-height: 45px; display: grid; place-items: center; }
.amount-card-value { padding: 12px 7px; color: var(--green-950); background: #f8fcf7; font-size: 25px; font-weight: 900; }
#amountDiscountPercent { display: grid; min-height: 61px; place-items: center; padding-inline: 10px; font-size: 18px; line-height: 1.12; }
.amount-card.highlight .amount-card-value { font-size: 31px; }
.amount-card.full-width { grid-column: span 2; }
.due-card { grid-column: span 2; border: 1.5px solid var(--green-700); border-radius: 10px; padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; background: #f9fcf9; }
.due-card strong { display: block; color: var(--green-950); }
.due-card span { font-size: 12px; color: var(--muted); }
.pix-box { border: 1.5px solid var(--green-700); border-radius: 10px; padding: 10px 14px; text-align: center; }
.pix-title { margin: -10px -14px 10px; padding: 8px; color: #fff; background: linear-gradient(90deg, var(--green-900), var(--green-700)); font-weight: 850; border-radius: 8px 8px 0 0; text-transform: uppercase; font-size: 13px; }
#reportQr canvas, #reportQr img { width: 230px !important; height: 230px !important; display: block; margin: 0 auto; image-rendering: pixelated; }
.pix-key { margin-top: 7px; font-size: 12px; }
.pix-key strong { display: block; color: var(--green-800); font-size: 15px; }
.status-strip { margin-top: 11px; border-radius: 10px; padding: 9px 13px; display: flex; justify-content: space-between; align-items: center; background: var(--green-100); color: var(--green-900); font-weight: 800; }
.status-strip.overdue { background: var(--danger-soft); color: var(--danger); }
.status-strip.open { background: var(--blue-soft); color: var(--blue); }
.report-observations { margin-top: 12px; border: 1.5px solid var(--green-700); border-radius: 10px; overflow: hidden; }
.report-observations-title { padding: 7px 12px; background: #f2f8f1; color: var(--green-950); font-size: 12px; font-weight: 850; }
.report-observations p { margin: 0; padding: 10px 13px; font-size: 12px; line-height: 1.4; }
.report-footer { margin-top: 14px; text-align: center; font-size: 12px; color: var(--muted); }
.copy-box { width: min(1000px, 100%); margin: 16px auto 0; padding: 14px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-sm); }
.copy-code { width: 100%; min-height: 72px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-all; }


/* Resultado da usina e acesso de visualização */
button:disabled { cursor: not-allowed; opacity: .55; transform: none !important; box-shadow: none !important; }
.negative-text { color: var(--danger) !important; }
.card-header-subtitle { margin: .2rem 0 0; color: var(--muted); font-size: .78rem; }
.result-grid { align-items: start; }
.result-line { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .72rem 0; border-bottom: 1px solid var(--line); }
.result-line:last-child { border-bottom: 0; }
.result-line span { color: var(--muted); }
.result-line strong { color: var(--green-950); text-align: right; }
.result-highlight { margin: .3rem -.4rem; padding: .85rem .4rem; border-radius: 10px; background: var(--green-50); }
.result-highlight span, .result-highlight strong { color: var(--green-900); font-weight: 800; }
.result-total { margin-top: .4rem; padding: .95rem .7rem; border-radius: 11px; background: linear-gradient(135deg, var(--green-900), var(--green-700)); border-bottom: 0; }
.result-total span, .result-total strong { color: #fff; font-weight: 850; }
#resultCompetence { min-width: 160px; }
#resultUnitTable table { min-width: 1050px; }
#plantResultForm input:disabled, #plantResultForm textarea:disabled,
#settingsForm input:disabled, #settingsForm textarea:disabled, #settingsForm select:disabled {
  opacity: 1; color: var(--ink); background: #f5f7f5; cursor: default;
}

@media (max-width: 1350px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-status-card { order: -1; }
}
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-layout { grid-template-columns: 1fr; }
  .invoice-toolbar { grid-template-columns: 1fr; }
  .invoice-filter-count { min-width: 0; padding-bottom: 0; text-align: left; }
  .calc-preview { position: static; }
  .reading-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { min-height: 440px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 50px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .app-main { width: 100%; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 1rem; }
  .content { padding: 1.2rem 1rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .col-8, .col-6, .col-4, .col-3, .col-2 { grid-column: span 12; }
  .report-body { padding: 0; overflow-x: auto; }
  .report-toolbar { position: sticky; left: 0; width: 100vw; padding: 10px; background: #fff; margin: 0; z-index: 4; }
  .report-page { transform-origin: top left; border-radius: 0; }
}
@media (max-width: 640px) {
  .login-panel { padding: 2rem 1.2rem; }
  .login-hero { padding: 1.2rem; }
  .hero-card { padding: 1.5rem; }
  .hero-stats, .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header .btn { width: 100%; }
  .card-header { align-items: flex-start; flex-direction: column; }
  .toolbar { align-items: stretch; }
  .search-box { width: 100%; }
  .invoice-toolbar { display: flex; }
  .invoice-filter-controls { grid-template-columns: 1fr; width: 100%; }
  .invoice-filter-count { width: 100%; min-width: 0; padding-bottom: 0; text-align: left; }
}

@media print {
  @page { size: A4 portrait; margin: 5mm; }
  html, body.report-body { width: 100%; min-height: 0; background: #fff; }
  body.report-body { padding: 0; overflow: visible; }
  .no-print, .report-toolbar, .copy-box { display: none !important; }
  .report-page {
    width: 199mm;
    min-height: 0;
    margin: 0 auto;
    border-width: .3mm;
    border-radius: 2mm;
    padding: 4mm;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-header { grid-template-columns: 26mm 1fr 39mm; gap: 3mm; }
  .report-logo img { width: 24mm; }
  .report-heading h1 { font-size: 14pt; line-height: 1.06; }
  .report-heading p { margin-top: 1mm; font-size: 9pt; }
  .report-private { border-radius: 2mm; padding: 2.5mm 1.5mm; font-size: 7.5pt; }
  .report-info { margin-top: 3mm; border-radius: 2mm; }
  .report-info-row { grid-template-columns: 37mm 1fr; min-height: 7.5mm; }
  .report-info-label { padding: 1.5mm 2.5mm; font-size: 7.5pt; }
  .report-info-value { padding: 1.5mm 2.5mm; font-size: 8pt; line-height: 1.2; }
  .report-section-title { margin-top: 2.5mm; padding: 1.2mm 2mm; border-radius: 1.5mm; font-size: 9pt; }
  .reading-grid { gap: 2mm; margin-top: 2mm; }
  .reading-box { min-height: 18mm; border-radius: 1.5mm; }
  .reading-box-label { min-height: 8mm; padding: 1mm; font-size: 6.7pt; line-height: 1.15; }
  .reading-box-value { padding: 1.5mm 1mm; font-size: 10pt; }
  .report-calculation { border-radius: 1.5mm; padding: 1.5mm 4mm; }
  .report-formula { padding: 1mm 0; font-size: 10.5pt; line-height: 1.15; }
  .admin-energy-summary { grid-template-columns: 1.25fr 2fr; margin-top: 1.2mm; border-radius: 1.5mm; }
  .admin-energy-heading { padding: .6mm 1.8mm; font-size: 5.9pt; line-height: 1.05; }
  .admin-energy-heading span { font-size: 4.7pt; }
  .admin-energy-values > div { padding: .55mm 1.2mm; }
  .admin-energy-values span { font-size: 4.7pt; }
  .admin-energy-values strong { margin-top: .2mm; font-size: 6.2pt; }
  .charges-table { margin-top: 1.5mm; border-radius: 1.5mm; }
  .charges-table .charge-row { padding: 1.4mm 2.5mm; font-size: 7.5pt; line-height: 1.15; }
  .charges-table .energy-row { font-size: 8pt; }
  .cemig-charges-title { padding: 1.2mm 2.5mm; font-size: 7.3pt; }
  .cemig-charge-item { padding: 1.3mm 1.5mm; }
  .cemig-charge-label { min-height: 6mm; font-size: 6.2pt; line-height: 1.1; }
  .cemig-charge-value { margin-top: .5mm; font-size: 7.8pt; }
  .payment-area { grid-template-columns: 1fr 48mm; gap: 2.5mm; margin-top: 2.5mm; }
  .amount-grid { gap: 1.8mm; }
  .amount-card { border-radius: 1.5mm; }
  .amount-card-title { min-height: 8mm; padding: 1mm; font-size: 6.7pt; line-height: 1.1; }
  .amount-card-value { padding: 1.5mm 1mm; font-size: 14pt; line-height: 1.05; }
  #amountDiscountPercent { min-height: 10mm; padding-inline: 1mm; font-size: 8.8pt; line-height: 1.08; }
  .amount-card.highlight .amount-card-value { font-size: 17pt; }
  .due-card { border-radius: 1.5mm; padding: 1.5mm 2.5mm; }
  .due-card span { font-size: 6.5pt; }
  .due-card strong { font-size: 8pt; }
  .notice { padding: 1.5mm 2mm !important; margin-top: 1.8mm !important; font-size: 6.7pt; line-height: 1.2; }
  .status-strip { margin-top: 1.8mm; border-radius: 1.5mm; padding: 1.5mm 2.5mm; font-size: 7pt; }
  .pix-box { border-radius: 1.5mm; padding: 1.5mm 2mm; }
  .pix-title { margin: -1.5mm -2mm 1.5mm; padding: 1.3mm; border-radius: 1.2mm 1.2mm 0 0; font-size: 7pt; }
  #reportQr canvas, #reportQr img { width: 39mm !important; height: 39mm !important; }
  .pix-key { margin-top: 1mm; font-size: 6.5pt; }
  .pix-key strong { font-size: 8pt; }
  .pix-box .muted { margin-top: 1mm !important; font-size: 6pt !important; line-height: 1.15; }
  .report-observations { margin-top: 2mm; border-radius: 1.5mm; }
  .report-observations-title { padding: 1mm 2mm; font-size: 6.8pt; }
  .report-observations p { padding: 1.5mm 2mm; font-size: 6.7pt; line-height: 1.25; }
  .report-footer { margin-top: 2mm; font-size: 6.5pt; }
  body.print-results .sidebar, body.print-results .topbar, body.print-results .page:not(#page-results),
  body.print-results #page-results .admin-only, body.print-results #page-results .viewer-only,
  body.print-results #page-results .page-header .button-row { display: none !important; }
  body.print-results .app-shell { display: block; min-height: 0; }
  body.print-results .app-main { width: 100%; }
  body.print-results .content { max-width: none; padding: 0; }
  body.print-results #page-results { display: block !important; animation: none; }
  body.print-results #page-results .page-header { margin-bottom: 4mm; }
  body.print-results #page-results .page-header h2 { font-size: 18pt; }
  body.print-results #page-results .stats { grid-template-columns: repeat(4, 1fr); gap: 3mm; }
  body.print-results #page-results .stat-card { min-height: 24mm; padding: 3mm; box-shadow: none; }
  body.print-results #page-results .result-grid { grid-template-columns: 1fr 1fr; gap: 3mm; }
  body.print-results #page-results .card { box-shadow: none; break-inside: avoid; }
  body.print-results #page-results #plantResultForm { padding: 3mm; }
  body.print-results #page-results #plantResultForm input,
  body.print-results #page-results #plantResultForm textarea { border: 0; padding: 0; min-height: auto; background: transparent; }
  body.print-results #page-results #resultUnitTable { overflow: visible; }
  body.print-results #page-results #resultUnitTable table { min-width: 0; font-size: 7pt; }
  body.print-results #page-results table th, body.print-results #page-results table td { padding: 1.5mm; }
  * { print-color-adjust: exact !important; -webkit-print-color-adjust: exact !important; }
}

/* Contraste explícito do botão de menu */
#mobileMenu,.mobile-menu{color:#0b4b26!important;background:#f3f7f4!important;border-color:#d5e2d8!important} #mobileMenu:hover{background:#e6f1e9!important;color:#073c1e!important}

.monthly-unit-row{grid-template-columns:minmax(220px,1fr) 140px;margin-bottom:.6rem}.modal-sm{max-width:720px}

/* Usinas v4 — cadastro e operação mensal separados */
.plant-workspace{display:grid;gap:1.25rem}.plant-workspace-header{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;padding:1.15rem 1.25rem;border:1px solid var(--border);border-radius:16px;background:linear-gradient(135deg,#f7fbf8,#eef8f1)}.plant-workspace-header h3{margin:.15rem 0 .25rem;font-size:1.35rem}.plant-workspace-header p{margin:0;color:var(--muted)}.eyebrow{font-size:.72rem;font-weight:800;letter-spacing:.09em;text-transform:uppercase;color:var(--primary)}.plant-summary-grid{margin:0}.stat-value.small{font-size:1.15rem}.stat-value.negative{color:#b42318}.plant-detail-grid{align-items:start}.compact-stack{display:grid;gap:.75rem}.config-summary{display:flex;align-items:center;justify-content:space-between;padding:.85rem 0;border-bottom:1px solid var(--border)}.config-summary:last-child{border-bottom:0}.config-summary span{color:var(--muted)}
.entity-tabs{display:flex;gap:.35rem;padding:0 0 1rem;border-bottom:1px solid var(--border);margin-bottom:1.25rem;overflow:auto}.entity-tab{border:0;background:transparent;padding:.7rem 1rem;border-radius:10px;color:var(--muted);font-weight:750;white-space:nowrap;cursor:pointer}.entity-tab span{display:inline-grid;place-items:center;min-width:22px;height:22px;margin-left:.35rem;padding:0 .35rem;border-radius:999px;background:#eef3ef;font-size:.72rem}.entity-tab.active{background:#e9f7ec;color:var(--primary-dark)}.entity-tab:disabled{opacity:.45;cursor:not-allowed}.plant-tab-panel{display:none}.plant-tab-panel.active{display:block}.panel-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;margin-bottom:1rem}.panel-toolbar h4{margin:0 0 .25rem;font-size:1.05rem}.panel-toolbar p{margin:0;color:var(--muted);font-size:.88rem}.participation-meter{padding:1rem;border:1px solid var(--border);border-radius:12px;background:#fafcfb;margin-bottom:1rem}.participation-meter>div:first-child{display:flex;justify-content:space-between;margin-bottom:.65rem}.meter-track{height:8px;background:#e8eeea;border-radius:999px;overflow:hidden}.meter-track span{display:block;height:100%;background:var(--primary);border-radius:999px}
@media(max-width:800px){.plant-workspace-header,.panel-toolbar{flex-direction:column}.plant-workspace-header .button-row{width:100%}.plant-workspace-header .button-row .btn{flex:1}.entity-tabs{margin-left:-.25rem;margin-right:-.25rem}.plant-detail-grid{grid-template-columns:1fr!important}}


/* Gestão de usinas */
.plant-header-actions { display:flex; align-items:flex-end; justify-content:flex-end; gap:.75rem; flex-wrap:wrap; }
.compact-filter { min-width:220px; margin:0; }
.compact-filter label { font-size:.78rem; margin-bottom:.3rem; }
.distribution-table-wrap { overflow-x:auto; border:1px solid var(--line); border-radius:14px; }
.distribution-edit-table { min-width:820px; margin:0; }
.distribution-edit-table input { min-width:130px; }
.distribution-edit-table tfoot td { background:#f3f8f4; font-weight:800; }
.modal-xl { width:min(1180px, calc(100vw - 2rem)); }
#entityModal .form-grid { align-items:start; }
#entityModal .field select, #entityModal .field input { width:100%; min-width:0; }
#entityModal .field label { min-height:1.35em; }
@media (max-width: 980px) {
  #entityModal .col-8, #entityModal .col-6, #entityModal .col-5, #entityModal .col-4, #entityModal .col-3, #entityModal .col-2 { grid-column:span 12; }
  .plant-header-actions { justify-content:flex-start; width:100%; }
  .compact-filter { width:100%; }
}

.empty-inline { padding: 1rem; color: var(--muted); text-align: center; }
#entityModal .unit-modal-grid .field { min-width: 0; }
#entityModal .unit-modal-grid .col-3 select,
#entityModal .unit-modal-grid .col-2 select { min-width: 0; }

/* Consolidação energética */
.unit-consolidation-table { min-width: 1420px; }
.admin-energy-values { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
@media (max-width: 760px) {
  .unit-consolidation-table { min-width: 1280px; }
  .admin-energy-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .admin-energy-values { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* Regras municipais, classe de ligação e filtros de resultado */
.result-filter-card { margin-bottom: 1rem; }
.cip-range-row { display:grid; grid-template-columns:repeat(3,minmax(130px,1fr)) auto; gap:.75rem; align-items:end; padding:.85rem; border:1px solid var(--border); border-radius:12px; background:#fafcfb; margin-bottom:.65rem; }
.cip-range-row .field { margin:0; }
.cip-range-row .btn { margin-bottom:.05rem; }
#resultStats { grid-template-columns:repeat(5,minmax(0,1fr)); }
#resultUnitTable table { min-width:1180px; }
@media (max-width:1180px) { #resultStats { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (max-width:800px) {
  .cip-range-row { grid-template-columns:1fr; }
  #resultStats { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:520px) { #resultStats { grid-template-columns:1fr; } }
@media print { body.print-results #page-results #resultStats { grid-template-columns:repeat(5,1fr); } }

/* Observação padrão e estado de desconto no demonstrativo */

/* Login institucional, indicadores de eficiência e Sobre */
.login-access-note {
  margin: 1rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
}
.login-visual-card {
  width: min(760px, 100%);
  position: relative;
  z-index: 1;
  padding: clamp(1.25rem, 2.8vw, 2.2rem);
  border-radius: 32px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 30px 80px rgba(0,0,0,.22);
  backdrop-filter: blur(15px);
}
.login-visual-copy { max-width: 620px; margin: 0 auto 1.1rem; text-align: center; }
.login-visual-copy h2 { margin: .55rem 0 .65rem; font-size: clamp(1.9rem, 3.6vw, 3.2rem); line-height: 1.06; }
.login-visual-copy p { margin: 0 auto; max-width: 600px; color: rgba(255,255,255,.84); font-size: 1rem; }
.login-energy-art { display: block; width: 100%; max-height: 610px; object-fit: contain; filter: drop-shadow(0 20px 35px rgba(0,0,0,.18)); }

.report-header { grid-template-columns: 245px 1fr 205px; }
.report-logo img { width: 235px; display: block; }

.compact-stats { margin: 0 1rem 1rem; }
.compact-stats .stat-card { min-height: 112px; }
.efficiency-dashboard-card { margin-top: 1rem; }
.efficiency-analysis-card .card-body { padding-bottom: .5rem; }
.efficiency-alerts { display: grid; gap: .75rem; }
.efficiency-alert {
  border-radius: 14px;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  background: #f8fbf8;
}
.efficiency-alert strong { display: block; color: var(--green-950); margin-bottom: .25rem; }
.efficiency-alert p { margin: .25rem 0; color: #415248; }
.efficiency-alert ul { margin: .55rem 0 0 1.1rem; padding: 0; }
.efficiency-alert.attention { background: var(--warning-soft); border-color: #efd59d; }
.efficiency-alert.attention strong { color: #8b5206; }
.efficiency-alert.critical { background: var(--danger-soft); border-color: #efbcbc; }
.efficiency-alert.critical strong { color: var(--danger); }
.efficiency-alert.good { background: var(--green-50); border-color: #cce8d0; }
.efficiency-meter { min-width: 120px; }
.efficiency-meter-track { height: 7px; border-radius: 999px; background: #e5ece7; overflow: hidden; margin-top: .35rem; }
.efficiency-meter-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d46a37, #e5bd3e, #2a9b4a); }
.efficiency-status { display: inline-flex; align-items: center; border-radius: 999px; padding: .28rem .55rem; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.efficiency-status.adequate { background: #e5f7e8; color: #17692e; }
.efficiency-status.punctual { background: #eef3ff; color: #355e9c; }
.efficiency-status.attention { background: #fff2d4; color: #8f5704; }
.efficiency-status.persistent, .efficiency-status.critical { background: #ffe2e2; color: #a32c2c; }
.efficiency-status.no-data { background: #eef1ef; color: #66746b; }
#efficiencyDashboardTable table, #efficiencyUnitTable table { min-width: 1180px; }

.about-grid { align-items: stretch; }
.about-grid > .card { min-height: 100%; }
.architecture-flow { display: flex; align-items: center; justify-content: center; gap: .55rem; flex-wrap: wrap; }
.architecture-node { flex: 1 1 145px; min-height: 100px; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg,#f8fcf8,#edf7ef); display: flex; flex-direction: column; justify-content: center; }
.architecture-node strong { color: var(--green-900); }
.architecture-node span { margin-top: .3rem; color: var(--muted); font-size: .8rem; }
.architecture-arrow { color: var(--green-600); font-size: 1.35rem; font-weight: 900; }
.technical-list { display: grid; gap: .15rem; }
.technical-list > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .72rem 0; border-bottom: 1px solid var(--line); }
.technical-list > div:last-child { border-bottom: 0; }
.technical-list span { color: var(--muted); }
.technical-list strong { color: var(--green-950); text-align: right; max-width: 62%; word-break: break-word; }
.about-features { display: flex; flex-wrap: wrap; gap: .6rem; }
.about-features span { padding: .58rem .8rem; border-radius: 999px; background: var(--green-50); border: 1px solid #d0e8d4; color: var(--green-900); font-size: .82rem; font-weight: 750; }

@media (max-width: 1100px) {
  .login-visual-card { max-width: 700px; }
  .report-header { grid-template-columns: 220px 1fr 190px; }
  .report-logo img { width: 210px; }
}
@media (max-width: 900px) {
  .login-visual-card { margin: 1rem 0; }
  .login-energy-art { max-height: 500px; }
}
@media (max-width: 640px) {
  .login-visual-copy h2 { font-size: 1.8rem; }
  .login-energy-art { max-height: 410px; }
  .compact-stats { margin-inline: .75rem; }
  .architecture-arrow { transform: rotate(90deg); width: 100%; text-align: center; }
  .technical-list > div { flex-direction: column; gap: .2rem; }
  .technical-list strong { max-width: 100%; text-align: left; }
}

@media print {
  .report-header { grid-template-columns: 45mm 1fr 39mm; gap: 3mm; }
  .report-logo img { width: 43mm; }
  body.print-results #page-results .efficiency-alerts { display: none; }
  body.print-results #page-results #efficiencyUnitTable table { min-width: 0; font-size: 6.7pt; }
}

/* Relatório estratégico formal em A4 */
.result-print-report { display: none; }
.formal-strategic-document {
  color: #1d2b22;
  background: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.formal-report-sheet { position: relative; background: #fff; }
.formal-report-header {
  display: grid;
  grid-template-columns: 43mm 1fr 31mm;
  align-items: center;
  gap: 5mm;
  padding-bottom: 4mm;
  border-bottom: 1.2pt solid #0b5e2b;
}
.formal-report-header img { width: 41mm; max-height: 19mm; object-fit: contain; object-position: left center; }
.formal-report-heading span { display: block; margin-bottom: 1mm; color: #0b5e2b; font-size: 6.7pt; font-weight: 800; letter-spacing: .12em; }
.formal-report-heading h1 { margin: 0; color: #123820; font-size: 17.5pt; line-height: 1.08; font-weight: 760; }
.formal-report-heading p { margin: 1.2mm 0 0; color: #5d6c63; font-size: 7.2pt; line-height: 1.35; }
.formal-report-classification { padding-left: 3mm; border-left: 1px solid #cbd8cf; text-align: right; }
.formal-report-classification strong { display: block; color: #194a2a; font-size: 7.2pt; letter-spacing: .08em; }
.formal-report-classification span { display: block; margin-top: 1mm; color: #6b786f; font-size: 6.3pt; }
.formal-report-meta { width: 100%; margin: 4mm 0 1mm; border-collapse: collapse; table-layout: fixed; font-size: 7pt; }
.formal-report-meta th, .formal-report-meta td { padding: 2mm 2.3mm; border: 1px solid #d4ddd7; text-align: left; vertical-align: top; }
.formal-report-meta th { width: 13%; color: #4f6256; background: #f3f6f4; font-size: 6.2pt; text-transform: uppercase; letter-spacing: .04em; }
.formal-report-meta td { width: 37%; color: #183b25; font-weight: 700; }
.formal-report-section { margin-top: 5mm; }
.formal-report-section h2, .formal-report-methodology h2 {
  display: flex;
  align-items: center;
  gap: 2mm;
  margin: 0 0 2.5mm;
  padding-bottom: 1.4mm;
  border-bottom: 1px solid #cfd9d2;
  color: #123820;
  font-size: 11pt;
  line-height: 1.2;
}
.formal-report-section h2 span {
  display: inline-grid;
  place-items: center;
  width: 6mm;
  height: 6mm;
  border: 1px solid #0b5e2b;
  border-radius: 50%;
  color: #0b5e2b;
  font-size: 6.5pt;
  font-weight: 850;
}
.formal-report-section h3 { margin: 0 0 2mm; color: #244d32; font-size: 8.2pt; }
.formal-executive-text { margin: 0 0 3mm; color: #30443a; font-size: 8pt; line-height: 1.55; text-align: justify; }
.formal-metric-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 7.1pt; }
.formal-metric-table th, .formal-metric-table td { padding: 2.1mm 2.3mm; border-top: 1px solid #dbe3de; border-bottom: 1px solid #dbe3de; }
.formal-metric-table th { width: 24%; color: #5b6c62; background: #f7f9f8; text-align: left; font-weight: 650; }
.formal-metric-table td { width: 26%; color: #10391f; text-align: right; font-size: 8.2pt; font-weight: 800; }
.formal-report-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; align-items: start; }
.formal-statement-table { width: 100%; border-collapse: collapse; font-size: 7pt; }
.formal-statement-table td { padding: 1.75mm 1.8mm; border-bottom: 1px solid #dde4df; }
.formal-statement-table td:first-child { color: #43564a; }
.formal-statement-table td.num { color: #173e25; font-weight: 720; white-space: nowrap; }
.formal-statement-table tr.subtotal td { border-top: 1.2pt solid #64806d; background: #f4f7f5; font-weight: 800; }
.formal-statement-table tr.total td { border-top: 1.5pt solid #0b5e2b; border-bottom: 1.5pt double #0b5e2b; color: #0b4c25; font-size: 8.2pt; font-weight: 850; }
.formal-management-note { margin-top: 5mm; padding: 3mm 3.5mm; border: 1px solid #b8cabd; border-left: 3px solid #0b5e2b; background: #fbfcfb; break-inside: avoid; }
.formal-management-note.neutral { border-left-color: #718078; }
.formal-management-note strong { display: block; margin-bottom: 1mm; color: #153f24; font-size: 7.5pt; text-transform: uppercase; letter-spacing: .04em; }
.formal-management-note p { margin: 0; color: #42554a; font-size: 7.2pt; line-height: 1.45; }
.formal-report-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 6.5pt; }
.formal-report-table thead { display: table-header-group; }
.formal-report-table th { padding: 1.9mm 1.5mm; border-top: 1.2pt solid #0b5e2b; border-bottom: 1px solid #9fb1a4; background: #f1f5f2; color: #173f26; text-align: left; font-size: 6.2pt; line-height: 1.2; font-weight: 800; }
.formal-report-table td { padding: 1.8mm 1.5mm; border-bottom: 1px solid #dce3de; color: #2b3d32; vertical-align: top; line-height: 1.3; overflow-wrap: anywhere; }
.formal-report-table tbody tr:nth-child(even) td { background: #fafbfa; }
.formal-report-table td.num { text-align: right; white-space: nowrap; }
.formal-report-table td strong { color: #173e25; font-size: 6.7pt; }
.formal-report-table td small { display: block; margin-top: .7mm; color: #68766d; font-size: 5.7pt; line-height: 1.2; }
.formal-report-table.alert-table th:nth-child(1) { width: 10%; }
.formal-report-table.alert-table th:nth-child(2) { width: 24%; }
.formal-report-table.alert-table th:nth-child(3) { width: 31%; }
.formal-report-table.alert-table th:nth-child(4) { width: 35%; }
.formal-priority { display: inline-block; min-width: 16mm; padding: .8mm 1.5mm; border: 1px solid currentColor; border-radius: 999px; text-align: center; font-size: 5.8pt; font-weight: 850; text-transform: uppercase; letter-spacing: .03em; }
.formal-priority.high { color: #9c2f2f; }
.formal-priority.medium { color: #98620d; }
.formal-priority.monitor { color: #44657d; }
.formal-report-table.compact th:nth-child(1) { width: 56%; }
.formal-report-table.compact th:nth-child(2), .formal-report-table.compact th:nth-child(3) { width: 22%; text-align: right; }
.ranking-columns { gap: 6mm; }
.formal-report-table.efficiency { font-size: 6.15pt; }
.formal-report-table.efficiency th:nth-child(1) { width: 21%; }
.formal-report-table.efficiency th:nth-child(2), .formal-report-table.efficiency th:nth-child(3) { width: 11%; }
.formal-report-table.efficiency th:nth-child(4) { width: 14%; }
.formal-report-table.efficiency th:nth-child(5) { width: 13%; }
.formal-report-table.efficiency th:nth-child(6) { width: 30%; }
.formal-report-table.units { font-size: 5.85pt; }
.formal-report-table.units th:nth-child(1) { width: 18%; }
.formal-report-table.units th:nth-child(2) { width: 12%; }
.formal-report-table.units th:nth-child(3) { width: 8%; }
.formal-report-table.units th:nth-child(n+4) { width: 8.85%; text-align: right; }
.formal-report-summary-line { display: flex; justify-content: flex-end; gap: 5mm; margin-top: 3mm; padding-top: 2mm; border-top: 1px solid #d7dfd9; color: #5e6d64; font-size: 6.2pt; }
.formal-report-summary-line strong { color: #163e24; }
.formal-report-notes { margin: 0; padding: 2mm 3mm 2mm 7mm; border: 1px solid #d5ded8; color: #405248; font-size: 6.8pt; line-height: 1.45; }
.formal-report-methodology { margin-top: 5mm; padding-top: 3mm; border-top: 1.2pt solid #708278; color: #516159; font-size: 6.3pt; line-height: 1.45; }
.formal-report-methodology h2 { margin-bottom: 1.5mm; border-bottom: 0; font-size: 8pt; }
.formal-report-methodology p { margin: 1mm 0 0; }
.formal-report-footer { display: flex; justify-content: space-between; gap: 4mm; margin-top: 5mm; padding-top: 2mm; border-top: 1px solid #ccd6cf; color: #65736a; font-size: 5.8pt; }

@media print {
  @page { size: A4 portrait; margin: 10mm 11mm 11mm; }
  body.print-results { background: #fff !important; }
  body.print-results #page-results > :not(.result-print-report) { display: none !important; }
  body.print-results #page-results .result-print-report { display: block !important; }
  body.print-results #page-results { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body.print-results .formal-strategic-document,
  body.print-results .formal-report-sheet { display: block !important; background: #fff !important; }
  body.print-results .formal-page-break { break-before: page; page-break-before: always; }
  body.print-results .formal-report-header,
  body.print-results .formal-report-meta,
  body.print-results .formal-management-note,
  body.print-results .formal-report-methodology,
  body.print-results .formal-report-columns > .formal-report-section { break-inside: avoid; page-break-inside: avoid; }
  body.print-results .formal-report-table thead { display: table-header-group; }
  body.print-results .formal-report-table tr,
  body.print-results .formal-statement-table tr,
  body.print-results .formal-metric-table tr { break-inside: avoid; page-break-inside: avoid; }
  body.print-results .formal-report-table th,
  body.print-results .formal-report-table td { padding: 1.7mm 1.35mm; }
  body.print-results .formal-report-footer { break-inside: avoid; }
  * { print-color-adjust: exact !important; -webkit-print-color-adjust: exact !important; }
}

/* Notas da versão administrativa */
.version-badge {
  border: 1px solid #d4dfd7;
  background: #fff;
  color: var(--green-800);
  cursor: pointer;
  font: inherit;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.version-badge:hover { border-color: var(--green-500); background: var(--green-50); transform: translateY(-1px); }
.version-badge:focus-visible { outline: 3px solid rgba(32,138,66,.22); outline-offset: 2px; }
.release-notes-modal { width: min(1080px, calc(100vw - 2rem)); }
.release-notes-modal .modal-body { padding: 0; background: #f4f7f4; }
.release-notes-document { padding: clamp(1.2rem, 3vw, 2.2rem); color: #26372d; }
.release-notes-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.3rem, 3vw, 2.25rem);
  border-radius: 20px;
  background: linear-gradient(135deg, #0a4f25, #0c6d31);
  box-shadow: 0 18px 45px rgba(9,74,33,.18);
  color: #fff;
}
.release-notes-eyebrow { display: block; margin-bottom: .45rem; color: rgba(255,255,255,.76); font-size: .72rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.release-notes-hero h2 { margin: 0; color: #fff; font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1; }
.release-notes-hero p { margin: .65rem 0 0; color: rgba(255,255,255,.86); font-weight: 650; }
.release-notes-version { flex: 0 0 auto; display: grid; place-items: center; min-width: 116px; min-height: 76px; padding: .8rem 1rem; border: 1px solid rgba(255,255,255,.32); border-radius: 18px; background: rgba(255,255,255,.1); font-size: 1.55rem; font-weight: 900; letter-spacing: -.03em; }
.release-notes-summary { max-width: 920px; margin: 1.5rem auto; color: #405248; font-size: .96rem; line-height: 1.7; text-align: center; }
.release-notes-highlights { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.release-notes-highlights article { min-height: 132px; padding: 1.1rem; border: 1px solid #d9e2db; border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(13,65,31,.055); }
.release-notes-highlights strong { display: block; color: var(--green-800); font-size: 1.65rem; line-height: 1; }
.release-notes-highlights span { display: block; margin-top: .55rem; color: #263b2e; font-size: .84rem; font-weight: 850; }
.release-notes-highlights small { display: block; margin-top: .3rem; color: var(--muted); font-size: .72rem; line-height: 1.35; }
.release-notes-sections { display: grid; gap: .85rem; }
.release-notes-section { display: grid; grid-template-columns: 48px 1fr; gap: 1rem; padding: 1.2rem 1.3rem; border: 1px solid #d9e2db; border-radius: 16px; background: #fff; }
.release-notes-section-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--green-50); border: 1px solid #cfe4d3; color: var(--green-800); font-size: .75rem; font-weight: 900; }
.release-notes-section h3 { margin: .2rem 0 .6rem; color: var(--green-950); font-size: 1rem; }
.release-notes-section ul, .release-notes-footer-note ul { margin: 0; padding-left: 1.05rem; }
.release-notes-section li { margin: .35rem 0; color: #435349; font-size: .82rem; line-height: 1.5; }
.release-notes-section li::marker { color: var(--green-600); }
.release-notes-footer-note { margin-top: 1rem; padding: 1.1rem 1.25rem; border-left: 4px solid var(--green-600); border-radius: 0 14px 14px 0; background: #eaf4ec; }
.release-notes-footer-note strong { display: block; margin-bottom: .45rem; color: var(--green-900); }
.release-notes-footer-note li { margin: .3rem 0; color: #405248; font-size: .8rem; line-height: 1.45; }
@media (max-width: 820px) {
  .release-notes-highlights { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .release-notes-hero { align-items: flex-start; }
  .release-notes-version { min-width: 92px; min-height: 64px; font-size: 1.2rem; }
}
@media (max-width: 560px) {
  .release-notes-hero { flex-direction: column; }
  .release-notes-version { width: 100%; min-height: 54px; }
  .release-notes-highlights { grid-template-columns: 1fr; }
  .release-notes-section { grid-template-columns: 1fr; }
}

/* v1.1.0 — identidade por CPF e múltiplos perfis */
.checkbox-grid { display: flex; flex-wrap: wrap; gap: .65rem 1rem; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft, #f8faf8); }
.checkbox-grid label { display: inline-flex; align-items: center; gap: .45rem; margin: 0; font-weight: 750; cursor: pointer; }
.checkbox-grid input { width: 1rem; height: 1rem; accent-color: var(--green-700); }

/* v1.2.0 — retroativos, ciclos de crédito e CIP controlada */
.release-history-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 620px; }
.release-history-sidebar { padding: 1rem; border-right: 1px solid var(--border); background: #eef4ef; }
.release-history-heading { display: grid; gap: .25rem; margin-bottom: .8rem; padding: .35rem .25rem .7rem; }
.release-history-heading span { color: var(--muted); font-size: .75rem; }
.release-history-button { display: grid; width: 100%; gap: .2rem; margin-bottom: .55rem; padding: .85rem; border: 1px solid #d6e1d8; border-radius: 12px; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.release-history-button strong { color: var(--green-850, var(--green-800)); }
.release-history-button span { font-size: .78rem; font-weight: 750; }
.release-history-button small { color: var(--muted); }
.release-history-button.active { border-color: var(--green-600); background: var(--green-50); box-shadow: inset 4px 0 0 var(--green-700); }
.release-history-legacy { display: grid; gap: .25rem; margin-top: 1rem; padding: .8rem; border-top: 1px dashed #bdcbbf; color: var(--muted); font-size: .75rem; }
.nested-form-grid { padding: 1rem; border: 1px solid #dbe5dd; border-radius: 14px; background: #f7faf7; }
.tariff-flag-badge { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .42rem .78rem; border-radius: 12px; font-weight: 900; font-size: .82rem; letter-spacing: .02em; border: 0; }
.tariff-flag-badge::before { content: "●"; display: inline-block; line-height: 1; font-size: .95em; color: currentColor; }
.tariff-green { color: #18723a; background: #e6f6eb; }
.tariff-yellow { color: #b77900; background: #fff1b8; }
.tariff-red1 { color: #c83b31; background: #ffe7e3; }
.tariff-red2 { color: #9d1515; background: #fbdada; }
.distribution-credit-table th:nth-child(1) { min-width: 220px; }
.distribution-credit-table th:nth-child(4) { min-width: 190px; }
.distribution-credit-table th:nth-child(5) { min-width: 170px; }
.distribution-credit-table select, .distribution-credit-table input { min-width: 110px; }
.text-success { color: #087d35 !important; font-weight: 800; }
.text-danger { color: #b42318 !important; font-weight: 800; }
@media (max-width: 820px) {
  .release-history-layout { grid-template-columns: 1fr; }
  .release-history-sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .release-history-button { display: inline-grid; width: calc(50% - .4rem); margin-right: .35rem; vertical-align: top; }
}
@media (max-width: 560px) { .release-history-button { width: 100%; margin-right: 0; } }

/* v1.2.0 final — formulários móveis e melhor aproveitamento de espaço */
.form-grid > .field { min-width: 0; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-width: 0; }
#dashboardStats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.payment-component-input { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .invoice-layout { grid-template-columns: 1fr; }
  .calc-preview { position: static; }
  .monthly-distribution-form .col-2,
  .monthly-distribution-form .col-3,
  .monthly-distribution-form .col-5 { grid-column: span 6; }
  .distribution-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .distribution-edit-table { min-width: 820px; }
}

@media (max-width: 680px) {
  .modal-backdrop { align-items: stretch; padding: 0; }
  .modal, .modal.modal-lg, .modal.modal-sm {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
  }
  .modal-header { position: sticky; top: 0; z-index: 3; padding: .9rem 1rem; background: #fff; }
  .modal-body { padding: .9rem; }
  .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem;
    padding: .75rem .9rem;
    background: #fff;
  }
  .modal-footer .btn { width: 100%; min-height: 44px; margin: 0; }
  .modal-footer .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .form-grid { gap: .75rem; }
  .form-grid > [class*="col-"] { grid-column: 1 / -1 !important; }
  .field label { line-height: 1.25; }
  .section-card .card-body { padding: .9rem; }
  .section-number { flex: 0 0 auto; }
  .nested-form-grid { padding: .75rem; }
  .table-actions { flex-wrap: wrap; }
  .table-actions .btn { flex: 1 1 130px; }
  .report-toolbar { align-items: stretch; }
  .report-toolbar .button-row { display: grid; grid-template-columns: 1fr; }
  .monthly-distribution-form .col-2,
  .monthly-distribution-form .col-3,
  .monthly-distribution-form .col-5 { grid-column: 1 / -1; }
}


/* v1.2.1 — listas operacionais em cartões no celular */
@media (max-width: 760px) {
  .mobile-card-list {
    overflow: visible;
    padding: 0 .75rem .85rem;
  }
  .mobile-card-list .responsive-list-table {
    min-width: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
  }
  .mobile-card-list .responsive-list-table thead {
    display: none;
  }
  .mobile-card-list .responsive-list-table tbody {
    display: grid;
    gap: .8rem;
  }
  .mobile-card-list .responsive-list-table tbody tr {
    display: block;
    padding: .25rem .9rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(11, 75, 38, .06);
  }
  .mobile-card-list .responsive-list-table tbody td {
    display: grid;
    grid-template-columns: minmax(102px, 35%) minmax(0, 1fr);
    gap: .7rem;
    align-items: start;
    width: 100%;
    padding: .7rem 0;
    border-bottom: 1px solid #e7eee9;
    text-align: left !important;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .mobile-card-list .responsive-list-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .67rem;
    font-weight: 850;
    letter-spacing: .055em;
    line-height: 1.25;
    text-transform: uppercase;
  }
  .mobile-card-list .responsive-list-table tbody td[data-label=""]::before {
    display: none;
  }
  .mobile-card-list .responsive-list-table tbody td:last-child {
    display: block;
    border-bottom: 0;
    padding-top: .85rem;
  }
  .mobile-card-list .responsive-list-table tbody td:last-child::before {
    display: none;
  }
  .mobile-card-list .responsive-list-table .table-title {
    font-size: 1rem;
  }
  .mobile-card-list .responsive-list-table .table-sub {
    margin-top: .25rem;
    line-height: 1.35;
  }
  .mobile-card-list .responsive-list-table .table-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    justify-content: stretch;
  }
  .mobile-card-list .responsive-list-table .table-actions .btn {
    width: 100%;
    min-height: 42px;
    white-space: normal;
  }
  #page-units .card,
  #page-invoices .card,
  #page-consumers .card,
  #page-users .card,
  #page-payments .card,
  #page-plants > .card:first-of-type {
    overflow: visible;
  }
}

@media (max-width: 430px) {
  .mobile-card-list .responsive-list-table tbody td {
    grid-template-columns: 1fr;
    gap: .25rem;
  }
  .mobile-card-list .responsive-list-table .table-actions {
    grid-template-columns: 1fr;
  }
}

/* v1.2.2 — correções operacionais e distribuição responsiva */
.col-9 { grid-column: span 9; }
.col-5 { grid-column: span 5; }

.legacy-distribution-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .45rem .75rem;
  align-items: start;
}
.legacy-distribution-notice strong {
  white-space: nowrap;
}
.legacy-distribution-notice span {
  min-width: 0;
}

@media (max-width: 1100px) {
  #plantMonthlyModal .modal-xl {
    width: min(96vw, 980px);
  }
  #plantMonthlyModal .monthly-distribution-form > .col-9,
  #plantMonthlyModal .monthly-distribution-form > .col-12 {
    grid-column: 1 / -1;
  }
  #plantMonthlyModal .monthly-distribution-form > .col-2,
  #plantMonthlyModal .monthly-distribution-form > .col-3,
  #plantMonthlyModal .monthly-distribution-form > .col-5 {
    grid-column: span 6;
  }
}

@media (max-width: 760px) {
  .mobile-card-list .responsive-list-table tbody td.responsive-actions-cell {
    display: block;
    border-bottom: 0;
    padding-top: .85rem;
  }
  .mobile-card-list .responsive-list-table tbody td.responsive-actions-cell::before {
    display: none;
  }
  .mobile-card-list .responsive-list-table tbody td:last-child:not(.responsive-actions-cell) {
    display: grid;
    border-bottom: 0;
  }
  .mobile-card-list .responsive-list-table tbody td:last-child:not(.responsive-actions-cell)::before {
    display: block;
  }

  #page-plants .plant-workspace > .card .mobile-card-list {
    padding: 0 .75rem .85rem;
  }
  #page-plants .plant-workspace > .card .responsive-list-table tbody td:first-child {
    font-size: 1rem;
  }

  #plantMonthlyModal .modal,
  #plantMonthlyModal .modal-xl {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
  }
  #plantMonthlyModal .modal-body {
    overflow-x: hidden;
  }
  #plantMonthlyModal .distribution-table-wrap.mobile-card-list {
    overflow: visible;
    padding: 0;
    border: 0;
    background: transparent;
  }
  #plantMonthlyModal .distribution-edit-table {
    min-width: 0 !important;
  }
  #plantMonthlyModal .responsive-list-table tbody {
    gap: .75rem;
  }
  #plantMonthlyModal .responsive-list-table tbody tr {
    padding: .45rem .85rem;
  }
  #plantMonthlyModal .responsive-list-table tbody td {
    grid-template-columns: minmax(105px, 34%) minmax(0, 1fr);
    padding: .62rem 0;
  }
  #plantMonthlyModal .responsive-list-table input,
  #plantMonthlyModal .responsive-list-table select {
    width: 100%;
    min-width: 0;
  }
  #plantMonthlyModal .responsive-list-table tfoot {
    display: block;
    margin-top: .75rem;
  }
  #plantMonthlyModal .responsive-list-table tfoot tr {
    display: grid;
    gap: .35rem;
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f3f8f4;
  }
  #plantMonthlyModal .responsive-list-table tfoot td {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    width: 100%;
    padding: .2rem 0;
    border: 0;
  }
  #plantMonthlyModal .responsive-list-table tfoot td[colspan] {
    display: block;
  }
  .legacy-distribution-notice {
    grid-template-columns: 1fr;
    gap: .25rem;
    font-size: .9rem;
  }
  .legacy-distribution-notice strong {
    white-space: normal;
  }
}

@media (max-width: 430px) {
  #plantMonthlyModal .responsive-list-table tbody td {
    grid-template-columns: 1fr;
    gap: .3rem;
  }
}


/* v1.2.3 — consolidação confiável e edição de demonstrativos */
.consolidation-help { margin-bottom: 1rem; line-height: 1.55; }
.consolidation-help strong { display: block; margin-bottom: .25rem; color: var(--green-900, #0b4f2d); }
@media (max-width: 720px) {
  .consolidation-help { margin: 0 0 1rem; padding: 1rem; font-size: .95rem; }
}

/* v1.3.0 — histórico, titularidade, importação CEMIG e WhatsApp */

.dashboard-plant-history-card .button-row { justify-content: flex-end; }
.dashboard-plant-history-card .card-body { min-width: 0; }
.plant-history-filters { flex-wrap: wrap; }
.plant-history-filters select { min-width: 150px; }
.plant-history-card .card-header { align-items: flex-end; gap: 1rem; }
.compact-stats .stat-card { min-height: 112px; }
.line-chart-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: #fff; padding: 1rem; }
.line-chart-wrap svg { display: block; width: 100%; min-width: 760px; height: auto; }
.chart-grid { stroke: #dce8df; stroke-width: 1; }
.chart-axis-label { fill: #65756c; font-size: 12px; }
.chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { stroke: #fff; stroke-width: 2; }
.chart-line.series-0, .chart-dot.series-0, .chart-legend i.series-0 { stroke: #ffb750; background: #ffb750; fill: #ffb750; }
.chart-line.series-1, .chart-dot.series-1, .chart-legend i.series-1 { stroke: #4586d7; background: #4586d7; fill: #4586d7; }
.chart-line.series-2, .chart-dot.series-2, .chart-legend i.series-2 { stroke: #44843e; background: #44843e; fill: #44843e; }
.chart-line.series-3, .chart-dot.series-3, .chart-legend i.series-3 { stroke: #e64f65; background: #e64f65; fill: #e64f65; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .65rem 1.15rem; margin: 0 0 .65rem; color: #405047; font-size: .9rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend i { width: 20px; height: 4px; border-radius: 20px; display: inline-block; }
@media (max-width: 680px) {
  .dashboard-plant-history-card .card-header { align-items: stretch; }
  .dashboard-plant-history-card .plant-history-filters { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .dashboard-plant-history-card .plant-history-filters select { width: 100%; min-width: 0; }
  .dashboard-plant-history-card .card-body { padding: .75rem; }
  .dashboard-plant-history-card .compact-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .dashboard-plant-history-card .compact-stats .stat-card { min-height: 92px; padding: .75rem; }
  .dashboard-plant-history-card .line-chart-wrap { padding: .55rem; border-radius: 14px; }
  .dashboard-plant-history-card .line-chart-wrap svg { min-width: 560px; height: 245px; }
  .dashboard-plant-history-card .chart-legend { font-size: .78rem; gap: .4rem .7rem; }
}
.check-line { display: flex; align-items: flex-start; gap: .65rem; font-weight: 700; }
.check-line input { width: 20px; height: 20px; margin-top: .05rem; flex: 0 0 auto; }
.pdf-import-preview { min-height: 40px; }
.pdf-preview-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .8rem; }
.pdf-preview-grid > div { border: 1px solid var(--line); border-radius: 14px; padding: .8rem; background: #f8fbf8; }
.pdf-preview-grid span { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.pdf-preview-grid strong { display: block; overflow-wrap: anywhere; }
.whatsapp-status { margin-top: .25rem; }
.whatsapp-status.sent, .whatsapp-status.delivered, .whatsapp-status.read { color: #ffb750; }
.whatsapp-status.failed { color: #b12b2b; }
.whatsapp-status.skipped { color: #8a6500; }
.consumption-history-section { margin-top: 14px; break-inside: avoid; }
.consumption-history-chart { padding: 10px 12px 4px; border: 1px solid #dce7df; border-bottom: 0; border-radius: 10px 10px 0 0; }
.consumption-bars { height: 112px; display: flex; align-items: flex-end; gap: 5px; }
.consumption-bar-item { flex: 1; min-width: 0; display: grid; grid-template-rows: 18px 70px 18px; align-items: end; text-align: center; font-size: 8px; color: #526259; }
.consumption-bar-track { height: 70px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid #cbd9cf; }
.consumption-bar-track span { width: min(18px,70%); min-height: 3px; background: #16793c; border-radius: 4px 4px 0 0; }
.consumption-bar-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.consumption-history-table table { width: 100%; font-size: 9px; border-collapse: collapse; }
.consumption-history-table th, .consumption-history-table td { padding: 5px 7px; border: 1px solid #dce7df; }
.consumption-history-table th { background: #f2f7f3; text-transform: uppercase; letter-spacing: .04em; }

@media (max-width: 720px) {
  .plant-history-card .card-header { align-items: stretch; }
  .plant-history-card .card-header select { width: 100%; }
  .line-chart-wrap { padding: .65rem; }
  .pdf-preview-grid { grid-template-columns: 1fr; }
  #ownershipModal .modal, #cemigPdfModal .modal { width: 100%; max-width: none; min-height: 100dvh; border-radius: 0; }
}

@media print {
  .consumption-history-section { break-before: auto; page-break-inside: avoid; }
  .consumption-history-chart { padding: 6px 8px 2px; }
  .consumption-bars { height: 88px; }
  .consumption-bar-item { grid-template-rows: 14px 55px 14px; font-size: 7px; }
  .consumption-bar-track { height: 55px; }
}
.ownership-history-mini { margin-top: .75rem; display: grid; gap: .35rem; }
.ownership-history-mini > div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-top: 1px solid rgba(11,94,43,.12); }
.ownership-history-mini small { color: var(--muted); }

/* Demonstrativo v1.3.0 — composição moderna em A4 */
.report-page.report-v130 {
  width: min(1000px, 100%);
  min-height: auto;
  border: 1px solid #c8d8cd;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 24px 70px rgba(12, 55, 27, .14);
}
.report-v130 .report-header {
  grid-template-columns: 190px minmax(0, 1fr) 178px;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid #dce7df;
  align-items: center;
}
.report-v130 .report-logo img { width: 196px; }
.report-v130 .report-heading h1 {
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -.02em;
  text-transform: none;
}
.report-unit-identity {
  margin-top: 10px;
  color: var(--green-800);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
}
.report-v130 .report-private {
  border: 0;
  border-radius: 14px;
  padding: 14px 12px;
  background: linear-gradient(145deg, #edf8ec, #f8fbf8);
  color: var(--green-950);
  font-size: 12px;
  letter-spacing: .04em;
  align-self: center;
}
.report-v130 .report-private span {
  display: inline-block;
  margin-top: 4px;
  color: #6c7c72;
  font-size: 9px;
  letter-spacing: .08em;
}
.report-primary-card {
  display: grid;
  grid-template-columns: .92fr 1.65fr;
  margin-top: 16px;
  border: 1px solid #d5e1d8;
  border-radius: 15px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 25px rgba(18, 74, 38, .055);
}
.report-customer-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 17px 19px;
  background: linear-gradient(145deg, #f1f8f1, #fbfdfb);
  border-right: 1px solid #d5e1d8;
}
.report-eyebrow,
.report-summary-panel span,
.payment-meta-grid span,
.pix-amount span {
  color: #718077;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.report-customer-panel strong {
  margin-top: 6px;
  color: var(--green-950);
  font-size: 18px;
  line-height: 1.15;
}
.report-customer-panel > span:last-child {
  margin-top: 7px;
  color: #5c6d62;
  font-size: 12px;
  line-height: 1.35;
}
.report-summary-panel { min-width: 0; }
.report-summary-top,
.report-summary-bottom { display: grid; }
.report-summary-top { grid-template-columns: 1fr 1fr 1fr; }
.report-summary-bottom {
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #dce7df;
}
.report-summary-panel > div > div {
  min-width: 0;
  padding: 13px 15px;
  border-left: 1px solid #dce7df;
  text-align: center;
}
.report-summary-panel strong {
  display: block;
  margin-top: 5px;
  color: var(--green-950);
  font-size: 15px;
  line-height: 1.2;
  text-align: center;
}
.report-summary-total {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
}
.report-summary-total span,
.report-summary-total strong { color: #fff; }
.report-summary-total strong { font-size: 21px; }
.report-v130 .report-section-title {
  margin-top: 14px;
  padding: 7px 12px;
  border-radius: 9px;
  background: linear-gradient(100deg, #164f2b, #2d8144);
  font-size: 13px;
  letter-spacing: .045em;
}
.reading-grid-v130 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.reading-box-v130 {
  min-height: 100px;
  border: 1px solid #d3e0d6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(15, 63, 31, .045);
}
.reading-box-v130 .reading-box-label {
  min-height: auto;
  padding: 8px 7px;
  border-bottom: 1px solid #e1e9e3;
  background: #f3f7f4;
  font-size: 11px;
}
.reading-box-date {
  padding: 8px 6px 0;
  color: #6f7d74;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}
.reading-box-v130 .reading-box-value {
  padding: 7px 6px 11px;
  color: var(--green-950);
  font-size: 19px;
}
.reading-box-v130 .reading-box-single {
  min-height: 66px;
  padding-top: 12px;
}
.invoice-statement {
  margin-top: 9px;
  border: 1px solid #d5e1d8;
  border-radius: 13px;
  overflow: hidden;
  box-shadow: 0 5px 18px rgba(15, 63, 31, .04);
}
.statement-header,
.statement-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 155px;
  align-items: center;
  gap: 14px;
}
.statement-header {
  padding: 8px 14px;
  background: #f0f5f1;
  color: #607067;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.statement-header strong,
.statement-row strong { text-align: right; white-space: nowrap; }
.statement-row {
  padding: 7px 14px;
  border-top: 1px solid #e0e8e2;
  color: #34473a;
  font-size: 12px;
}
.statement-group {
  padding-block: 8px;
  background: #eaf5e9;
  color: var(--green-950);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.statement-plant { background: #f1f7f0; }
.statement-subrow span { padding-left: 12px; }
.statement-subrow strong { color: #253b2c; }
.statement-negative { color: #21703a !important; }
.statement-total {
  padding-block: 11px;
  background: linear-gradient(120deg, #133f25, #23783a);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}
.statement-total strong { color: #fff; font-size: 20px; }
.report-benefit-note {
  margin-top: 8px !important;
  padding: 8px 11px !important;
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.3;
}
.payment-area-v130 {
  grid-template-columns: minmax(0, 1fr) 278px;
  gap: 12px;
  margin-top: 9px;
  align-items: stretch;
}
.payment-main-v130 {
  min-width: 0;
  border: 1px solid #d5e1d8;
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
}
.payment-meta-grid {
  display: grid;
  grid-template-columns: .8fr 1.25fr 1fr;
  border-bottom: 1px solid #dce7df;
  background: #f6f9f7;
}
.payment-meta-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border-left: 1px solid #dce7df;
}
.payment-meta-grid > div:first-child { border-left: 0; }
.payment-meta-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--green-950);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.payment-status-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px !important;
  font-weight: 900;
  letter-spacing: .02em;
}
.payment-status-text.paid { color: #18723a; background: #e6f6eb; }
.payment-status-text.open { color: #23578f; background: #e8f0ff; }
.payment-status-text.overdue { color: #a52e2e; background: #fde9e9; }
.consumption-history-v130 {
  margin: 0;
  padding: 9px 11px 10px;
  break-inside: avoid;
}
.history-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.history-title-row strong {
  color: var(--green-950);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.history-title-row span { color: #78867d; font-size: 8px; }
.consumption-history-v130 .consumption-history-table table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #dce7df;
  border-radius: 9px;
  font-size: 8.2px;
  line-height: 1.1;
}
.consumption-history-v130 .consumption-history-table th,
.consumption-history-v130 .consumption-history-table td {
  width: 25%;
  padding: 2.4px 6px;
  border: 0;
  border-bottom: 1px solid #e1e9e3;
  text-align: center;
}
.consumption-history-v130 .consumption-history-table th {
  background: #eaf4e9;
  color: #40564a;
  font-size: 8.8px;
  letter-spacing: .04em;
}
.consumption-history-v130 .consumption-history-table tbody tr:nth-child(even) td { background: #fafcfa; }
.consumption-history-v130 .consumption-history-table tbody tr:last-child td { border-bottom: 0; }
.history-empty {
  padding: 18px;
  border: 1px dashed #c7d7cb;
  border-radius: 9px;
  color: #748279;
  font-size: 11px;
  text-align: center;
}
.pix-box-v130 {
  display: flex;
  flex-direction: column;
  border-color: #cbdacf;
  border-radius: 13px;
  box-shadow: 0 5px 18px rgba(15, 63, 31, .04);
}
.pix-box-v130 .pix-title {
  margin: -10px -14px 8px;
  border-radius: 11px 11px 0 0;
  font-size: 11px;
}
.pix-box-v130 #reportQr canvas,
.pix-box-v130 #reportQr img { width: 168px !important; height: 168px !important; }
.pix-box-v130 .pix-key { font-size: 10px; }
.pix-box-v130 .pix-key strong { font-size: 12px; overflow-wrap: anywhere; }
.pix-amount {
  margin-top: 9px;
  padding: 9px 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, #edf8ec, #f8fbf8);
}
.pix-amount strong {
  display: block;
  margin-top: 3px;
  color: var(--green-900);
  font-size: 19px;
}
.report-v130 .report-observations {
  margin-top: 10px;
  border: 1px solid #d3e0d6;
  border-radius: 11px;
}
.report-v130 .report-observations-title {
  padding: 7px 11px;
  background: #f1f6f2;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.report-v130 .report-observations p { padding: 9px 12px; font-size: 11px; line-height: 1.38; }
.report-v130 .report-footer { margin-top: 10px; font-size: 11px; }

@media (max-width: 900px) {
  .report-body { padding: 10px; overflow-x: hidden; }
  .report-page.report-v130 { width: 100%; padding: 18px; border-radius: 16px; }
  .report-v130 .report-header { grid-template-columns: 130px minmax(0, 1fr); }
  .report-v130 .report-logo img { width: 142px; }
  .report-v130 .report-private { display: none; }
  .report-v130 .report-heading h1 { font-size: 19px; }
  .report-primary-card { grid-template-columns: 1fr; }
  .report-customer-panel { border-right: 0; border-bottom: 1px solid #d5e1d8; }
  .reading-grid-v130 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-area-v130 { grid-template-columns: 1fr; }
  .pix-box-v130 { order: -1; }
  .pix-box-v130 #reportQr canvas, .pix-box-v130 #reportQr img { width: 210px !important; height: 210px !important; }
}

@media (max-width: 560px) {
  .report-page.report-v130 { padding: 12px; }
  .report-v130 .report-header { grid-template-columns: 1fr; gap: 10px; text-align: left; }
  .report-v130 .report-logo img { width: 164px; }
  .report-v130 .report-heading h1 { font-size: 17px; }
  .report-unit-identity { font-size: 11px; line-height: 1.35; }
  .report-summary-top { grid-template-columns: 1fr 1fr; }
  .report-summary-top .report-summary-total { grid-column: span 2; border-top: 1px solid #dce7df; }
  .report-summary-bottom { grid-template-columns: 1fr; }
  .report-summary-panel > div > div { border-left: 0; border-top: 1px solid #dce7df; }
  .reading-grid-v130 { grid-template-columns: 1fr 1fr; gap: 7px; }
  .reading-box-v130 .reading-box-value { font-size: 16px; }
  .statement-header, .statement-row { grid-template-columns: minmax(0, 1fr) 105px; gap: 8px; }
  .statement-row { padding: 7px 9px; font-size: 10px; }
  .statement-subrow span { padding-left: 5px; }
  .statement-total { font-size: 13px; }
  .statement-total strong { font-size: 15px; }
  .payment-meta-grid { grid-template-columns: 1fr; }
  .payment-meta-grid > div { border-left: 0; border-top: 1px solid #dce7df; }
  .payment-meta-grid > div:first-child { border-top: 0; }
  .history-title-row { align-items: flex-start; flex-direction: column; gap: 2px; }
  .consumption-history-v130 .consumption-history-table { overflow-x: auto; }
  .consumption-history-v130 .consumption-history-table table { min-width: 420px; }
}

@media print {
  @page { size: A4 portrait; margin: 5mm; }
  .report-page.report-v130 {
    width: 200mm;
    min-height: 287mm;
    margin: 0 auto;
    padding: 5mm 5mm 5mm;
    border: .25mm solid #aebfb3;
    border-radius: 2.5mm;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
    box-sizing: border-box;
  }
  .report-v130 .report-header {
    grid-template-columns: 42mm 1fr 38mm;
    gap: 3mm;
    padding-bottom: 2.5mm;
    align-items: center;
  }
  .report-v130 .report-logo img { width: 39mm; }
  .report-v130 .report-heading h1 { font-size: 12pt; line-height: 1.04; }
  .report-unit-identity { margin-top: 1mm; font-size: 6pt; line-height: 1.18; }
  .report-v130 .report-private { border-radius: 2mm; padding: 2mm 1.5mm; font-size: 6.1pt; }
  .report-v130 .report-private span { margin-top: .5mm; font-size: 4.6pt; }
  .report-primary-card { margin-top: 2.3mm; border-radius: 2mm; box-shadow: none; }
  .report-customer-panel { padding: 2.4mm 2.8mm; }
  .report-eyebrow, .report-summary-panel span, .payment-meta-grid span, .pix-amount span { font-size: 4.8pt; }
  .report-customer-panel strong { margin-top: .7mm; font-size: 8.5pt; }
  .report-customer-panel > span:last-child { margin-top: .8mm; font-size: 5.8pt; line-height: 1.2; }
  .report-summary-panel > div > div { padding: 1.7mm 2mm; }
  .report-summary-panel strong { margin-top: .6mm; font-size: 7.2pt; }
  .report-summary-top { grid-template-columns: 1fr 1fr 1fr; }
  .report-summary-bottom { grid-template-columns: 1fr 1fr; }
  .report-summary-panel > div > div { text-align: center; }
  .report-summary-panel strong { text-align: center; }
  .report-summary-total strong { font-size: 10.5pt; }
  .report-v130 .report-section-title { margin-top: 2mm; padding: 1.1mm 2mm; border-radius: 1.4mm; font-size: 7.2pt; }
  .reading-grid-v130 { gap: 1.5mm; margin-top: 1.5mm; }
  .reading-box-v130 { min-height: 16.5mm; border-radius: 1.5mm; box-shadow: none; }
  .reading-box-v130 .reading-box-label { padding: 1mm; font-size: 5.6pt; }
  .reading-box-date { padding: 1.2mm 1mm 0; font-size: 5.4pt; }
  .reading-box-v130 .reading-box-value { padding: 1mm 1mm 1.5mm; font-size: 9.5pt; }
  .reading-box-v130 .reading-box-single { min-height: 11mm; padding-top: 2.5mm; }
  .invoice-statement { margin-top: 1.3mm; border-radius: 1.5mm; box-shadow: none; }
  .statement-header, .statement-row { grid-template-columns: minmax(0, 1fr) 31mm; gap: 2mm; }
  .statement-header { padding: 1mm 2mm; font-size: 5.2pt; }
  .statement-row { padding: 1mm 2mm; font-size: 6pt; line-height: 1.12; }
  .statement-group { padding-block: 1.1mm; font-size: 6.2pt; }
  .statement-subrow span { padding-left: 2mm; }
  .statement-total { padding-block: 1.7mm; font-size: 8pt; }
  .statement-total strong { font-size: 10pt; }
  .report-benefit-note { margin-top: 1mm !important; padding: 1.1mm 1.8mm !important; border-radius: 1.4mm; font-size: 5.2pt; line-height: 1.15; }
  .payment-area-v130 { grid-template-columns: minmax(0, 1fr) 42mm; gap: 2mm; margin-top: 1.3mm; }
  .payment-main-v130 { border-radius: 1.5mm; }
  .payment-meta-grid > div { padding: 1.3mm 1.6mm; }
  .payment-meta-grid strong { margin-top: .4mm; font-size: 6.5pt; }
  .payment-status-text { padding: 1mm 1.1mm; border-radius: 1.5mm; font-size: 6.2pt !important; }
  .consumption-history-v130 { padding: 1mm 1.2mm 1.1mm; }
  .history-title-row { margin-bottom: .6mm; }
  .history-title-row strong { font-size: 5.2pt; }
  .history-title-row span { font-size: 4.2pt; }
  .consumption-history-v130 .consumption-history-table table { border-radius: 1.2mm; font-size: 3.95pt; line-height: 1.03; table-layout: fixed; }
  .consumption-history-v130 .consumption-history-table th,
  .consumption-history-v130 .consumption-history-table td { width: 25%; padding: .3mm .7mm; text-align: center; }
  .consumption-history-v130 .consumption-history-table th { font-size: 5.2pt; }
  .history-empty { padding: 4mm; border-radius: 1.2mm; font-size: 5.4pt; }
  .pix-box-v130 { padding: 1.4mm 1.8mm; border-radius: 1.5mm; box-shadow: none; }
  .pix-box-v130 .pix-title { margin: -1.4mm -1.8mm 1.1mm; padding: 1mm; border-radius: 1.2mm 1.2mm 0 0; font-size: 5.5pt; }
  .pix-box-v130 #reportQr canvas, .pix-box-v130 #reportQr img { width: 28mm !important; height: 28mm !important; }
  .pix-box-v130 .pix-key { margin-top: .8mm; font-size: 4.8pt; }
  .pix-box-v130 .pix-key strong { font-size: 5.7pt; }
  .pix-amount { margin-top: 1mm; padding: 1mm; border-radius: 1.3mm; }
  .pix-amount strong { margin-top: .4mm; font-size: 9pt; }
  .pix-box-v130 .muted { font-size: 4.5pt !important; }
  .report-v130 .report-observations { margin-top: 1.4mm; border-radius: 1.4mm; }
  .report-v130 .report-observations-title { padding: .8mm 1.5mm; font-size: 5pt; }
  .report-v130 .report-observations p { padding: 1mm 1.7mm; font-size: 5.2pt; line-height: 1.18; }
  .report-v130 .report-footer { margin-top: 1.2mm; font-size: 5.2pt; }
}

/* Neutraliza as regras responsivas de tela durante a impressão A4. */
@media print {
  .report-v130 .report-header { grid-template-columns: 42mm 1fr 38mm !important; }
  .report-v130 .report-private { display: block !important; }
  .report-primary-card { grid-template-columns: .92fr 1.65fr !important; }
  .report-customer-panel { border-right: 1px solid #d5e1d8 !important; border-bottom: 0 !important; }
  .reading-grid-v130 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .payment-area-v130 { grid-template-columns: minmax(0, 1fr) 42mm !important; }
  .pix-box-v130 { order: initial !important; }
}

/* v1.3.0 - consentimento WhatsApp alinhado ao formulário */
.whatsapp-consent-field { align-self: stretch; }
.whatsapp-consent-card { display: grid; grid-template-columns: 22px minmax(0,1fr); align-items: start; gap: .75rem; width: 100%; padding: .9rem 1rem; border: 1px solid #cbdacf; border-radius: 13px; background: linear-gradient(145deg,#f3f9f3,#fff); cursor: pointer; }
.whatsapp-consent-card input { width: 18px; height: 18px; margin: .12rem 0 0; accent-color: var(--green-700); }
.whatsapp-consent-card span { display: grid; gap: .25rem; min-width: 0; }
.whatsapp-consent-card strong { color: var(--green-950); font-size: .92rem; line-height: 1.25; }
.whatsapp-consent-card small { color: var(--muted); font-size: .78rem; line-height: 1.4; }
@media (max-width: 560px) { .whatsapp-consent-card { padding: .8rem; } }

/* Ajuste final do histórico do demonstrativo */
.consumption-history-v130 .consumption-history-table thead th { font-size: 9.4px; font-weight: 900; text-align: center !important; }
.consumption-history-v130 .consumption-history-table tbody td { font-size: 6.8px; text-align: center !important; }
.consumption-history-v130 .consumption-history-table tbody td strong { font-size: inherit; }


/* v1.3.0 homologação R3 - espaçamentos e seção Ajuda */
#dashboardStats { margin-top: 1rem; }
.dashboard-grid { margin-top: 1rem; }
.help-intro-card { margin-bottom: 1rem; }
.help-intro-card p { margin: .35rem 0 0; color: var(--muted); line-height: 1.55; }
.help-accordion { display: grid; gap: .85rem; }
.help-topic { border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.help-topic summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.15rem; cursor: pointer; list-style: none; }
.help-topic summary::-webkit-details-marker { display: none; }
.help-topic summary span:first-child { display: grid; gap: .2rem; }
.help-topic summary strong { color: var(--green-950); font-size: 1rem; }
.help-topic summary small { color: var(--muted); font-size: .78rem; }
.help-chevron { color: var(--green-700); font-size: 1.25rem; transition: transform .2s ease; }
.help-topic[open] .help-chevron { transform: rotate(180deg); }
.help-topic-body { padding: 0 1.15rem 1.15rem; border-top: 1px solid var(--border); }
.help-topic-body > p { margin: 1rem 0; color: #42554a; line-height: 1.6; }
.help-example { display: grid; gap: .35rem; padding: .9rem 1rem; border-radius: 12px; background: #f1f8f1; color: #31463a; }
.help-example strong { color: var(--green-900); }
.help-links { display: flex; flex-wrap: wrap; gap: .6rem 1rem; margin-top: .9rem; }
.help-links a { color: var(--blue); font-weight: 750; text-decoration: none; }
.help-links a:hover { text-decoration: underline; }

.report-summary-top > div:first-child strong { font-size: 17px; }

@media print {
  body.print-results { margin: 0 !important; padding: 0 !important; }
  body.print-results .formal-strategic-document { width: 100%; margin: 0; padding: 0; }
  body.print-results .formal-report-sheet {
    display: flex !important;
    flex-direction: column;
    width: 190mm;
    min-height: 277mm;
    margin: 0 auto;
    padding: 6mm;
    box-sizing: border-box;
    overflow: visible;
  }
  body.print-results .formal-report-footer { margin-top: auto; }
  .report-summary-top > div:first-child strong { font-size: 8.4pt; }
  .consumption-history-v130 .consumption-history-table table { font-size: 4.5pt; line-height: 1.06; }
  .consumption-history-v130 .consumption-history-table th,
  .consumption-history-v130 .consumption-history-table td { padding: .34mm .7mm; }
  .report-v130 .report-observations-title { font-size: 5.5pt; }
  .report-v130 .report-observations p { font-size: 5.9pt; line-height: 1.22; }
  .report-v130 .report-footer { font-size: 5.8pt; }
}


/* v1.3.0 homologacao R4 - demonstrativo responsivo, A4 e Pix */
#reportReference { font-size: 19px; font-weight: 950; letter-spacing: .01em; }
.consumption-history-v130 .consumption-history-table { width: 100%; overflow: visible; }
.consumption-history-v130 .consumption-history-table table { width: 100%; min-width: 0; table-layout: fixed; }
.consumption-history-v130 .consumption-history-table col.history-col-month { width: 24%; }
.consumption-history-v130 .consumption-history-table col.history-col-consumption { width: 22%; }
.consumption-history-v130 .consumption-history-table col.history-col-average { width: 36%; }
.consumption-history-v130 .consumption-history-table col.history-col-days { width: 18%; }
.consumption-history-v130 .consumption-history-table thead th {
  padding: 4px 3px;
  font-size: 10.5px;
  line-height: 1.08;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center !important;
}
.consumption-history-v130 .consumption-history-table tbody td {
  padding: 3px 3px;
  font-size: 10px;
  line-height: 1.08;
  text-align: center !important;
}
@media (max-width: 560px) {
  .consumption-history-v130 { padding-inline: 8px; }
  .consumption-history-v130 .consumption-history-table { overflow: visible; }
  .consumption-history-v130 .consumption-history-table table { min-width: 0; }
  .consumption-history-v130 .consumption-history-table thead th { font-size: 9.5px; padding: 4px 2px; }
  .consumption-history-v130 .consumption-history-table tbody td { font-size: 9px; padding: 3px 2px; }
}
@media print {
  #reportReference { font-size: 9.4pt !important; font-weight: 950 !important; }
  .report-summary-top { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .report-summary-top .report-summary-total { grid-column: auto !important; border-top: 0 !important; }
  .payment-meta-grid { grid-template-columns: .8fr 1.25fr 1fr !important; }
  .payment-meta-grid > div { border-top: 0 !important; border-left: 1px solid #dce7df !important; }
  .payment-meta-grid > div:first-child { border-left: 0 !important; }
  .consumption-history-v130 .consumption-history-table table { min-width: 0 !important; table-layout: fixed !important; }
  .consumption-history-v130 .consumption-history-table thead th { font-size: 5.7pt !important; padding: .38mm .55mm !important; }
  .consumption-history-v130 .consumption-history-table tbody td { font-size: 5.1pt !important; padding: .34mm .55mm !important; line-height: 1.04 !important; }
}


/* v1.3.0 homologação R5 - unidades e ajuda admin */
#unitTable .unit-consolidation-table { min-width: 1240px; table-layout: fixed; }
#unitTable .unit-consolidation-table th:nth-child(1) { width: 17%; }
#unitTable .unit-consolidation-table th:nth-child(2) { width: 17%; }
#unitTable .unit-consolidation-table th:nth-child(3),
#unitTable .unit-consolidation-table th:nth-child(4),
#unitTable .unit-consolidation-table th:nth-child(5),
#unitTable .unit-consolidation-table th:nth-child(6),
#unitTable .unit-consolidation-table th:nth-child(7),
#unitTable .unit-consolidation-table th:nth-child(8) { width: 8%; }
#unitTable .unit-consolidation-table th:nth-child(9) { width: 8%; }
#unitTable .unit-consolidation-table th:nth-child(10) { width: 17%; }
#unitTable .unit-consolidation-table td { overflow-wrap: anywhere; }
#unitTable .unit-consolidation-table td:last-child { padding-left: .6rem; padding-right: .7rem; }
#unitTable .table-actions { justify-content: flex-start; align-items: flex-start; }
#unitTable .table-actions .btn { flex: 1 1 142px; min-width: 0; white-space: nowrap; }
#unitTable .table-title { display:block; }
#unitTable .table-sub { line-height: 1.45; }

@media (max-width: 1440px) {
  #unitTable .unit-consolidation-table { min-width: 1160px; }
  #unitTable .unit-consolidation-table th,
  #unitTable .unit-consolidation-table td { padding-left: .65rem; padding-right: .65rem; }
  #unitTable .table-actions .btn { flex-basis: 132px; }
}

@media (max-width: 760px) {
  #unitTable .unit-consolidation-table { min-width: 1120px; }
  #unitTable .table-actions .btn { flex: 1 1 130px; }
}

/* v1.3.4 — conciliação CEMIG, GD e importação da geradora */
.reconciliation-row td {
  background: #f7faf7;
  color: var(--green-950);
  font-weight: 750;
}
.reconciliation-row td:nth-child(3),
.reconciliation-row td:nth-child(4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.distribution-pdf-import {
  padding: 1rem;
  border: 1px dashed #b9d2bf;
  border-radius: 14px;
  background: #f8fcf8;
}
.report-internal-technical {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto 1rem;
  padding: .9rem 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f2f8f3;
}
.report-internal-technical > div {
  display: grid;
  gap: .2rem;
}
.report-internal-technical span,
.report-internal-technical small {
  color: var(--muted);
}
.report-internal-technical strong {
  color: var(--green-950);
}
.report-internal-technical small {
  grid-column: 1 / -1;
  line-height: 1.45;
}
@media (max-width: 680px) {
  .report-internal-technical { grid-template-columns: 1fr; }
}


/* v1.3.11 r3 - filtro de período do dashboard do consumidor */
.consumer-dashboard-period {
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.consumer-dashboard-period label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .03em;
}
.consumer-dashboard-period .input {
  min-width: 210px;
}
@media (max-width: 760px) {
  .consumer-dashboard-period { width: 100%; min-width: 0; }
  .consumer-dashboard-period .input { width: 100%; min-width: 0; }
}

/* v1.4.0 — Fechamento Mensal incremental */
.monthly-closing-selector { margin-bottom: 1.25rem; }
.closing-selector-action { justify-content: flex-end; }
.monthly-closing-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: .25rem 0 1rem;
}
.monthly-closing-heading h3 { margin: .15rem 0; color: var(--green-950); font-size: 1.45rem; }
.monthly-closing-heading p { margin: 0; }
#monthlyClosingStats { margin-inline: 0; }
.monthly-closing-distribution-card,
.monthly-closing-import-card,
.monthly-closing-units-card { margin-top: 1rem; }
.monthly-closing-dropzone {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem;
  border: 1px dashed #a9cab0;
  border-radius: 15px;
  background: linear-gradient(135deg, #f7fcf7, #eef8ef);
}
.monthly-closing-dropzone input { width: min(330px, 100%); }
.monthly-closing-dropzone strong,
.monthly-closing-dropzone span { display: block; }
.monthly-closing-dropzone span { margin-top: .25rem; color: var(--muted); font-size: .82rem; }
.monthly-closing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.monthly-closing-footer p { margin: .2rem 0 0; }
.closing-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.closing-distribution-detail { margin-top: .65rem; color: var(--muted); }
.closing-state-awaiting { background: var(--warning-soft); color: var(--warning); }
.closing-state-generated { background: var(--green-100); color: var(--green-900); }
.closing-state-existing { background: var(--blue-soft); color: var(--blue); }
.closing-state-skipped { background: #f1f3f2; color: #58645d; }
.closing-state-divergent { background: var(--danger-soft); color: var(--danger); }
.closing-import-warning { color: var(--danger); font-weight: 700; }
#monthlyClosingImportPreview table,
#monthlyClosingUnitTable table { min-width: 980px; }
#monthlyClosingUnitTable .table-actions { justify-content: flex-start; }

@media (max-width: 760px) {
  .monthly-closing-heading,
  .monthly-closing-footer,
  .monthly-closing-dropzone { flex-direction: column; align-items: stretch; }
  .monthly-closing-heading .button-row,
  .monthly-closing-footer .btn { width: 100%; }
  .monthly-closing-dropzone input { width: 100%; }
}
