:root {
  font-family: Inter, Avenir, "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: #11333d;
  background: #f3f7f7;
  line-height: 1.5;
  font-synthesis: none;
  --ink: #0a3440;
  --muted: #657b82;
  --line: #dce8e9;
  --teal: #07847f;
  --cyan: #16a9a4;
  --navy: #063c4b;
  --paper: #fff;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: #f3f7f7; }
button, input { font: inherit; }
a { color: inherit; }

.site-header {
  position: relative;
  z-index: 10;
  height: 76px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid rgba(16,69,80,.1);
  backdrop-filter: blur(16px);
}
.header-inner {
  max-width: 1220px;
  height: 100%;
  margin: 0 auto;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-navigation { height: 100%; display: flex; align-items: center; justify-content: center; gap: 3px; }
.portal-navigation a { position: relative; padding: 9px 10px; color: #527078; border-radius: 8px; text-decoration: none; font-size: .77rem; font-weight: 720; transition: .16s ease; }
.portal-navigation a:hover { color: #087d7b; background: #edf8f7; }
.portal-navigation a.active { color: #087d7b; background: #e8f6f4; }
.portal-navigation a.active::after { position: absolute; right: 10px; bottom: -19px; left: 10px; height: 2px; content: ""; background: #12a39d; border-radius: 2px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { display: block; width: 176px; height: auto; }
.portal-label, .secure-label {
  color: #527078;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.secure-label { display: flex; align-items: center; gap: 9px; color: rgba(255,255,255,.8); }
.secure-label > span { width: 8px; height: 8px; border-radius: 50%; background: #55d9b8; box-shadow: 0 0 0 5px rgba(85,217,184,.13); }
.site-main { max-width: 1220px; margin: 0 auto; padding: 48px 26px 70px; }
.eyebrow { color: var(--teal); font-size: .7rem; font-weight: 800; letter-spacing: .17em; margin: 0 0 9px; }
.eyebrow.light { color: #65e0cc; }
.muted { color: var(--muted); }

/* Login */
.login-page {
  color: #fff;
  background:
    radial-gradient(circle at 10% 5%, rgba(22,169,164,.25), transparent 30%),
    radial-gradient(circle at 88% 90%, rgba(24,141,154,.18), transparent 28%),
    linear-gradient(135deg, #052f3d 0%, #063c4b 55%, #064654 100%);
  overflow-x: hidden;
}
.login-page .site-header { background: transparent; border-color: rgba(255,255,255,.1); backdrop-filter: none; }
.login-page .brand img { filter: brightness(0) invert(1); }
.login-page .site-main { max-width: 1220px; padding-top: 58px; }
.login-layout { min-height: calc(100vh - 204px); display: grid; grid-template-columns: minmax(0,1.1fr) minmax(390px,.72fr); gap: clamp(54px,8vw,120px); align-items: center; }
.login-intro { position: relative; align-self: stretch; display: flex; flex-direction: column; justify-content: center; isolation: isolate; }
.login-intro h1 { max-width: 690px; margin: 0; color: #fff; font-size: clamp(3rem,5.4vw,5.25rem); font-weight: 680; letter-spacing: -.055em; line-height: .99; }
.login-intro h1 em { color: #55d9cf; font-style: normal; }
.intro-copy { max-width: 560px; margin: 28px 0 35px; color: rgba(232,249,249,.72); font-size: clamp(1rem,1.5vw,1.18rem); line-height: 1.7; }
.feature-row { display: flex; gap: 42px; flex-wrap: wrap; }
.feature-row > div { display: flex; align-items: center; gap: 13px; }
.feature-icon { width: 40px; height: 40px; border: 1px solid rgba(93,222,207,.35); border-radius: 50%; display: grid; place-items: center; color: #73ded1; font-size: .68rem; font-weight: 800; }
.feature-row p { display: grid; margin: 0; }
.feature-row strong { font-size: .89rem; }
.feature-row small { color: rgba(221,242,243,.55); font-size: .77rem; }
.water-rings { position: absolute; z-index: -1; width: 540px; height: 540px; left: -220px; bottom: -280px; opacity: .26; }
.water-rings i { position: absolute; inset: 0; border: 1px solid #53c9c2; border-radius: 50%; }
.water-rings i:nth-child(2) { inset: 68px; }
.water-rings i:nth-child(3) { inset: 136px; }

.login-card {
  width: 100%;
  max-width: 470px;
  justify-self: end;
  color: var(--ink);
  background: rgba(255,255,255,.985);
  padding: clamp(32px,4vw,50px);
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 24px;
  box-shadow: 0 32px 90px rgba(0,21,27,.35), 0 4px 18px rgba(0,0,0,.08);
}
.card-mark { float: right; width: 50px; height: 54px; display: grid; place-items: center; margin-top: -7px; background: #ecf8f7; border-radius: 14px; }
.card-mark img { height: 42px; }
.login-card h2 { margin: 0 0 8px; font-size: clamp(2rem,3vw,2.55rem); letter-spacing: -.04em; line-height: 1.1; }
.login-card > .muted { margin: 0 0 31px; }
.login-card form label { display: block; margin: 18px 0 8px; color: #294c55; font-size: .82rem; font-weight: 720; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 15px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: #789096; stroke-width: 1.6; pointer-events: none; }
.input-wrap input { width: 100%; height: 52px; padding: 0 15px 0 46px; color: #123a43; background: #f8fbfb; border: 1px solid #cfdddf; border-radius: 10px; outline: none; transition: .18s ease; }
.input-wrap input::placeholder { color: #9aabad; }
.input-wrap input:hover { border-color: #abc5c8; }
.input-wrap input:focus { background: #fff; border-color: #159b98; box-shadow: 0 0 0 4px rgba(21,155,152,.11); }
.login-card button[type="submit"] { width: 100%; min-height: 53px; margin-top: 25px; padding: 0 17px 0 22px; display: flex; align-items: center; justify-content: space-between; color: #fff; background: linear-gradient(110deg,#07837f,#08758b); border: 0; border-radius: 10px; font-weight: 760; cursor: pointer; box-shadow: 0 10px 26px rgba(5,118,126,.23); transition: transform .18s, box-shadow .18s; }
.login-card button[type="submit"]:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(5,118,126,.3); }
.login-card button[type="submit"]:disabled { opacity: .7; cursor: wait; transform: none; }
.login-card button b { font-size: 1.35rem; font-weight: 400; }
.error { padding: 10px 12px; margin: 14px 0 -7px; color: #9a2929; background: #fff0f0; border: 1px solid #f0caca; border-radius: 8px; font-size: .84rem; }
.support-note { margin: 28px 0 0; padding-top: 22px; border-top: 1px solid #e2ebec; color: #789096; text-align: center; font-size: .79rem; }
.support-note a { color: #087f82; font-weight: 720; text-decoration: none; }

/* Dashboard */
.dashboard-page { background: #f3f7f7; }
.header-nav { display: flex; align-items: center; gap: 15px; }
.user-chip { display: flex; align-items: center; gap: 9px; color: #355860; font-size: .82rem; font-weight: 650; }
.user-chip i { width: 34px; height: 34px; display: grid; place-items: center; color: #087a79; background: #e4f4f2; border-radius: 50%; font-style: normal; font-weight: 800; }
.logout-button { padding: 8px 13px; color: #557079; background: transparent; border: 1px solid #ceddde; border-radius: 8px; cursor: pointer; font-size: .78rem; font-weight: 700; }
.logout-button:hover { color: #0b696c; border-color: #8fb9b9; background: #f3fbfa; }
.nav-link { padding: 8px 10px; color: #376169; border-radius: 7px; text-decoration: none; font-size: .8rem; font-weight: 750; }
.nav-link:hover { color: #087d7b; background: #edf8f7; }
.nav-link.active { color: #087d7b; background: #e8f6f4; }
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 10px 0 34px; }
.dashboard-heading h1 { margin: 0 0 8px; color: var(--ink); font-size: clamp(2rem,4vw,3.1rem); font-weight: 700; letter-spacing: -.045em; line-height: 1.05; }
.dashboard-heading .muted { margin: 0; }
.status-pill { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 9px 13px; color: #287064; background: #e5f5ef; border: 1px solid #c7e8dc; border-radius: 99px; font-size: .76rem; font-weight: 750; }
.status-pill i, .badge i { width: 7px; height: 7px; background: #26a67d; border-radius: 50%; box-shadow: 0 0 0 4px rgba(38,166,125,.12); }
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 17px; margin: 0 0 24px; }
.stats article { min-width: 0; display: flex; align-items: center; gap: 17px; padding: 23px; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 25px rgba(23,67,75,.035); }
.stats article > div { min-width: 0; display: grid; }
.stats strong { color: #103b45; font-size: 2rem; letter-spacing: -.045em; line-height: 1.05; }
.stats article div span { overflow: hidden; color: #71878c; font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.stat-symbol { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; color: #087c7d; background: #e6f5f3; border-radius: 12px; font-size: .74rem; font-weight: 850; }
.stat-symbol.devices { color: #316b9c; background: #eaf2f9; }
.stat-symbol.meters { color: #7760a8; background: #f0edf7; }
.stat-symbol.telegrams { color: #9a7130; background: #f8f1e4; }
.consumption-panel { min-height: 260px; margin: 17px 0 24px; padding: 28px 30px 24px; display: grid; grid-template-columns: 245px 1fr; gap: 38px; color: #fff; background: linear-gradient(125deg,#073f4c,#075766); border-radius: 16px; box-shadow: 0 15px 35px rgba(6,59,72,.16); }
.consumption-copy { align-self: center; }
.consumption-copy .eyebrow { color: #66d9cc; }
.consumption-copy > div { display: flex; align-items: baseline; gap: 8px; }
.consumption-copy strong { font-size: 3.35rem; letter-spacing: -.06em; line-height: 1; }
.consumption-copy span { color: #75dcd1; font-size: 1.2rem; font-weight: 700; }
.consumption-copy > p:last-child { max-width: 210px; color: rgba(228,248,248,.65); font-size: .78rem; }
.chart { height: 195px; display: flex; align-items: end; gap: clamp(5px,1vw,13px); padding-top: 30px; border-bottom: 1px solid rgba(255,255,255,.18); }
.chart-column { position: relative; height: 100%; flex: 1; display: flex; align-items: end; justify-content: center; }
.chart-column i { width: 100%; max-width: 25px; min-height: 6px; background: linear-gradient(#55d7c9,#15949b); border-radius: 5px 5px 1px 1px; transition: .2s; }
.chart-column:hover i { filter: brightness(1.17); }
.chart-column small { position: absolute; bottom: -22px; color: rgba(226,247,247,.52); font-size: .56rem; }
.chart-value { position: absolute; bottom: calc(var(--bar-height, 0%) + 4px); display: none; color: #fff; font-size: .6rem; }
.panel { margin: 17px 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 28px rgba(23,67,75,.035); }
.panel-heading { min-height: 86px; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e5eeee; }
.panel-heading .eyebrow { margin-bottom: 3px; font-size: .61rem; }
.panel-heading h2 { margin: 0; color: #123a44; font-size: 1.35rem; letter-spacing: -.025em; }
.panel-heading > span { padding: 6px 10px; color: #698086; background: #f4f8f8; border-radius: 7px; font-size: .72rem; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 12px 24px; color: #7b9095; background: #fafcfc; border-bottom: 1px solid #e7eeee; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
td { padding: 15px 24px; color: #49656c; border-bottom: 1px solid #edf2f2; font-size: .83rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:not(.empty-row):hover { background: #fbfdfd; }
td strong { display: block; color: #183f48; font-size: .86rem; }
td small { display: block; max-width: 240px; overflow: hidden; margin-top: 2px; color: #8ca0a4; text-overflow: ellipsis; }
code { padding: 4px 7px; color: #28616b; background: #eef5f5; border-radius: 5px; font-family: "SFMono-Regular",Consolas,monospace; font-size: .74rem; }
.badge { width: fit-content; display: flex; align-items: center; gap: 7px; padding: 5px 9px; color: #257260; background: #e5f5ef; border-radius: 99px; font-size: .67rem; font-weight: 800; text-transform: uppercase; }
.badge.blocked,.badge.revoked { color: #a04444; background: #fbeaea; }
.badge.blocked i,.badge.revoked i { background: #c45858; box-shadow: none; }
.badge.pending { color: #936e2b; background: #fbf2df; }
.badge.pending i { background: #c7973f; box-shadow: none; }
.processing-state { padding: 4px 8px; color: #526f76; background: #edf3f3; border-radius: 6px; font-size: .68rem; font-weight: 750; }
.empty-row td { height: 165px; text-align: center; }
.empty-row td > span { width: 42px; height: 42px; margin: 0 auto 9px; display: grid; place-items: center; color: #57a7a4; background: #eaf7f5; border-radius: 50%; font-size: 1.6rem; }
.empty-row td strong { font-size: .9rem; }
.empty-row td small { max-width: none; margin-top: 4px; }

/* Administration */
.admin-heading { align-items: center; }
.primary-action,.secondary-action { padding: 11px 16px; color: #fff; background: linear-gradient(110deg,#07837f,#08758b); border: 0; border-radius: 9px; box-shadow: 0 8px 20px rgba(5,118,126,.18); cursor: pointer; font-size: .82rem; font-weight: 760; }
.secondary-action { color: #087976; background: #e8f6f4; box-shadow: none; }
.primary-action.full { width: 100%; margin-top: 14px; }
.actions-cell { min-width: 250px; text-align: right; white-space: nowrap; }
.table-action { padding: 6px 8px; color: #28666d; background: transparent; border: 0; border-radius: 6px; cursor: pointer; font-size: .72rem; font-weight: 720; }
.table-action:hover { background: #edf7f6; }
.table-action.danger { color: #a64848; }
.table-action.danger:hover { background: #fff0f0; }
.role-pill { padding: 5px 8px; color: #526e75; background: #eef4f4; border-radius: 6px; font-size: .68rem; font-weight: 750; }
.impersonation-bar { margin: -10px 0 27px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 15px; color: #704f12; background: #fff5d9; border: 1px solid #ecd99b; border-radius: 10px; font-size: .82rem; }
.impersonation-bar button { padding: 6px 10px; color: #704f12; background: #fff; border: 1px solid #dec77d; border-radius: 6px; cursor: pointer; font-size: .73rem; font-weight: 750; }
.admin-dialog { width: min(620px,calc(100vw - 28px)); padding: 0; color: var(--ink); background: #fff; border: 0; border-radius: 18px; box-shadow: 0 30px 100px rgba(3,35,42,.35); }
.admin-dialog::backdrop { background: rgba(4,38,47,.62); backdrop-filter: blur(3px); }
.admin-dialog form { padding: 30px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 24px; }
.dialog-heading h2 { margin: 0; font-size: 1.65rem; letter-spacing: -.035em; }
.dialog-close { width: 34px; height: 34px; color: #6c8287; background: #f0f5f5; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.4rem; line-height: 1; }
.admin-dialog label { display: grid; gap: 7px; margin: 14px 0; color: #31545c; font-size: .78rem; font-weight: 720; }
.admin-dialog input:not([type="checkbox"]),.admin-dialog select { width: 100%; height: 46px; padding: 0 12px; color: #173e47; background: #f8fbfb; border: 1px solid #cfdddf; border-radius: 8px; outline: none; }
.admin-dialog input:focus,.admin-dialog select:focus { border-color: #159b98; box-shadow: 0 0 0 3px rgba(21,155,152,.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.check-label { display: flex !important; align-items: center; grid-template-columns: auto 1fr; gap: 9px !important; }
.check-label input { width: 17px; height: 17px; accent-color: #07847f; }
.debug-check { margin: 20px 0 !important; padding: 14px; background: #edf8f7; border-radius: 9px; }
.dialog-note { color: #71878c; font-size: .76rem; line-height: 1.55; }
.form-error { padding: 9px 11px; color: #9a2929; background: #fff0f0; border-radius: 7px; font-size: .79rem; }
.pairing-result { margin: 18px 0; padding: 17px; display: grid; text-align: center; color: #22545d; background: #e8f7f5; border: 1px dashed #73bdb7; border-radius: 10px; }
.pairing-result small,.pairing-result span { color: #668187; }
.pairing-result strong { color: #087c7d; font-size: 2.1rem; letter-spacing: .14em; }

/* Customer infrastructure */
.pairing-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 20px 24px 24px; }
.pairing-card { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 18px; padding: 18px; background: linear-gradient(125deg,#f0faf8,#f8fcfc); border: 1px solid #cfe8e4; border-radius: 12px; }
.pairing-card > div:first-child { min-width: 0; display: grid; }
.pairing-card span { overflow: hidden; color: #72888d; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.pairing-card strong { color: #087c7d; font-family: "SFMono-Regular",Consolas,monospace; font-size: 1.42rem; letter-spacing: .1em; }
.pairing-time { min-width: 82px; display: grid; text-align: right; }
.pairing-time small { color: #829397; font-size: .65rem; }
.pairing-time b { color: #173f48; font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.pairing-card.expired { opacity: .55; }
.empty-card { grid-column: 1/-1; min-height: 110px; display: grid; place-content: center; gap: 4px; color: #819499; text-align: center; }
.empty-card strong { color: #34575f; }
.meter-chip { display: inline-block; margin: 2px; padding: 4px 7px; color: #316b75; background: #edf6f6; border-radius: 6px; font-size: .69rem; }
.assignment-chip { display: inline-flex; align-items: center; gap: 5px; margin: 2px; padding: 4px 5px 4px 8px; color: #286b65; background: #e7f5f1; border-radius: 99px; font-size: .7rem; font-weight: 700; }
.assignment-chip button { width: 19px; height: 19px; padding: 0; color: #55827d; background: rgba(255,255,255,.7); border: 0; border-radius: 50%; cursor: pointer; line-height: 1; }
.report-hero { margin: 0 0 24px; padding: 27px 30px; display: flex; align-items: end; justify-content: space-between; color: #fff; background: linear-gradient(120deg,#064451,#087377); border-radius: 15px; box-shadow: 0 14px 32px rgba(6,59,72,.14); }
.report-hero div { display: grid; }
.report-hero span,.report-hero p { margin: 0; color: rgba(230,250,248,.68); font-size: .77rem; }
.report-hero strong { font-size: 2.55rem; letter-spacing: -.045em; }
.report-hero strong small { color: #6fddd0; font-size: 1rem; }

@media (max-width: 900px) {
  .site-header { height: auto; }
  .header-inner { min-height: 76px; flex-wrap: wrap; gap: 4px 14px; padding-top: 10px; padding-bottom: 10px; }
  .portal-navigation { order: 3; width: 100%; height: auto; justify-content: flex-start; overflow-x: auto; }
  .portal-navigation a.active::after { display: none; }
  .login-layout { grid-template-columns: 1fr; gap: 40px; padding-bottom: 30px; }
  .login-intro { padding-top: 20px; }
  .login-card { justify-self: start; max-width: 560px; }
  .water-rings { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .consumption-panel { grid-template-columns: 1fr; gap: 8px; }
  .consumption-copy { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
  .consumption-copy > p:last-child { display: none; }
  .pairing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-header { height: 66px; }
  .dashboard-page .site-header { height: auto; }
  .header-inner { padding: 0 17px; }
  .brand img { width: 150px; }
  .portal-label, .secure-label { font-size: .62rem; }
  .site-main { padding: 31px 16px 50px; }
  .login-page .site-main { padding-top: 36px; }
  .login-intro h1 { font-size: 2.75rem; }
  .intro-copy { margin: 21px 0 27px; }
  .feature-row { display: none; }
  .login-card { padding: 29px 23px; border-radius: 18px; }
  .card-mark { display: none; }
  .header-nav .user-chip { display: none; }
  .header-nav { gap: 5px; }
  .header-nav .admin-link { display: none; }
  .portal-navigation { padding-bottom: 2px; }
  .portal-navigation a { flex: 0 0 auto; padding: 7px 9px; font-size: .72rem; }
  .nav-link { display: block; padding: 7px; }
  .dashboard-heading { align-items: start; flex-direction: column; margin-top: 0; }
  .status-pill { order: -1; }
  .stats { gap: 10px; }
  .stats article { gap: 10px; padding: 16px 13px; }
  .stat-symbol { width: 36px; height: 36px; border-radius: 9px; }
  .stats strong { font-size: 1.55rem; }
  .consumption-panel { min-height: 250px; padding: 22px 16px; }
  .consumption-copy strong { font-size: 2.5rem; }
  .chart { height: 145px; gap: 4px; }
  .chart-column small { font-size: .47rem; transform: rotate(-45deg); transform-origin: center; bottom: -27px; }
  .panel-heading { padding: 17px; }
  th, td { padding-left: 17px; padding-right: 17px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .admin-dialog form { padding: 22px; }
  .actions-cell { min-width: 220px; }
  .pairing-grid { padding: 15px; }
  .pairing-card { grid-template-columns: 1fr auto; gap: 10px; }
  .pairing-card > button { grid-column: 1/-1; justify-self: end; }
  .report-hero { align-items: start; flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
