/* BUGI90 shell + themes. Default = dark (current). */
:root,html[data-theme="dark"]{
  color-scheme:dark;
  --site-bg:#091d2e;
  --site-panel:#123047;
  --site-ink:#f4f8fb;
  --site-muted:#bfd3e2;
  --site-cyan:#76dff2;
  --site-line:#3e647d;
  --site-btn:#0b2438;
  --site-btn-ink:#f4f8fb;
  --site-on-cyan:#072338;
}
html[data-theme="light"]{
  color-scheme:light;
  --site-bg:#e7f0f6;
  --site-panel:#ffffff;
  --site-ink:#0a2438;
  --site-muted:#3f5c6e;
  --site-cyan:#0b7c90;
  --site-line:#b7cedc;
  --site-btn:#eef6fa;
  --site-btn-ink:#0a2438;
  --site-on-cyan:#ffffff;
}
html{background:var(--site-bg)}
body{margin:0;background:var(--site-bg);color:var(--site-ink);font:16px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif}
.site-header{background:var(--site-panel);border-bottom:2px solid var(--site-cyan);padding:16px 20px}
.site-wrap{max-width:1180px;margin:auto}
.site-top{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.site-title{margin:0;font-size:clamp(22px,4vw,32px)}.site-title a{color:var(--site-ink);text-decoration:none}.site-title span{color:var(--site-cyan)}
.site-sub{margin:2px 0 8px;color:var(--site-muted)}.site-help{margin:0 0 10px;font-size:14px;color:var(--site-muted)}
.site-controls{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.site-lang{display:flex;gap:4px;align-items:center}
.site-lang button{background:var(--site-btn);color:var(--site-btn-ink);border:1px solid var(--site-line);border-radius:8px;padding:6px 12px;cursor:pointer;min-height:40px;font:inherit}
.site-lang button[aria-pressed=true]{background:var(--site-cyan);color:var(--site-on-cyan);border-color:var(--site-cyan)}
/* Theme toggle: pill switch, visually distinct from CA|ES text buttons */
.site-theme-switch{
  position:relative;display:inline-flex;align-items:center;justify-content:space-between;
  width:72px;height:36px;padding:0 8px;border:0;border-radius:999px;cursor:pointer;
  background:linear-gradient(90deg,#1a3350,#0d2236);box-shadow:inset 0 0 0 1px rgba(118,223,242,.35);
  transition:background .25s ease;flex-shrink:0;
}
.site-theme-switch.is-light{
  background:linear-gradient(90deg,#f2c14e,#7ec8e3);box-shadow:inset 0 0 0 1px rgba(10,36,56,.12);
}
.site-theme-icon{font-size:14px;line-height:1;z-index:1;pointer-events:none;opacity:.85}
.site-theme-sun{color:#ffe29a}
.site-theme-moon{color:#c5e8f5}
.site-theme-switch.is-light .site-theme-sun{color:#7a4e00;opacity:1}
.site-theme-switch.is-light .site-theme-moon{opacity:.45}
.site-theme-switch.is-dark .site-theme-moon{opacity:1}
.site-theme-switch.is-dark .site-theme-sun{opacity:.45}
.site-theme-knob{
  position:absolute;top:4px;left:4px;width:28px;height:28px;border-radius:50%;
  background:#f4f8fb;box-shadow:0 1px 4px rgba(0,0,0,.35);
  transition:transform .25s ease;z-index:2;pointer-events:none;
}
.site-theme-switch.is-light .site-theme-knob{transform:translateX(0);background:#fff}
.site-theme-switch.is-dark .site-theme-knob{transform:translateX(36px);background:#76dff2}
.site-theme-switch:focus-visible{outline:3px solid var(--site-cyan);outline-offset:3px}
.site-nav{display:flex;flex-wrap:wrap;gap:6px}.site-nav a{color:var(--site-cyan);text-decoration:none;border:1px solid var(--site-line);border-radius:999px;padding:4px 12px;font-size:14px}
.site-nav a.active{background:var(--site-cyan);color:var(--site-on-cyan)}
.site-main{padding:20px 12px}
.site-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px}
.site-card{background:var(--site-panel);border:1px solid var(--site-line);border-radius:14px;padding:18px;color:var(--site-ink);text-decoration:none;display:block}
.site-card:hover{border-color:var(--site-cyan)}.site-card h2{margin:0 0 6px;color:var(--site-cyan);font-size:20px}.site-card p{margin:0;color:var(--site-muted)}
.site-footer{border-top:1px solid var(--site-line);padding:20px;text-align:center;font-size:14px;color:var(--site-muted)}
.site-footer a{color:var(--site-cyan)}.site-legal{display:flex;justify-content:center;flex-wrap:wrap;gap:16px;margin-top:8px}
@media(max-width:600px){.site-header{padding:12px}#bugi-app{padding:14px!important;border-radius:0!important}}
@media print{.site-header,.site-footer,.site-help,.openhelp,#site-openhelp,.viewer-warning{display:none!important}body{background:#fff;color:#000}}

/* Light theme for #bugi-app (overrides inline dark styles; site.css loads after) */
html[data-theme="light"] #bugi-app{
  --bg:#f4f8fb;
  --panel:#ffffff;
  --ink:#0a2438;
  --muted:#3f5c6e;
  --cyan:#0b7c90;
  --line:#b7cedc;
  background:var(--bg);
  color:var(--ink);
  box-shadow:0 1px 0 rgba(10,36,56,.06);
}
html[data-theme="light"] #bugi-app button{
  background:#e7f1f7;
  color:var(--ink);
  border-color:var(--line);
}
html[data-theme="light"] #bugi-app button.primary{
  background:var(--cyan);
  color:#fff;
  border-color:var(--cyan);
}
html[data-theme="light"] #bugi-app input,
html[data-theme="light"] #bugi-app select,
html[data-theme="light"] #bugi-app textarea{
  background:#fff;
  color:var(--ink);
  border-color:var(--line);
}
html[data-theme="light"] #bugi-app .guide,
html[data-theme="light"] #bugi-app .openhelp,
html[data-theme="light"] #bugi-app .estimate,
html[data-theme="light"] #bugi-app .observed{
  background:#eef5f9;
  border-color:var(--line);
  color:var(--muted);
}
html[data-theme="light"] #bugi-app .dashboard{
  background:linear-gradient(110deg,#e3eef5,#f7fafc);
  border-color:var(--line);
}
html[data-theme="light"] #bugi-app .door{
  background:linear-gradient(140deg,#e8f3f8,#f7fbfd);
  border-color:var(--line);
}
html[data-theme="light"] #bugi-app .door.special{
  background:linear-gradient(140deg,#f3e4e9,#faf4f6);
  border-color:#c99aab;
}
html[data-theme="light"] #bugi-app .door[open]{
  background:var(--panel);
  border-color:var(--cyan);
}
html[data-theme="light"] #bugi-app .door[open]>summary{
  background:#e7f1f7;
}
html[data-theme="light"] #bugi-app .door.special[open]>summary{
  background:#f0dde4;
}
html[data-theme="light"] #bugi-app .box,
html[data-theme="light"] #bugi-app .measure{
  background:#f7fafc;
  border-color:var(--line);
}
html[data-theme="light"] #bugi-app .example{
  background:#eef5f9;
  border-left-color:var(--cyan);
  color:var(--ink);
}
html[data-theme="light"] #bugi-app .complete,
html[data-theme="light"] #bugi-app .estimate .complete{
  background:#e4f3ee;
  color:var(--ink);
}
html[data-theme="light"] #bugi-app .progress{background:#d7e6ef}
html[data-theme="light"] #bugi-app .meta,
html[data-theme="light"] #bugi-app .small,
html[data-theme="light"] #bugi-app .review{color:var(--muted)}
html[data-theme="light"] #bugi-app .audience{
  background:var(--cyan);
  color:#fff;
}
html[data-theme="light"] #bugi-app .savings-stats>div{
  background:linear-gradient(135deg,#e8f3f8,#f7fbfd);
  border-color:var(--line);
}
html[data-theme="light"] #bugi-app .savings-stats>div:nth-child(n+3){
  background:linear-gradient(135deg,#e5f4ef,#f5fbf8);
  border-color:#9ec4b6;
}
html[data-theme="light"] #bugi-app .savings-stats small{color:var(--ink)}
html[data-theme="light"] #bugi-app .savings-stats span{color:var(--muted)}
html[data-theme="light"] #bugi-app .viewer-warning{
  background:#f8e9ed;
  border-color:#d79ab0;
  color:#5a2436;
}
html[data-theme="light"] #bugi-app header{border-bottom-color:var(--line)}
html[data-theme="light"] #bugi-app footer{border-top-color:var(--line);color:var(--muted)}
html[data-theme="light"] #bugi-app .settings,
html[data-theme="light"] #bugi-app .about{
  border-color:var(--line);
}
