/* HVACR Toolbox - shared styles. Dark, high-contrast default for sunlight; light theme via html[data-theme=light]. */
:root {
  --bg: #0a0e13; --panel: #141b24; --panel2: #1b2430; --border: #2a3645;
  --text: #f4f7fa; --muted: #a3b1c0; --accent: #ffb020; --accent-ink: #1a1200; --link: #6cc9ff;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa;
  --radius: 14px; --shadow: 0 6px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
html[data-theme=light] {
  --bg: #f3f5f8; --panel: #ffffff; --panel2: #eef2f6; --border: #d5dde6;
  --text: #0d141c; --muted: #4b5a6b; --accent: #b86e00; --accent-ink: #ffffff; --link: #0b63c4;
  --ok: #0f8a5f; --warn: #a16207; --bad: #c22c2c; --info: #1d4ed8;
  --shadow: 0 6px 20px rgba(20,30,40,.10);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; min-height: 100vh; }
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: .4rem 0; }
small, .muted { color: var(--muted); }
code { background: var(--panel2); padding: .1em .35em; border-radius: 6px; font-size: .95em; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; left: -9999px; }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .brand { display: flex; white-space: nowrap; align-items: center; gap: .5rem; font-weight: 800; text-decoration: none; color: var(--text); letter-spacing: .2px; }
.topbar .brand svg { width: 30px; height: 30px; }
.topbar .spacer { flex: 1; }
.iconbtn { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); display: inline-flex; align-items: center; justify-content: center; gap: .3rem; padding: 0 .6rem; cursor: pointer; font-weight: 700; font-size: .9rem; }
.iconbtn[aria-pressed=true] { outline: 2px solid var(--accent); }
.badge { display: inline-block; padding: .15em .55em; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .3px; background: var(--panel2); border: 1px solid var(--border); }
.badge.pro { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.badge.free { color: var(--muted); }
.badge.offline { background: var(--warn); color: #1a1200; border-color: transparent; }

main.app { max-width: 960px; margin: 0 auto; padding: 1rem .9rem 6.5rem; }
.embedded main.app, main.app.embedded { padding: 0; }

/* Home grid */
.hero { padding: .4rem 0 1rem; }
.hero h1 { font-size: 1.5rem; }
.toolgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
@media (min-width: 640px) { .toolgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .toolgrid { grid-template-columns: repeat(4, 1fr); } }
.toolcard { display: flex; flex-direction: column; gap: .35rem; min-height: 118px; padding: .9rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); text-decoration: none; color: var(--text); box-shadow: var(--shadow); position: relative; }
.toolcard:active { transform: scale(.98); }
.toolcard .ico { width: 34px; height: 34px; color: var(--accent); }
.toolcard b { font-size: 1rem; }
.toolcard small { font-size: .82rem; line-height: 1.3; }
.toolcard .badge { position: absolute; top: .6rem; right: .6rem; }

/* Cards and forms */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 .9rem; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; background: var(--panel2); }
.toolhead { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.toolhead .back { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); font-size: 1.3rem; }
.toolhead h1 { font-size: 1.35rem; margin: 0; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .7rem; }
.field label { font-weight: 700; font-size: .95rem; }
.field .hint { font-size: .8rem; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; padding: .55rem .8rem; border-radius: 12px; border: 1.5px solid var(--border); background: var(--panel2); color: var(--text); font-size: 1.15rem; }
.field input[type=number] { font-variant-numeric: tabular-nums; }
.field textarea { min-height: 90px; font-size: 1rem; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.inputrow { display: flex; gap: .5rem; align-items: center; }
.inputrow input { flex: 1; }
.inputrow .unit { color: var(--muted); font-weight: 700; min-width: 3.2em; text-align: right; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .8rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem .8rem; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn { min-height: 50px; padding: .6rem 1.1rem; border-radius: 12px; border: 1.5px solid var(--border); background: var(--panel2); color: var(--text); font-weight: 800; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.sm { min-height: 40px; padding: .35rem .8rem; font-size: .9rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; }
.seg button { min-height: 46px; padding: 0 .9rem; border: 0; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tabs button { min-height: 44px; padding: 0 .9rem; border-radius: 999px; border: 1.5px solid var(--border); background: var(--panel); color: var(--text); font-weight: 700; cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* Results */
.result { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin: .6rem 0; }
.stat { background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .8rem; }
.stat .lbl { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.stat .val { font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .sub { font-size: .85rem; color: var(--muted); }
.stat.big .val { font-size: 2.3rem; }
.stat.ok { border-color: var(--ok); } .stat.warn { border-color: var(--warn); } .stat.bad { border-color: var(--bad); }
.notice { border-left: 5px solid var(--info); background: var(--panel2); padding: .7rem .9rem; border-radius: 10px; margin: .6rem 0; }
.notice.ok { border-color: var(--ok); } .notice.warn { border-color: var(--warn); } .notice.bad { border-color: var(--bad); }
.notice b { display: block; margin-bottom: .2rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 1rem; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table thead th { position: sticky; top: 0; background: var(--panel); font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.table tr.hl td { background: color-mix(in srgb, var(--accent) 22%, transparent); font-weight: 800; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 700; } .kv dd { margin: 0; }
details.help { margin: .5rem 0; } details.help summary { cursor: pointer; font-weight: 700; color: var(--link); }
.disclaimer { font-size: .8rem; color: var(--muted); margin-top: .8rem; }

/* Pro gate */
.lock { position: relative; border: 1.5px dashed var(--accent); border-radius: var(--radius); padding: 1rem; background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.lock h3 { display: flex; align-items: center; gap: .4rem; }
.lock ul { margin: .3rem 0 .6rem 1.1rem; padding: 0; }
.blur { filter: blur(4px); pointer-events: none; user-select: none; opacity: .7; }

/* Quiz */
.q-opt { display: block; width: 100%; text-align: left; min-height: 54px; padding: .7rem .9rem; margin: .4rem 0; border-radius: 12px; border: 1.5px solid var(--border); background: var(--panel2); cursor: pointer; font-size: 1.05rem; }
.q-opt[data-state=correct] { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, var(--panel2)); }
.q-opt[data-state=wrong] { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, var(--panel2)); }
.q-opt:disabled { cursor: default; }
.progress { height: 8px; background: var(--panel2); border-radius: 999px; overflow: hidden; margin: .4rem 0 .8rem; }
.progress > div { height: 100%; background: var(--accent); }

/* Alarm list */
.alarm { border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem; margin: .5rem 0; background: var(--panel2); }
.alarm .code { font-weight: 900; color: var(--accent); }
.alarm ul { margin: .3rem 0 0 1.1rem; padding: 0; font-size: .95rem; }

/* Bottom nav (phones) */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--panel); border-top: 1px solid var(--border); padding: .3rem .3rem calc(.3rem + env(safe-area-inset-bottom)); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: .1rem; min-height: 52px; justify-content: center; font-size: .72rem; font-weight: 800; text-decoration: none; color: var(--muted); border-radius: 10px; }
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a[aria-current=page] { color: var(--accent); }
@media (min-width: 900px) { .bottomnav { display: none; } main.app { padding-bottom: 2rem; } }
.embedded .bottomnav, .embedded .topbar { display: none; }

.toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 12px; font-weight: 700; z-index: 50; box-shadow: var(--shadow); max-width: 92vw; display: flex; gap: .8rem; align-items: center; }
.toast button { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: .35rem .7rem; font-weight: 800; cursor: pointer; }

/* Landing / static pages */
.site { max-width: 1040px; margin: 0 auto; padding: 1rem .9rem 3rem; }
.site header.nav { display: flex; align-items: center; gap: 1rem; padding: .4rem 0 1rem; flex-wrap: wrap; }
.site header.nav nav { display: flex; gap: .3rem 1rem; flex-wrap: wrap; font-weight: 700; }
.site header.nav nav a { color: var(--text); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.hero-l { padding: 1.5rem 0 1rem; }
.hero-l h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
.hero-l p.lead { font-size: 1.2rem; color: var(--muted); max-width: 46rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .9rem; align-items: start; }
.price { font-size: 2.2rem; font-weight: 900; }
.pricing ul { padding-left: 1.1rem; margin: .4rem 0 .8rem; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.shots img { border-radius: 12px; border: 1px solid var(--border); background: var(--panel); }
.faq details { border-bottom: 1px solid var(--border); padding: .6rem 0; }
.faq summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
footer.site-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.prose { max-width: 48rem; } .prose li { margin: .25rem 0; }
.embed { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; background: var(--panel); margin: 1rem 0; }

/* Print: job report */
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .topbar, .bottomnav, .toast, .no-print, .toolhead .back { display: none !important; }
  main.app { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #999; break-inside: avoid; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
