:root{
  --border: #b9b9b9;
  --border-light: #d5d5d5;
  --green: #25D366;
  --green-dark: #1DA851;
  --link: #1a5fb4;
  --text: #222;
  --row-alt: #f4f4f4;
  --head-bg: #e9e9e9;
  --bg-page: #ffffff;
  --panel-bg: #ffffff;
  --card-bg: #eef0ef;
  --card-bg-hover: #e3e6e4;
  --footer-bg: #e5e5e5;
  --input-bg: #ffffff;
  --input-border: #4a90d9;
  --input-text: #222;
  --pill-text: #1DA851;
  --seo-text: #333;
}
body.dark{
  --border: #3a3a3a;
  --border-light: #333333;
  --link: #6fb1ff;
  --text: #eaeaea;
  --row-alt: #232323;
  --head-bg: #262626;
  --bg-page: #121212;
  --panel-bg: #1b1b1b;
  --card-bg: #232323;
  --card-bg-hover: #2b2b2b;
  --footer-bg: #1a1a1a;
  --input-bg: #232323;
  --input-border: #3d7dbf;
  --input-text: #f0f0f0;
  --pill-text: #7be3a4;
  --seo-text: #cfcfcf;
}
*{box-sizing:border-box;}
body{
  margin:0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg-page);
  font-size:14px;
  transition: background .2s ease, color .2s ease;
}
.page-content{
  padding: 30px;
  max-width: 1300px;
  margin: 0 auto;
}
.breadcrumb-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 4px 0 14px;
  font-size:13px;
}
.breadcrumb-row .breadcrumb a{ color:#1a5fb4; text-decoration:none; }
.breadcrumb-row .breadcrumb a:hover{ text-decoration:underline; }
.breadcrumb-row .print-link{
  color:#1a5fb4; font-weight:bold; font-size:15px; text-decoration:none;
  background:none; border:none; cursor:pointer;
}
.breadcrumb-row .print-link:hover{ text-decoration:underline; }
.print-header{ display:none; }

/* ===== NAVBAR ===== */
.navbar{
  background-color:#25D366; display:flex; align-items:flex-end; justify-content:space-between;
  padding:0 40px 10px 0; height:65px; border-bottom:3px solid #000; width:100%; position:relative;
}
.logo{
  font-family:Arial, sans-serif; font-weight:800; font-size:26px; white-space:nowrap;
  text-decoration:none; letter-spacing:0.3px; padding-left:20px; padding-bottom:10px;
}
.logo .ce{ color:#ffffff; }
.logo .online{ color:#0d3b66; }
.right-group{ display:flex; align-items:flex-end; gap:30px; margin-right:90px; }
.nav-links{ display:flex; align-items:center; gap:10px; }
.nav-links a{
  color:#ffffff; text-decoration:none; font-size:12px; font-weight:bold;
  padding:8px 14px; white-space:nowrap; border-radius:4px;
}
.nav-links a.active, .nav-links a:hover{ background-color:#FFD700; }
.signin{
  color:#ffffff; font-size:14px; font-weight:bold; white-space:nowrap; text-decoration:none;
  padding:8px 16px; position:absolute; top:0; right:0;
}
.signin:hover{ text-decoration:underline; }
.signin-wrap{ position:absolute; top:0; right:0; display:flex; align-items:center; gap:14px; padding:8px 16px; }
.signin-link{ color:#ffffff; font-size:14px; font-weight:bold; text-decoration:none; white-space:nowrap; }
.signin-link:hover{ text-decoration:underline; }
.hamburger{ display:none; background:none; border:none; cursor:pointer; padding:8px; }
.hamburger span{ display:block; width:26px; height:3px; background:#ffffff; margin:5px 0; border-radius:2px; }
.mobile-menu{ display:none; flex-direction:column; background-color:#111111; position:absolute; left:0; right:0; z-index:100; }
.mobile-menu a{ color:#ffffff; text-decoration:none; font-size:14px; padding:10px 20px; border-bottom:1px solid #333333; }
.mobile-menu.open{ display:flex; }
.mobile-spacer{ display:none; }

@media (max-width: 768px) {
  .navbar{ padding:0 12px; justify-content:space-between; align-items:center; height:56px; }
  .nav-links, .signin, .signin-wrap{ display:none; }
  .hamburger{ display:block; position:static; flex-shrink:0; width:34px; padding:6px; }
  .mobile-spacer{ display:block; flex-shrink:0; width:34px; }
  .logo{ font-size:20px; flex:1; text-align:center; white-space:nowrap; padding-left:0; padding-bottom:0; }
}

/* ===== FOOTER ===== */
.site-footer{ background-color:var(--footer-bg); text-align:center; padding:18px 20px; margin-top:40px; font-size:14px; color:var(--text); }
.site-footer a{ color:#1a5276; text-decoration:underline; }
.site-footer .footer-links{ display:inline; margin-bottom:0; }
.site-footer .footer-copyright{ display:inline; margin-left:6px; }
.site-footer .footer-row{ display:inline; }
.site-footer .footer-sep{ margin:0 6px; color:#666666; }
@media (max-width: 768px) {
  .site-footer{ font-size:13px; padding:16px 15px; }
  .site-footer .footer-links{ display:block; }
  .site-footer .footer-row{ display:block; margin-bottom:2px; }
  .site-footer .row-sep{ display:none; }
  .site-footer .footer-copyright{ display:block; margin-left:0; font-size:12px; }
}

/* ===== H1 ROW + THEME TOGGLE ===== */
.h1-row{ display:flex; align-items:center; justify-content:space-between; gap:14px; margin:0 0 8px; flex-wrap:wrap; }
.h1-row h1{ font-size:22px; margin:0; }
.theme-toggle{
  display:flex; align-items:center; gap:6px; background:var(--panel-bg); border:1px solid var(--border);
  border-radius:999px; padding:7px 16px; font-size:13.5px; font-weight:bold; color:var(--text);
  cursor:pointer; white-space:nowrap; flex-shrink:0;
}
.theme-toggle:hover{ border-color:#25D366; }
.page-subtitle{ margin:0 0 22px; font-size:14.5px; color:var(--text); max-width:800px; }

/* ===== GENERIC TOOL LAYOUT (form + results side by side) ===== */
.app{ display:flex; gap:20px; align-items:flex-start; flex-wrap:wrap; }
.form-panel{
  border:1px solid var(--border); border-radius:4px; padding:18px;
  flex:1 1 280px; min-width:260px; max-width:400px; background:var(--panel-bg);
}
.form-panel h2, .results-panel h2{ font-size:15px; margin:0 0 14px; }
.row{ display:flex; align-items:center; justify-content:flex-end; gap:8px; margin-bottom:14px; flex-wrap:wrap; }
.row label{ text-align:right; flex:1; font-size:13.5px; color:var(--text); min-width:110px; }
.help{
  display:inline-flex; align-items:center; justify-content:center; width:14px; height:14px; border-radius:50%;
  border:1px solid #999; color:#777; font-size:10px; margin-left:3px; cursor:default;
}
.row input[type="text"], .row input[type="number"]{
  border:1px solid var(--input-border); border-radius:3px; padding:6px 8px; font-size:13.5px;
  width:140px; background:var(--input-bg); color:var(--input-text);
}
.row select{
  border:1px solid var(--input-border); border-radius:3px; padding:6px 6px; font-size:13px;
  width:148px; background:var(--input-bg); color:var(--input-text);
}
.suffix{ font-size:13px; color:var(--text); margin-left:2px; }
.unit-toggle{ display:flex; gap:6px; justify-content:flex-end; width:100%; flex-wrap:wrap; }
.unit-toggle button{
  border:1px solid var(--border); background:var(--panel-bg); color:var(--text); border-radius:4px;
  padding:4px 12px; font-size:12px; font-weight:bold; cursor:pointer; flex:none;
}
.unit-toggle button.active{ background:var(--green); border-color:var(--green); color:#fff; }
.btn-row{ display:flex; gap:10px; margin-top:6px; }
button{ font-size:14px; padding:9px 0; border-radius:4px; border:none; cursor:pointer; flex:1; }
.btn-calc{ background:var(--green); color:#fff; }
.btn-calc:hover{ background:var(--green-dark); }
.btn-clear{ background:#c9c9c9; color:#333; }
.btn-clear:hover{ background:#bbb; }

.results-panel{ flex:1 1 280px; min-width:260px; max-width:420px; }
.pay-banner{ background:var(--green); color:#fff; padding:14px 16px; border-radius:4px 4px 0 0; font-size:18px; }
.pay-banner .amt{ font-weight:bold; margin-left:8px; }
table.results-table{ width:100%; border-collapse:collapse; border:1px solid var(--border); border-top:none; background:var(--panel-bg); }
table.results-table th, table.results-table td{ padding:9px 12px; text-align:right; border-bottom:1px solid var(--border-light); font-size:13.5px; }
table.results-table th:first-child, table.results-table td:first-child{ text-align:left; }
table.results-table thead th{ background:var(--head-bg); font-weight:bold; }
table.results-table tr.total-row td{ font-weight:bold; background:var(--row-alt); border-bottom:none; }
.error-box{
  display:none; background:#fdecea; color:#8a1f11; border:1px solid #f2b8b0; border-radius:4px;
  padding:10px 14px; font-size:13.5px; margin-top:12px;
}
body.dark .error-box{ background:#3a1c1c; color:#ff9f93; border-color:#5c2a2a; }
.error-box.show{ display:block; }

.chart-block{
  border:1px solid var(--border); border-top:none; padding:16px 12px; display:flex; align-items:center;
  gap:18px; background:var(--panel-bg);
}
.donut{ width:110px; height:110px; border-radius:50%; flex-shrink:0; position:relative; background:conic-gradient(var(--green) 0% 100%); }
.donut::after{ content:""; position:absolute; top:22px; left:22px; width:66px; height:66px; border-radius:50%; background:var(--panel-bg); }
.legend{ font-size:13px; }
.legend div{ display:flex; align-items:center; gap:7px; margin-bottom:6px; }
.swatch{ width:11px; height:11px; border-radius:2px; flex-shrink:0; }

@media (max-width: 700px){ .form-panel, .results-panel{ width:100%; max-width:none; } }

/* ===== KEYPAD (scientific calculator) ===== */
.keypad-panel{ border:1px solid var(--border); border-radius:4px; padding:14px; background:var(--panel-bg); flex:1 1 340px; max-width:420px; }
.calc-display{
  width:100%; border:1px solid var(--input-border); border-radius:4px; background:var(--input-bg);
  color:var(--input-text); font-size:26px; text-align:right; padding:16px 12px; margin-bottom:10px;
  overflow-x:auto; white-space:nowrap; min-height:32px;
}
.calc-subdisplay{ text-align:right; font-size:13px; color:var(--seo-text); min-height:16px; margin:-4px 0 8px; }
.keypad{ display:grid; grid-template-columns:repeat(5, 1fr); gap:6px; }
.keypad button{
  padding:12px 0; font-size:14px; border-radius:4px; border:1px solid var(--border);
  background:var(--row-alt); color:var(--text); cursor:pointer; flex:none;
}
.keypad button.op{ background:#dfe7e4; font-weight:bold; }
.keypad button.eq{ background:var(--green); color:#fff; grid-column: span 2; }
.keypad button.clear{ background:#e39a9a; }
body.dark .keypad button{ background:#242424; }
body.dark .keypad button.op{ background:#2e3a35; }
body.dark .keypad button.clear{ background:#5a2b2b; }

/* ===== SEO / THEORY SECTION ===== */
.seo-content{ max-width:900px; margin:44px auto 0; line-height:1.7; color:var(--seo-text); }
.seo-content h2{ font-size:19px; margin:34px 0 12px; color:var(--text); border-bottom:2px solid #25D366; padding-bottom:6px; }
.seo-content h2:first-child{ margin-top:0; }
.seo-content h3{ font-size:16px; margin:20px 0 8px; color:var(--text); }
.seo-content p{ margin:0 0 14px; font-size:14.5px; }
.seo-content ol, .seo-content ul{ margin:0 0 14px; padding-left:22px; font-size:14.5px; }
.seo-content li{ margin-bottom:6px; }
.seo-content table.freq-table{ width:100%; border-collapse:collapse; margin:16px 0 20px; }
.seo-content table.freq-table th, .seo-content table.freq-table td{ border:1px solid var(--border-light); padding:8px 10px; font-size:13.5px; text-align:center; }
.seo-content table.freq-table thead th{ background:var(--head-bg); }
.seo-content .faq-item{ margin-bottom:16px; }
.seo-content .faq-item h3{ margin-bottom:4px; }
.formula-block{
  display:flex; justify-content:center; align-items:center; margin:18px 0 6px; font-size:20px;
  font-family:'Times New Roman', Georgia, serif; font-style:italic; color:var(--text); flex-wrap:wrap; gap:6px;
}
.formula-block .f-emi{ margin-right:10px; font-weight:bold; }
.formula-block .f-frac{ display:inline-flex; flex-direction:column; align-items:center; vertical-align:middle; margin:0 6px; }
.formula-block .f-num, .formula-block .f-den{ padding:0 4px; }
.formula-block .f-frac .f-num{ border-bottom:1.5px solid var(--text); padding-bottom:2px; }
.formula-note{ font-size:13px; text-align:center; color:var(--seo-text); font-style:normal; margin-top:0; margin-bottom:20px; }

/* ===== PRINT ===== */
@media print{
  .navbar, .hamburger, .mobile-menu, .sidebar, .print-link, .btn-row, .site-footer, .theme-toggle, .chart-block, .seo-content, .breadcrumb-row, .keypad{
    display:none !important;
  }
  .print-header{ display:block !important; font-size:22px; font-weight:800; margin-bottom:10px; }
  .print-header .ce{ color:#111; }
  .print-header .online{ color:#0d3b66; }
  .schedule-table-scroll{ max-height:none !important; overflow:visible !important; }
  table.schedule-table thead th{ position:static; }
  table.schedule-table tr{ page-break-inside:avoid; }
  *{ -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; color-adjust:exact !important; }
}
