*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --bg:#f5f0e8;--surface:#fffdf9;--surface-alt:#ede7dc;
  --text:#2c2418;--text-muted:#6b5e4e;--text-light:#9a8b78;
  --accent:#c4652a;--accent-hover:#a85320;--accent-light:#f5d5b8;
  --border:#d6cbb8;--border-light:#e8dfd2;
  --success:#3a7d44;--warning:#b8860b;--danger:#b91c1c;
  --radius:10px;--radius-sm:6px;--shadow:0 2px 8px rgba(44,36,24,.08);--shadow-lg:0 8px 32px rgba(44,36,24,.12);
  --font:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --max-width:960px;
}
html{scroll-behavior:smooth}
body{font-family:var(--font);background:var(--bg);color:var(--text);line-height:1.6;-webkit-font-smoothing:antialiased}
.container{max-width:var(--maxwidth);margin:0 auto;padding:0 20px}
img,svg{max-width:100%;height:auto}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}

/* Header */
.site-header{background:var(--surface);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:100;backdrop-filter:blur(8px);background:rgba(253,253,249,.92)}
.site-header .container{display:flex;align-items:center;justify-content:space-between;height:56px}
.logo{display:flex;align-items:center;gap:8px;font-weight:700;font-size:1.1rem;color:var(--text);text-decoration:none}
.logo:hover{text-decoration:none}
.logo svg{color:var(--accent)}
.main-nav{display:flex;gap:4px}
.main-nav a{padding:6px 12px;border-radius:var(--radius-sm);color:var(--text-muted);font-size:.875rem;font-weight:500}
.main-nav a:hover{background:var(--surface-alt);color:var(--text);text-decoration:none}

/* Hero */
.hero{padding:48px 0 32px;background:linear-gradient(180deg,var(--surface) 0%,var(--bg) 100%)}
.hero h1{font-size:clamp(1.75rem,4vw,2.5rem);font-weight:800;line-height:1.2;margin-bottom:12px}
.hero-sub{font-size:1.1rem;color:var(--text-muted);max-width:560px;margin-bottom:28px}

/* Cards */
.panel-setup-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:24px;box-shadow:var(--shadow)}
.panel-setup-card h2{font-size:1.1rem;margin-bottom:16px}
.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:16px;margin-bottom:16px}
.field label{display:block;font-size:.8rem;font-weight:600;color:var(--text-muted);margin-bottom:4px;text-transform:uppercase;letter-spacing:.04em}
.field select,.field input{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg);color:var(--text);font-size:.95rem;font-family:inherit}
.field select:focus,.field input:focus{outline:2px solid var(--accent);outline-offset:1px;border-color:var(--accent)}
.presets{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.presets-label{font-size:.8rem;color:var(--text-muted);font-weight:600;text-transform:uppercase;letter-spacing:.04em}

/* Buttons */
.btn{display:inline-flex;align-items:center;gap:6px;padding:10px 18px;border-radius:var(--radius-sm);font-size:.9rem;font-weight:600;font-family:inherit;cursor:pointer;border:1px solid transparent;transition:all .15s}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{background:var(--accent-hover);text-decoration:none}
.btn-outline{background:var(--surface);color:var(--text);border-color:var(--border)}
.btn-outline:hover{background:var(--surface-alt);text-decoration:none}
.btn-sm{padding:6px 12px;font-size:.8rem}
.btn-danger{background:var(--danger);color:#fff}
.btn-danger:hover{background:#991b1b;text-decoration:none}

/* Sections */
.section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;flex-wrap:wrap;gap:12px}
.section-header h2{font-size:1.3rem;font-weight:700}
.actions{display:flex;gap:8px}

/* Rooms */
.rooms-section{padding:40px 0}
.rooms-list{display:flex;flex-direction:column;gap:16px}
.room-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.room-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;background:var(--surface-alt);border-bottom:1px solid var(--border);gap:12px;flex-wrap:wrap}
.room-header h3{font-size:1rem;font-weight:600}
.room-header .room-name-input{font-size:1rem;font-weight:600;font-family:inherit;border:none;background:transparent;border-bottom:2px solid var(--accent);padding:2px 4px;color:var(--text);width:200px}
.room-header .room-name-input:focus{outline:none}
.room-body{padding:16px 20px}

/* Fixture table */
.fixture-table{width:100%;border-collapse:collapse;margin-bottom:12px}
.fixture-table th{text-align:left;font-size:.75rem;text-transform:uppercase;letter-spacing:.06em;color:var(--text-muted);padding:8px 12px;border-bottom:1px solid var(--border-light)}
.fixture-table td{padding:8px 12px;border-bottom:1px solid var(--border-light);font-size:.9rem}
.fixture-table input,._fixture-table select{width:100%;padding:6px 8px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg);font-size:.875rem;font-family:inherit;color:var(--text)}
.fixture-table input:focus,._fixture-table select:focus{outline:2px solid var(--accent);outline-offset:0}
.fixture-table .row-actions{width:40px;text-align:right}
.fixture-table .remove-row{background:none;border:none;color:var(--text-light);cursor:pointer;font-size:1.1rem;padding:4px;line-height:1}
.fixture-table .remove-row:hover{color:var(--danger)}
.add-fixture-btn{font-size:.8rem;padding:6px 12px}

/* Panel diagram */
.panel-view-section{padding:40px 0;background:var(--surface)}
.panel-diagram{border:2px solid var(--border);border-radius:var(--radius);overflow:hidden;margin-bottom:16px}
.panel-header{background:var(--accent);color:#fff;padding:16px 20px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px}
.panel-title{font-size:1.1rem;font-weight:700}
.panel-specs{font-size:.85rem;opacity:.9}
.breaker-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:1px;background:var(--border-light)}
.breaker-slot{background:var(--surface);padding:12px;min-height:60px;display:flex;flex-direction:column;justify-content:center}
.breaker-slot.assigned{background:var(--accent-light)}
.breaker-num{font-size:.75rem;font-weight:700;color:var(--text-muted)}
.breaker-label{font-size:.8rem;font-weight:600;color:var(--text);margin-top:2px;word-break:break-word}
.breaker-amps{font-size:.7rem;color:var(--text-light);margin-top:2px}
.breaker-warning{font-size:.7rem;color:var(--warning);margin-top:2px;font-weight:600}

/* Legend */
.legend{display:flex;flex-wrap:wrap;gap:12px;font-size:.8rem;color:var(--text-muted)}
.legend-item{display:flex;align-items:center;gap:6px}
.legend-swatch{width:16px;height:16px;border-radius:3px;border:1px solid var(--border)}
.legend-swatch.assigned{background:var(--accent-light)}
.legend-swatch.empty{background:var(--surface)}

/* Notes */
.notes-section{padding:40px 0}
.notes-section h2{font-size:1.3rem;font-weight:700;margin-bottom:20px}
.notes-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
.note-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow)}
.note-card h3{font-size:.95rem;font-weight:700;margin-bottom:8px;color:var(--accent)}
.note-card p,.note-card li{font-size:.875rem;color:var(--text-muted);line-height:1.6}
.note-card ul{padding-left:18px;margin-top:4px}
.note-card li{margin-bottom:4px}

/* FAQ */
.faq-section{padding:40px 0;background:var(--surface)}
.faq-section h2{font-size:1.3rem;font-weight:700;margin-bottom:20px}
details{background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-sm);margin-bottom:8px;overflow:hidden}
details summary{padding:14px 18px;font-weight:600;cursor:pointer;font-size:.9rem;list-style:none;display:flex;align-items:center;gap:8px}
details summary::-webkit-details-marker{display:none}
details summary::before{content:'+';font-weight:700;color:var(--accent);font-size:1.1rem;flex-shrink:0;width:16px;text-align:center}
details[open] summary::before{content:'−'}
details summary:hover{background:var(--surface-alt)}
details p{padding:0 18px 14px;font-size:.875rem;color:var(--text-muted);line-height:1.6}

/* Empty state */
.empty-state{text-align:center;padding:48px 20px;color:var(--text-muted)}
.empty-state svg{margin-bottom:16px;color:var(--border)}
.empty-state p{margin-bottom:16px;font-size:.95rem}

/* Footer */
.site-footer{background:var(--surface);border-top:1px solid var(--border);padding:32px 0;margin-top:40px}
.footer-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:24px;margin-bottom:20px}
.footer-grid strong{font-size:.85rem;text-transform:uppercase;letter-spacing:.06em;display:block;margin-bottom:8px}
.footer-grid a,.footer-grid p{font-size:.85rem;color:var(--text-muted);display:block;margin-bottom:4px}
.footer-copy{font-size:.8rem;color:var(--text-light);text-align:center;padding-top:16px;border-top:1px solid var(--border-light)}

/* Toast */
.toast{position:fixed;bottom:24px;right:24px;background:var(--text);color:#fff;padding:12px 20px;border-radius:var(--radius-sm);font-size:.875rem;box-shadow:var(--shadow-lg);z-index:1000;opacity:0;transform:translateY(8px);transition:all .3s;pointer-events:none}
.toast.show{opacity:1;transform:translateY(0)}

/* Print */
@media print{
  .site-header,.site-footer,.btn,.actions,.presets,.add-fixture-btn,.remove-row,.empty-state,.faq-section,.notes-section,.hero-sub,.main-nav{display:none!important}
  .hero{padding:0 0 16px}
  .panel-setup-card{box-shadow:none;border:1px solid #ccc}
  .panel-diagram{break-inside:avoid}
  .breaker-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr))}
  body{background:#fff;color:#000}
}

/* Responsive */
@media(max-width:640px){
  .site-header .container{flex-direction:column;height:auto;padding:12px 20px;gap:8px}
  .main-nav{flex-wrap:wrap;justify-content:center}
  .hero{padding:32px 0 20px}
  .form-grid{grid-template-columns:1fr}
  .breaker-grid{grid-template-columns:repeat(auto-fill,minmax(100px,1fr))}
  .fixture-table{font-size:.8rem}
  .fixture-table th,.fixture-table td{padding:6px 8px}
  .room-header .room-name-input{width:140px}
}

/* Accessibility */
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}*,*::before,*::after{transition-duration:.01ms!important}}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
