/* ==========================================================================
   HomeLoanCalc — web skin for the calculator engine
   Re-colours the app to the theme brand and turns the phone layout into a
   responsive website app: persistent sidebar on desktop, sticky bars on mobile.
   Everything is scoped to #hlc-app. Safe to edit.
   ========================================================================== */

/* ---------- brand palette (light) ---------- */
#hlc-app{
  --bg:var(--hl-paper,#F4F7FC);--bg-soft:var(--hl-tint,#DFF4F1);
  --surface:rgba(255,255,255,.94);--surface-solid:var(--hl-surface,#fff);--surface-2:rgba(231,237,255,.55);
  --border:rgba(15,26,51,.09);--border-strong:rgba(15,26,51,.17);
  --text:var(--hl-ink,#0F1A33);--text-soft:#3E4A66;--text-muted:var(--hl-slate,#55627F);
  --primary:var(--hl-brand,#0E8A7D);--primary-600:#0B6B62;--primary-700:#095750;--primary-soft:rgba(14,138,125,.10);
  --success:#0E7A41;--success-soft:rgba(17,138,74,.12);
  --info:#0E7C70;--info-soft:rgba(14,138,125,.11);
  --radius:18px;--radius-sm:12px;
  --shadow-sm:0 1px 2px rgba(15,26,51,.05);--shadow:0 1px 2px rgba(15,26,51,.05),0 10px 28px -14px rgba(15,26,51,.20);--shadow-lg:0 18px 50px -12px rgba(15,26,51,.35);
  --shell-outer-bg:transparent;
  font-family:var(--hl-body,"Instrument Sans"),var(--font);
  color:var(--text);
}
/* ---------- brand palette (dark) ---------- */
[data-theme='dark'] #hlc-app{
  --bg:#081A1C;--bg-soft:#0F2E2E;
  --surface:rgba(15,38,40,.92);--surface-solid:#0F2628;--surface-2:rgba(15,46,46,.6);
  --border:rgba(162,174,203,.15);--border-strong:rgba(162,174,203,.27);
  --text:#EAF0FF;--text-soft:#C5CFE8;--text-muted:#A2AECB;
  --primary:#3DD6C3;--primary-600:#7FE7DA;--primary-700:#A8F0E6;--primary-soft:rgba(61,214,195,.15);
  --success:#3DD17C;--success-soft:rgba(61,209,124,.14);
  --info:#3DD6C3;--info-soft:rgba(61,214,195,.15);
  --shadow:0 1px 2px rgba(0,0,0,.4),0 12px 30px -14px rgba(0,0,0,.65);--shadow-lg:0 18px 50px -10px rgba(0,0,0,.7);
}
#hlc-app .btn-primary{color:#fff}
[data-theme='dark'] #hlc-app .btn-primary{color:#081A1C}
#hlc-app h1,#hlc-app h2,#hlc-app h3,#hlc-app .page-title,#hlc-app .section-title{font-family:var(--hl-display,"Bricolage Grotesque"),var(--font);letter-spacing:-.02em}
#hlc-app .page-title{font-weight:800}
#hlc-app .route-pill.active,#hlc-app .bottom-nav-item.active{color:#fff}
[data-theme='dark'] #hlc-app .route-pill.active{color:#081A1C}

/* ---------- shell: always flows with the page ---------- */
#hlc-app{position:relative;width:100%;display:block!important;height:auto!important;min-height:0!important;overflow:visible!important;padding:0!important;margin:0!important;background:transparent!important;zoom:1}
#hlc-app .device-toolbar,#hlc-app .mobile-status-bar,#hlc-app .home-indicator{display:none!important}
#hlc-app .mobile-device-shell{
  background:transparent;max-width:1280px;min-height:0!important;margin:0 auto!important;
  border:0;border-radius:0;box-shadow:none;overflow:visible!important;
}
#hlc-app .topbar{
  top:var(--hl-nav-h,64px)!important;padding:12px 16px!important;
  background:color-mix(in srgb,var(--bg) 88%,transparent);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);
  border-bottom:1px solid var(--border);z-index:40!important;
}
#hlc-app .page-subtitle-pill{color:var(--primary)}
#hlc-app .app-scroll-container{padding-bottom:28px!important;max-width:100%!important;margin:0!important}
#hlc-app .hlc-fade{animation:hlcFade .25s ease-out}
@keyframes hlcFade{from{opacity:0}to{opacity:1}}
@keyframes hlcIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
#hlc-app .calc-tile,#hlc-app .explore-card,#hlc-app .card,#hlc-app .result-box,#hlc-app .stat-card{transition:transform .22s,box-shadow .22s,border-color .2s}
#hlc-app .calc-tile:hover,#hlc-app .explore-card:hover{transform:translateY(-3px);box-shadow:var(--shadow)}
#hlc-app .card{box-shadow:var(--shadow-sm)}
#hlc-app .btn:hover{filter:brightness(1.06)}
#hlc-app :focus-visible{outline:3px solid var(--primary);outline-offset:2px}
#hlc-app input[type=text],#hlc-app input[type=number],#hlc-app input:not([type]),#hlc-app select{border-radius:12px}

/* ---------- mobile / tablet (< 1024px) ---------- */
@media (max-width:1023.98px){
  #hlc-app .bottom-nav{
    position:sticky!important;bottom:0!important;left:auto!important;right:auto!important;
    max-width:560px!important;margin:0 auto!important;border-radius:18px 18px 0 0!important;
    background:color-mix(in srgb,var(--surface-solid) 94%,transparent);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);
    z-index:60!important;
  }
  #hlc-app .sidebar{position:fixed!important;z-index:1200!important;top:0!important;bottom:0!important}
  #hlc-app .sidebar-overlay{position:fixed!important;z-index:1190!important}
  #hlc-app .sidebar:not(.open){visibility:hidden;box-shadow:none!important}
  #hlc-app .sidebar{transition:transform .28s,visibility 0s linear .28s}
  #hlc-app .sidebar.open{visibility:visible;transition:transform .28s}
  #hlc-app .modal-root{z-index:1300!important}
  #hlc-app .toast{z-index:1400!important;bottom:84px!important}
}

/* ---------- desktop (≥ 1024px): persistent sidebar ---------- */
@media (min-width:1024px){
  #hlc-app .mobile-device-shell{
    display:grid!important;grid-template-columns:276px minmax(0,1fr);
    grid-template-areas:"side top" "side main";grid-template-rows:auto 1fr;column-gap:28px;align-items:start;
  }
  #hlc-app .sidebar{
    grid-area:side;position:sticky!important;top:calc(var(--hl-nav-h,64px) + 14px)!important;bottom:auto!important;
    transform:none!important;width:auto;max-width:none;
    height:calc(100vh - var(--hl-nav-h,64px) - 28px);max-height:860px;
    border:1px solid var(--border);border-radius:22px;box-shadow:var(--shadow-sm);z-index:2;overflow:hidden;
  }
  #hlc-app .sidebar .nav{overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
  #hlc-app .sidebar-overlay,#hlc-app #sidebarClose,#hlc-app .bottom-nav{display:none!important}
  #hlc-app #menuBtn:not([data-mode='back']){display:none!important}
  #hlc-app .topbar{grid-area:top;border-radius:20px;border:1px solid var(--border);top:calc(var(--hl-nav-h,64px) + 14px)!important;margin-bottom:6px}
  #hlc-app .app-scroll-container{grid-area:main;padding:8px 0 40px!important;min-width:0}
  #hlc-app .sticky-ad-bar{grid-column:2}
  #hlc-app #routePills{display:none!important}
  #hlc-app .calc-tile-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important}
  #hlc-app .modal-root{z-index:1300!important}
  #hlc-app .modal{max-width:720px!important}
}
@media (min-width:1500px){#hlc-app .mobile-device-shell{max-width:1400px}}

/* ---------- loading skeleton ---------- */
#hlc-app:not(.hlc-ready) .mobile-device-shell{min-height:520px!important;opacity:.0}
#hlc-app.hlc-ready .mobile-device-shell{animation:hlcIn .5s both}

/* ---------- print / PDF: only the report sheet ---------- */
@media print{
  .hl-noprint{display:none!important}
  #hlc-app .sidebar,#hlc-app .topbar,#hlc-app .bottom-nav{display:none!important}
}
body.pdf-reader-mode .hl-noprint{display:none!important}
body.pdf-reader-mode #hlc-app{max-width:none}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion:reduce){#hlc-app *{animation:none!important;transition:none!important}}


/* ---------- compact desktop menu (the app's phone-size menu is too big on a website) ---------- */
@media (min-width:1024px){
  #hlc-app .mobile-device-shell{grid-template-columns:244px minmax(0,1fr);column-gap:22px}
  #hlc-app .sidebar{border-radius:16px}
  #hlc-app .sidebar-header{padding:14px 14px 12px!important}
  #hlc-app .sidebar .logo-mark{width:34px!important;height:34px!important;font-size:14px!important;border-radius:10px!important}
  #hlc-app .sidebar .logo-text strong{font-size:15px!important}
  #hlc-app .sidebar .logo-text small{font-size:11px!important}
  #hlc-app .sidebar .nav{padding:6px 8px 10px!important;gap:1px!important}
  #hlc-app .sidebar .nav-section-label{font-size:10.5px!important;padding:12px 10px 4px!important;letter-spacing:.08em}
  #hlc-app .sidebar .nav-item{font-size:13.5px!important;padding:8px 10px!important;gap:10px!important;font-weight:600!important;border-radius:10px!important;line-height:1.25}
  #hlc-app .sidebar .nav-item svg{width:18px!important;height:18px!important}
  #hlc-app .sidebar-footer{padding:8px 10px 10px!important;flex-direction:row!important;gap:6px!important}
  #hlc-app .sidebar-footer button,#hlc-app .sidebar-footer .btn{font-size:12px!important;padding:8px 6px!important;flex:1;justify-content:center;white-space:nowrap}
  #hlc-app .sidebar-footer button svg{width:15px!important;height:15px!important}
  #hlc-app .topbar{padding:8px 12px!important}
  #hlc-app .topbar .page-title{font-size:16px!important}
  #hlc-app .topbar .icon-btn{width:34px!important;height:34px!important}
}

/* ---------- popups: centered dialog on desktop, compact sheet on phones ---------- */
#hlc-app .modal-root{position:fixed!important;inset:0!important;z-index:1500!important}
#hlc-app .modal-backdrop{position:fixed!important;inset:0!important}
#hlc-app .modal-root.show .modal{height:auto!important;max-height:min(88vh,820px)!important}
#hlc-app .modal-body{overflow-y:auto!important;overscroll-behavior:contain}
@media (min-width:700px){
  #hlc-app .modal-root.show{display:flex!important;align-items:center;justify-content:center;padding:24px}
  #hlc-app .modal-root.show .modal{position:relative!important;inset:auto!important;left:auto!important;right:auto!important;bottom:auto!important;margin:0!important;
    width:min(540px,100%)!important;max-width:540px!important;border-radius:20px!important;animation:hlcPop .18s ease-out}
  #hlc-app .modal-root.show .modal .modal-handle{display:none}
  #hlc-app .modal-root.show .modal .modal-header{padding:14px 18px!important}
  #hlc-app .modal-root.show .modal .modal-body{padding:14px 18px!important}
  #hlc-app .modal-root.show .modal .modal-footer{padding:12px 18px 14px!important}
}
@keyframes hlcPop{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
body.pdf-reader-mode #hlc-app .modal-root.show .modal{width:min(980px,100%)!important;max-width:980px!important;height:88vh!important}

/* ---------- snappier feel ---------- */
#hlc-app .card,#hlc-app .result-box,#hlc-app .stat-card,#hlc-app .calc-tile,#hlc-app .explore-card{transition:border-color .15s,box-shadow .15s}
#hlc-app .calc-tile:hover,#hlc-app .explore-card:hover{transform:none}
#hlc-app *{-webkit-tap-highlight-color:transparent}

@media (max-width:699px){
  #hlc-app .modal-root.show .modal{position:fixed!important;left:0!important;right:0!important;bottom:0!important;top:auto!important;width:auto!important;max-width:none!important;margin:0!important;border-radius:20px 20px 0 0!important;max-height:min(86vh,86dvh)!important}
  #hlc-app .modal-root.show .modal .modal-footer{padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}
}

/* An identity transform on the app shell turned every position:fixed child (popups, drawer) into an element
   pinned to the shell instead of the screen. Remove it. */
#hlc-app .mobile-device-shell{transform:none!important;will-change:auto!important;filter:none!important}

#hlc-app .mobile-device-shell{animation:none!important}

@media (min-width:1024px){
  #hlc-app .sidebar-footer{flex-direction:column!important;gap:6px!important}
  #hlc-app .sidebar-footer button,#hlc-app .sidebar-footer .btn{width:100%;padding:7px 8px!important;font-size:12px!important}
  #hlc-app #soundToggleSidebar{display:none!important}
}

#hlc-app .logo-mark{background:none!important;overflow:hidden;padding:0}
#hlc-app .logo-mark img{width:100%;height:100%;display:block;object-fit:cover;border-radius:inherit}


/* =====================================================================
   v1.2 – minimal layout: no permanent sidebar. The menu is a slide-over
   drawer opened with the burger button, on every screen size.
   ===================================================================== */
body #hlc-app .mobile-device-shell{display:block!important;max-width:880px;margin:0 auto;padding:0}
body #hlc-app #menuBtn,body #hlc-app #menuBtn:not([data-mode='back']){display:inline-flex!important}
body #hlc-app #sidebarClose{display:inline-flex!important}
body #hlc-app .sidebar-overlay{display:block!important;position:fixed!important;inset:0!important;z-index:1190!important;background:rgba(8,26,28,.45)}
body #hlc-app .sidebar{
  position:fixed!important;top:0!important;bottom:0!important;left:0!important;grid-area:auto;
  width:min(288px,86vw)!important;max-width:none!important;height:auto!important;max-height:none!important;
  border:0!important;border-right:1px solid var(--border)!important;border-radius:0 18px 18px 0!important;
  box-shadow:0 20px 60px rgba(0,0,0,.28)!important;z-index:1200!important;overflow:hidden;
  transform:translateX(-104%)!important;visibility:hidden;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s;
}
body #hlc-app .sidebar.open{transform:none!important;visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1)}
body #hlc-app .sidebar .nav{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:4px 8px 10px!important;gap:1px!important}
body #hlc-app .sidebar-header{padding:12px 12px 10px!important}
body #hlc-app .sidebar .logo-mark{width:32px!important;height:32px!important;border-radius:9px!important}
body #hlc-app .sidebar .logo-text strong{font-size:15px!important}
body #hlc-app .sidebar .logo-text small{font-size:11px!important}
body #hlc-app .sidebar .nav-section-label{font-size:10px!important;padding:12px 10px 4px!important;letter-spacing:.08em}
body #hlc-app .sidebar .nav-item{font-size:13.5px!important;padding:8px 10px!important;gap:10px!important;font-weight:600!important;border-radius:9px!important;line-height:1.2;min-height:0!important}
body #hlc-app .sidebar .nav-item svg{width:17px!important;height:17px!important}
body #hlc-app .sidebar-footer{padding:8px 10px 10px!important;flex-direction:row!important;gap:6px!important}
body #hlc-app .sidebar-footer button{flex:1;width:auto;padding:7px 6px!important;font-size:12px!important;justify-content:center;white-space:nowrap}
body #hlc-app #soundToggleSidebar{display:none!important}
body #hlc-app .topbar{position:sticky!important;top:var(--hl-nav-h,64px)!important;margin:0 0 8px!important;border-radius:14px;padding:6px 10px!important;border:1px solid var(--border);z-index:40}
body #hlc-app .topbar .page-title{font-size:15px!important}
body #hlc-app .topbar .icon-btn{width:34px!important;height:34px!important}
body #hlc-app .app-scroll-container{padding:4px 0 32px!important}
body #hlc-app .sticky-ad-bar{grid-column:auto}
body #hlc-app #routePills{display:none!important}
body #hlc-app .bottom-nav{display:none!important}
@media (max-width:1023.98px){body #hlc-app .topbar{top:0!important}}

/* ---- minimal, calmer cards ---- */
body #hlc-app .card{border-radius:14px;box-shadow:none;border:1px solid var(--border);padding:14px 16px}
body #hlc-app .section-title{font-size:14px;margin-bottom:10px}
body #hlc-app .page-subtitle-pill{display:none!important}
body #hlc-app .btn{min-height:42px;border-radius:10px}

/* ---- v1.2 compact controls (small tabs, slim inputs) ---- */
body #hlc-app .segmented{display:inline-flex!important;width:auto!important;max-width:100%;padding:3px!important;border-radius:10px!important;gap:2px;overflow-x:auto}
body #hlc-app .segmented button{flex:none!important;width:auto!important;padding:6px 14px!important;font-size:12.5px!important;min-height:0!important;border-radius:8px!important;white-space:nowrap}
body #hlc-app .input,body #hlc-app select.input,body #hlc-app input[type=text],body #hlc-app input[type=number],body #hlc-app input[type=date]{height:40px!important;min-height:0!important;font-size:14px!important;padding:0 12px!important;border-radius:10px!important}
body #hlc-app .input-group .suffix{padding:0 10px!important;font-size:12.5px!important;white-space:nowrap}
body #hlc-app label,body #hlc-app .label{font-size:12.5px!important;margin-bottom:4px!important}
body #hlc-app .field,body #hlc-app .form-group{margin-bottom:10px!important}
body #hlc-app .chip,body #hlc-app .quick-chip,body #hlc-app .chips button{font-size:11.5px!important;padding:3px 9px!important;min-height:0!important}
body #hlc-app .icon-btn{width:34px!important;height:34px!important;border-radius:10px!important}
body #hlc-app .btn,body #hlc-app .btn-sm,body #hlc-app .device-pill-btn{font-size:13px!important;padding:0 14px!important;min-height:38px!important;border-radius:10px!important}
body #hlc-app .btn svg{width:16px!important;height:16px!important}
body #hlc-app .card{margin-bottom:10px!important}
body #hlc-app h2,body #hlc-app .section-title{font-size:14px!important}
body #hlc-app .page-title{font-size:15px!important}
body #hlc-app .result-box{padding:14px!important}

/* ---- v1.2 schedule table: compact, centred action cells, icon buttons ---- */
body #hlc-app .amort-scroll{max-height:560px}
body #hlc-app table.data{font-size:12.5px}
body #hlc-app table.data th,body #hlc-app table.data td{padding:7px 9px!important}
body #hlc-app table.data th.ctr,body #hlc-app table.data td.ctr{text-align:center!important;width:1%}
body #hlc-app table.data td.ctr .flex{justify-content:center;gap:4px!important;flex-wrap:nowrap}
body #hlc-app table.data .btn-sm{min-height:0!important;padding:3px 8px!important;font-size:12px!important;line-height:1.2;border-radius:8px!important}
body #hlc-app table.data .btn-ghost.btn-sm{padding:4px 6px!important}
body #hlc-app table.data .btn-sm svg{width:14px!important;height:14px!important}
body #hlc-app table.data .badge{font-size:11px!important;padding:2px 8px!important}
body #hlc-app .amort-mobile-card .btn-ghost.btn-sm svg{width:14px;height:14px}

/* ---- inputs: fit to content instead of full width ---- */
body #hlc-app .input-group{max-width:340px}
body #hlc-app .grid-2 .input-group,body #hlc-app .grid .input-group{max-width:none}
@media (max-width:520px){body #hlc-app .input-group{max-width:none}}
body #hlc-app table.data .btn-sm svg,body #hlc-app .btn svg{flex:none;min-width:14px}
body #hlc-app table.data td.ctr .btn{flex:none}

/* ---- v1.4 compact disclaimer + credits (one calm block at the end of the calculator) ---- */
body #hlc-app .disclaimer{padding:10px 14px!important;margin:14px 0 6px!important;border-radius:12px;position:relative}
body #hlc-app .disclaimer-header{font-size:11px!important;letter-spacing:.06em;margin-bottom:4px!important}
body #hlc-app .disclaimer-header svg{width:14px!important;height:14px!important}
body #hlc-app .disclaimer p{font-size:11.5px!important;line-height:1.5!important;margin:0!important;color:var(--text-muted)}
body #hlc-app .disclaimer:not(.open) p:first-of-type{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
body #hlc-app .disclaimer:after{content:"Read more";display:block;margin-top:4px;font-size:11px;font-weight:700;color:var(--primary);cursor:pointer}
body #hlc-app .disclaimer.open:after{content:"Show less"}
body #hlc-app .disclaimer{cursor:pointer}
body #hlc-app .footer-contact{display:flex!important;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px 14px!important;padding:8px 0 0!important;margin:0!important;font-size:12px!important}
body #hlc-app .footer-contact .owner-credit{font-size:12px!important}
body #hlc-app .footer-contact .contact-us{display:flex;align-items:center;gap:8px}
body #hlc-app .footer-contact .contact-label{font-size:11px!important}
body #hlc-app .footer-contact .owner-link{width:28px!important;height:28px!important;border-radius:8px!important}
body #hlc-app .footer-contact .owner-link svg{width:15px!important;height:15px!important}
body #hlc-app .footer-contact .legal-links-row{margin:0!important;font-size:12px!important;gap:6px!important}
body #hlc-app .footer-contact .legal-links-row:last-child{display:none!important}
body #hlc-app .footer-contact .legal-link-btn{font-size:12px!important;padding:0!important}
