/* EnergyCostHub — main stylesheet */
:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-light: #ccfbf1;
  --accent: #f59e0b;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --danger: #b91c1c;
  --success: #15803d;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 24px rgba(15, 23, 42, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.65; color: var(--text); background: var(--bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); letter-spacing: -.01em; }
h3, .h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; margin-left: auto; margin-right: auto; }
.narrow-hero { max-width: 860px; }
.center { text-align: center; }
.small { font-size: .875rem; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.logo strong { color: var(--brand); }
.site-nav { display: flex; align-items: center; gap: 4px; }
.nav-link { display: block; padding: 10px 14px; color: var(--ink); text-decoration: none; font-weight: 500; border-radius: 8px; }
.nav-link:hover { background: var(--bg-soft); color: var(--brand); }
.nav-dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; min-width: 290px; }
.dropdown-menu a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .95rem; }
.dropdown-menu a:hover { background: var(--brand-light); color: var(--brand-dark); }
.nav-dropdown:hover .dropdown-menu, .nav-dropdown:focus-within .dropdown-menu { display: block; }
.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ink); margin: 5px 0; }

/* Buttons */
.btn { display: inline-block; background: var(--brand); color: #fff; padding: 12px 22px; border-radius: 10px; font-weight: 600; text-decoration: none; border: 2px solid var(--brand); cursor: pointer; font-size: 1rem; font-family: inherit; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-light); color: var(--brand-dark); }
.btn-small { padding: 8px 14px; font-size: .9rem; }
.btn-block { display: block; width: 100%; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }

/* Hero */
.hero { background: linear-gradient(135deg, #ecfeff 0%, #f0fdf4 60%, #fefce8 100%); padding: 56px 0; border-bottom: 1px solid var(--line); }
.hero-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--brand); }
.lead { font-size: 1.15rem; color: var(--text); max-width: 760px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-card { background: #fff; padding: 26px; border-radius: 16px; box-shadow: var(--shadow); }
.hero-card h2 { font-size: 1.2rem; }
.hero-card select { margin-bottom: 12px; }
.hero-stat { margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
.hero-stat strong { color: var(--brand); font-size: 1.2rem; }
.page-hero { background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: 28px 0 32px; margin-bottom: 32px; }
.meta-line { font-size: .9rem; color: var(--muted); margin: 0; }

/* Breadcrumbs */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 14px; font-size: .875rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; }
.breadcrumbs a { color: var(--muted); }

/* Sections and grids */
.section { margin: 48px 0; }
.section-title { margin-bottom: 8px; }
.section-sub { color: var(--muted); margin-bottom: 24px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tool-card { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tool-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); color: var(--text); }
.tool-card h2, .tool-card h3 { color: var(--ink); margin: 8px 0 6px; font-size: 1.08rem; }
.tool-card p { margin: 0; font-size: .93rem; color: var(--muted); }
.tool-icon { font-size: 1.7rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.card-img img { aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin: 8px 0; }
.card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body h3 a:hover { color: var(--brand); }
.card-body p { font-size: .95rem; flex: 1; }
.card-meta { font-size: .82rem; color: var(--muted); }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); text-decoration: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .9rem; text-decoration: none; color: var(--text); }
.chip.active, .chip:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Content layout */
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; margin: 40px 0; align-items: start; }
.sidebar { display: grid; gap: 20px; }
.side-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: #fff; }
.side-card h2 { font-size: 1.1rem; }
.side-card.accent { background: var(--brand-light); border-color: #99f6e4; }
.side-card.sticky { position: sticky; top: 84px; }
.side-list { list-style: none; padding: 0; margin: 0; }
.side-list li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.side-list li:last-child { border-bottom: 0; }
.side-list a { text-decoration: none; }
.rank-list { margin: 0; padding-left: 22px; }
.rank-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.rank-list li span { float: right; font-weight: 600; color: var(--ink); }

/* Prose */
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .4em; }
.prose blockquote { margin: 1.5em 0; padding: 12px 20px; border-left: 4px solid var(--brand); background: var(--bg-soft); }
.prose img { border-radius: var(--radius); margin: 1.5em 0; }
.prose figure { margin: 0 0 1.5em; }
.formula { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px; padding: 14px 18px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95rem; color: var(--ink); }
.toc { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 22px; margin-bottom: 1.5em; }
.toc ol { margin: 8px 0 0; }
.author-box { margin-top: 2.5em; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }
.author-box p { margin: 6px 0 0; font-size: .95rem; }
.disclaimer-note { font-size: .875rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; margin-top: 2em; }
.state-notes { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 1.5em; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--bg-soft); color: var(--ink); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
.sortable th[data-sort] { cursor: pointer; user-select: none; }
.sortable th[data-sort]::after { content: " ↕"; color: var(--muted); font-size: .8em; }
.sortable th[aria-sort="ascending"]::after { content: " ↑"; color: var(--brand); }
.sortable th[aria-sort="descending"]::after { content: " ↓"; color: var(--brand); }
td.up { color: var(--danger); }
td.down { color: var(--success); }
.table-tools { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.table-tools input { max-width: 320px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: #fff; }
.stat-value { display: block; font-size: 1.7rem; font-weight: 700; color: var(--brand); line-height: 1.2; }
.stat-value small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stat-label { font-size: .88rem; color: var(--muted); }

/* Forms */
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; font-size: 1rem; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
label { display: block; font-weight: 600; color: var(--ink); font-size: .92rem; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; line-height: 1.4; }
.input-wrap { display: flex; align-items: stretch; }
.input-wrap input { border-radius: 0; flex: 1; min-width: 0; }
.input-wrap input:first-child { border-radius: 8px 0 0 8px; }
.input-wrap input:last-child { border-radius: 0 8px 8px 0; }
.input-wrap input:only-child { border-radius: 8px; }
.affix { display: flex; align-items: center; padding: 0 10px; background: var(--bg-soft); border: 1px solid #cbd5e1; color: var(--muted); font-size: .88rem; white-space: nowrap; }
.affix:first-child { border-right: 0; border-radius: 8px 0 0 8px; }
.affix:last-child { border-left: 0; border-radius: 0 8px 8px 0; }
.form-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: #fff; }
.hp-field { position: absolute; left: -9999px; }
.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 18px; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* Calculator */
.calc-card { display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.calc-inputs { padding: 26px; }
.calc-results { padding: 26px; background: linear-gradient(180deg, #f0fdfa, #ecfeff); border-left: 1px solid var(--line); }
.calc-title { font-size: 1.15rem; margin-bottom: 16px; }
.result { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px dashed #99f6e4; }
.result-label { color: var(--text); font-size: .95rem; }
.result output { font-weight: 700; color: var(--ink); font-size: 1.1rem; text-align: right; }
.result-main { flex-direction: column; align-items: flex-start; background: var(--brand); color: #fff; border-radius: 12px; padding: 16px 18px; margin-bottom: 8px; border: 0; }
.result-main .result-label { color: #ccfbf1; }
.result-main output { color: #fff; font-size: 2rem; text-align: left; line-height: 1.2; }
.result-note { font-size: .82rem; color: var(--muted); margin: 14px 0 0; }
.bars { display: grid; gap: 12px; margin-bottom: 14px; }
.bar-top { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: 4px; }
.bar-track { height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: #94a3b8; border-radius: 99px; transition: width .3s; }
.bar-best .bar-fill { background: var(--brand); }
.bar-best strong { color: var(--brand); }
.faq details { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: #fff; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--ink); list-style: none; position: relative; padding-right: 40px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 12px; font-size: 1.3rem; color: var(--brand); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 18px 14px; margin: 0; }

/* Ads */
.ad-wrap { margin: 32px auto; text-align: center; min-height: 100px; }
.ad-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; margin-bottom: 4px; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 32px; }

/* Footer */
.site-footer { background: #0f172a; color: #cbd5e1; margin-top: 64px; padding: 48px 0 0; font-size: .95rem; }
.site-footer a { color: #e2e8f0; text-decoration: none; }
.site-footer a:hover { color: #5eead4; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px; }
.footer-title { color: #fff; font-size: 1rem; margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 8px; }
.logo-footer { color: #fff; margin-bottom: 12px; }
.logo-footer strong { color: #5eead4; }
.footer-bottom { border-top: 1px solid #1e293b; margin-top: 32px; padding: 18px 20px; font-size: .85rem; color: #94a3b8; }
.footer-bottom p { margin: 0; }

/* Responsive */
@media (max-width: 960px) {
  .hero-inner, .content-grid, .calc-card { grid-template-columns: 1fr; }
  .calc-results { border-left: 0; border-top: 1px solid var(--line); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .side-card.sticky { position: static; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 10px 20px 16px; box-shadow: var(--shadow); }
  .site-nav.open { display: flex; }
  .dropdown-menu { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px; min-width: 0; }
  .nav-dropdown:hover .dropdown-menu { display: none; }
  .nav-dropdown:focus-within .dropdown-menu { display: block; }
  .two-col, .field-row { grid-template-columns: 1fr; gap: 0; }
  .two-col { gap: 20px; }
  .hero { padding: 36px 0; }
  .calc-inputs, .calc-results { padding: 20px; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ================= Control panel ================= */
.admin-body { background: #f1f5f9; }
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side { background: #0f172a; color: #cbd5e1; padding: 20px 14px; }
.admin-side .logo { color: #fff; margin: 0 6px 24px; font-size: 1.05rem; }
.admin-side .logo strong { color: #5eead4; }
.admin-side nav a { display: block; padding: 10px 12px; color: #cbd5e1; text-decoration: none; border-radius: 8px; margin-bottom: 2px; font-size: .95rem; }
.admin-side nav a:hover, .admin-side nav a.active { background: #1e293b; color: #fff; }
.admin-side .badge { background: var(--accent); color: #111; border-radius: 99px; padding: 0 8px; font-size: .75rem; font-weight: 700; margin-left: 6px; }
.admin-main { padding: 28px 32px; min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.admin-top h1 { font-size: 1.6rem; margin: 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.panel h2 { font-size: 1.1rem; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.kpi strong { display: block; font-size: 1.8rem; color: var(--ink); }
.kpi span { color: var(--muted); font-size: .9rem; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.checklist .ok { color: var(--success); font-weight: 700; }
.checklist .no { color: var(--accent); font-weight: 700; }
.admin-table td, .admin-table th { font-size: .92rem; }
.admin-table .actions { white-space: nowrap; text-align: right; }
.admin-table .actions form { display: inline; }
.link-btn { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.status { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.status-published { background: #dcfce7; color: #166534; }
.status-draft { background: #fef3c7; color: #92400e; }
.status-scheduled { background: #dbeafe; color: #1e40af; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border: 1px solid #cbd5e1; border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--bg-soft); }
.toolbar button { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: .85rem; font-family: inherit; }
.toolbar button:hover { border-color: var(--brand); color: var(--brand); }
.toolbar .sep { width: 1px; background: var(--line); margin: 0 4px; }
#content-editor { border-radius: 0 0 8px 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; min-height: 460px; line-height: 1.55; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tabs button { background: none; border: 0; padding: 6px 14px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--muted); }
.tabs button.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.preview-pane { border: 1px solid #cbd5e1; border-radius: 8px; padding: 20px 26px; min-height: 460px; background: #fff; }
.counter { float: right; font-weight: 400; font-size: .8rem; color: var(--muted); }
.counter.warn { color: var(--danger); }
.serp { font-family: Arial, sans-serif; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.serp-url { color: #202124; font-size: .82rem; }
.serp-title { color: #1a0dab; font-size: 1.15rem; line-height: 1.3; margin: 4px 0; }
.serp-desc { color: #4d5156; font-size: .88rem; line-height: 1.5; }
.seo-checks { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.seo-checks li { padding: 4px 0; }
.seo-checks li::before { content: "○ "; color: var(--muted); }
.seo-checks li.pass::before { content: "✔ "; color: var(--success); }
.seo-checks li.fail::before { content: "✖ "; color: var(--accent); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: #f1f5f9; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 32px; }
.rates-table input { padding: 6px 8px; font-size: .9rem; min-width: 80px; }
.msg-unread td { font-weight: 600; background: #fffbeb; }
@media (max-width: 960px) {
  .admin-shell, .editor-grid { grid-template-columns: 1fr; }
  .admin-side { padding: 12px; }
  .admin-side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-side .logo { margin-bottom: 10px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .admin-main { padding: 20px 16px; }
}
