:root {
  --ink: #142226;
  --lagoon: #0e4d5c;
  --deep: #0c333c;
  --water: #1a7f93;
  --foam: #e7f3f5;
  --sand: #f6f1e8;
  --paper: #fffdf9;
  --copper: #a36b3c;
  --line: #e4dacb;
  --danger: #8d2f2f;
  --ok: #1e6b45;
  --surface: #fff;
  --muted: #4d5c60;
  --shadow: 0 16px 40px rgba(20, 34, 38, 0.06);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--sand);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
body.is-guest {
  background:
    linear-gradient(165deg, rgba(12, 51, 60, 0.18), rgba(246, 241, 232, 0.42) 46%, rgba(246, 241, 232, 0.78)),
    var(--poolscape) center 42% / cover no-repeat fixed;
}
body.is-dark {
  --ink: #e7eef0;
  --lagoon: #9fd7e2;
  --deep: #071216;
  --water: #7ec9d6;
  --foam: #1a3038;
  --sand: #10181c;
  --paper: #182226;
  --copper: #e2b48a;
  --line: #314148;
  --danger: #f0a3a3;
  --ok: #8ddebe;
  --surface: #121c20;
  --muted: #b7c6cb;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
  color: var(--ink);
  background: var(--sand);
}
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; display: block; }
.mark { width: 36px; height: 36px; flex: none; display: block; background: none; border-radius: 10px; box-shadow: none; }
h1, h2, h3 { font-family: Palatino, "Iowan Old Style", Georgia, serif; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 2rem; margin: 0; }
h2 { margin: 0 0 12px; font-size: 1.25rem; }
a { color: var(--lagoon); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--deep); color: #e7f1f3; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.brand strong { display: block; font-family: Palatino, Georgia, serif; font-size: 1.15rem; }
.brand small { color: #b7c9ce; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a { color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 8px; display: flex; align-items: center; gap: 8px; }
.sidebar nav a:hover, .sidebar nav a.is-on { background: rgba(255,255,255,.08); }
.sidebar-foot { margin-top: auto; }
.sidebar-foot p { margin: 0; }
.sidebar .fine { color: #b7c9ce; }
.theme-switch { display: flex; gap: 6px; margin: 0 0 12px; }
.theme-switch button { flex: 1; background: transparent; color: #e7f1f3; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 6px 8px; cursor: pointer; }
.theme-switch button.is-on { background: rgba(255,255,255,.14); border-color: #f4efe6; }
.theme-choice { display: flex; gap: 8px; }
.linkish { background: none; border: 0; color: #f4efe6; padding: 0; text-decoration: underline; cursor: pointer; }
main { padding: 0 32px 64px; }
.poolscape {
  height: 196px;
  margin: 0 -32px 18px;
  background:
    linear-gradient(180deg, rgba(12, 51, 60, 0.06), rgba(12, 51, 60, 0) 28%, rgba(246, 241, 232, 0) 70%, var(--sand) 100%),
    var(--pool-band) center / cover no-repeat;
}
.page-head, .row-between { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.page-head { margin-bottom: 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; color: var(--copper); margin: 0 0 6px; }
.lede, .fine { color: var(--muted); }
.fine { font-size: 0.86rem; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project-card { display: block; color: inherit; text-decoration: none; }
.project-card p { margin: 8px 0 0; }
.narrow { max-width: 460px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; margin-bottom: 12px; }
.field input, .field select, .field textarea, .inline input, .inline select, .quote input, .quote select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 12px; width: 100%;
}
.grid-2, .grid-3 { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.button { background: var(--lagoon); color: white; border: 0; border-radius: 999px; padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-block; }
.button.ghost { background: transparent; color: var(--lagoon); border: 1px solid var(--lagoon); }
.button.danger { background: var(--danger); }
.button:disabled { opacity: 0.6; }
.inline { display: flex; gap: 8px; align-items: center; }
.gap { margin: 8px 0 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { text-decoration: none; padding: 8px 12px; border-radius: 999px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; background: var(--paper); }
.tabs a.is-on { background: #1a7f93; color: white; }
.pill { background: var(--foam); color: var(--lagoon); border-radius: 999px; padding: 3px 8px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.flash { background: #e5f4ea; border: 1px solid #b7dfc4; padding: 10px 12px; border-radius: 10px; }
.flash.bad { background: #fdecec; border-color: #e4b4b4; }
.checks { border: 1px solid var(--line); border-radius: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; margin: 12px 0; }
.checks.tight { border: 0; padding: 0; display: flex; flex-direction: column; }
.check { display: flex; gap: 8px; align-items: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 8px; vertical-align: top; }
th { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.quote input, .quote select { min-width: 70px; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; background: transparent; }
.login-hero {
  color: #f4efe6;
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(165deg, rgba(12, 51, 60, 0.62) 0%, rgba(12, 51, 60, 0.22) 46%, rgba(12, 51, 60, 0.8) 100%),
    var(--poolscape) center 46% / cover no-repeat;
}
.login-hero .eyebrow { color: #f3d7b4; }
.login-hero h1, .login-hero p { text-shadow: 0 1px 14px rgba(12, 51, 60, 0.28); }
.login-hero h1 { font-size: 3rem; line-height: 1.05; max-width: 12ch; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(420px, 100%); }
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.design-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.toolbar button, .toolbar select { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 10px; cursor: pointer; }
.toolbar button.is-on, .toolbar button.primary { background: #1a7f93; color: white; border-color: #1a7f93; }
.toolbar button:disabled { opacity: 0.55; cursor: wait; }
.status-line { min-height: 1.2em; margin: 0 0 8px; }
.toolbar.secondary { align-items: center; }
.render-review h2 { margin-top: 0; }
.issue { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.issue .field { margin-bottom: 8px; }
.issue .fine { display: block; font-weight: 400; }
.issue-actions { display: flex; gap: 8px; align-items: center; }
.suggest-note { margin: 8px 0 0; }
.toolbar label { display: flex; gap: 6px; align-items: center; font-size: 0.86rem; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.wizard-steps a { text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 6px; }
.project-card { background: linear-gradient(180deg, rgba(231, 243, 245, 0.95), var(--paper) 46px); }
.card-title { display: inline-flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--water); }
.wizard-steps a.is-on { background: #1a7f93; color: white; border-color: #1a7f93; }
.wizard-steps a.is-done { border-color: var(--lagoon); }
body.is-finish .poolscape { display: none; }
.finish-preview { position: relative; z-index: 1; margin: 0 -32px 18px; height: clamp(300px, 42vh, 480px); background: #d7eef2; border: 0; border-radius: 0; overflow: hidden; }
.finish-preview figcaption { position: absolute; left: 20px; bottom: 14px; margin: 0; padding: 6px 12px; background: rgba(255, 253, 249, 0.9); border-radius: 999px; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: #5c6b6f; }
.finish-scene { display: block; width: 100%; height: 100%; }
.finish-empty { margin: 0; min-height: 180px; display: grid; place-items: center; padding: 32px; text-align: center; }
.finish-scene .deck { fill: var(--preview-deck); }
.finish-scene .coping { fill: var(--preview-coping); stroke: var(--preview-coping); stroke-linejoin: round; }
.finish-scene .waterline { fill: none; stroke: var(--preview-waterline); stroke-linejoin: round; }
.finish-scene .basin { fill: var(--preview-interior); }
.render-record { margin-top: 16px; }
.build-list { margin-top: 8px; }
.finish-scene .accent { fill: var(--preview-accent); }
.finish-scene .fitting { fill: var(--preview-fittings); stroke: rgba(20, 34, 38, 0.28); stroke-width: 1.5; }
.finish-scene .glow { fill: var(--preview-light); opacity: 0.7; }
.finish-preview.is-skip-accent .accent { display: none; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 12px 0; }
.sku-add { margin-top: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.product-card { position: relative; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface); cursor: pointer; }
.product-card input { position: absolute; opacity: 0; }
.product-card:has(input:checked), .product-card.is-picked { border-color: var(--lagoon); box-shadow: 0 0 0 2px var(--lagoon); }
.swatch { display: block; height: 42px; border-radius: 8px; border: 1px solid var(--line); }
.part { font-weight: 650; }
.compare-stack { display: flex; flex-direction: column; gap: 12px; }
.original-drawing { margin: 0; }
.original-drawing figcaption { font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.original-drawing img, .plan-still { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.original-drawing[hidden] { display: none !important; }
#plan { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); touch-action: none; cursor: crosshair; background: #f6f1e8; }
.side-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.qty-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qty-grid div { background: var(--foam); border-radius: 10px; padding: 8px; }
.qty-grid span { display: block; font-size: 0.75rem; color: var(--muted); }
.file-row, figure { margin: 10px 0; }
.file-row img, .proposal img, .card img { max-width: 100%; border-radius: 12px; }
.picture-frame { display: block; width: 100%; margin: 0 0 10px; padding: 0; border: 0; background: none; color: var(--lagoon); text-align: left; cursor: zoom-in; }
.picture-frame img { display: block; width: 100%; }
.picture-hint { display: inline-block; margin-top: 8px; font-size: 0.86rem; text-decoration: underline; }
.picture-viewer { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; margin: 0; background: #0c333c; }
.picture-viewer[hidden] { display: none; }
.picture-viewer img { max-width: 100vw; max-height: 100vh; width: auto; height: auto; object-fit: contain; border-radius: 0; background: transparent; }
.picture-viewer:fullscreen { width: 100%; height: 100%; background: #0c333c; }
.picture-close { position: absolute; top: 16px; right: 16px; z-index: 1; background: white; color: var(--deep); border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer; }
body.picture-open { overflow: hidden; }
.privacy { background: #f8f1e4; border-left: 4px solid var(--copper); padding: 10px 12px; }
.proposal { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 28px; max-width: 860px; }
.proposal-head { display: flex; gap: 16px; align-items: center; border-bottom: 3px solid var(--lagoon); padding-bottom: 12px; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.meta div { margin: 0; }
.meta dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.meta dd { margin: 0; }
.total td { font-weight: 700; background: var(--sand); }
.logo-preview { max-height: 64px; }
pre { white-space: pre-wrap; background: #f3efe7; padding: 12px; border-radius: 8px; }
body.is-dark .poolscape {
  background:
    linear-gradient(180deg, rgba(8, 16, 18, 0.2), rgba(8, 16, 18, 0.08) 42%, var(--sand) 100%),
    var(--pool-band) center / cover no-repeat;
}
body.is-dark .button { background: #1a7f93; color: white; }
body.is-dark .button.ghost { background: transparent; color: var(--lagoon); border-color: var(--lagoon); }
body.is-dark .button.danger { background: #8d2f2f; color: white; }
body.is-dark .flash { background: #16352a; border-color: #2d6b4e; }
body.is-dark .flash.bad { background: #3a1c1c; border-color: #8d3d3d; }
body.is-dark .privacy { background: #2a241c; }
body.is-dark pre { background: #10181c; }
body.is-dark .project-card { background: var(--paper); }
body.is-dark .proposal {
  --ink: #142226;
  --sand: #f6f1e8;
  --paper: #fffdf9;
  --line: #e4dacb;
  --muted: #5c6b6f;
  --surface: #fff;
  --foam: #e7f3f5;
  --lagoon: #0e4d5c;
  color: var(--ink);
  background: var(--paper);
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.share-list { margin-top: 16px; }
.plain { padding-left: 18px; }
@media (max-width: 900px) {
  .shell, .login, .design-layout, .grid-2, .grid-3, .checks { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 2; }
  main, .login-hero { padding: 20px; }
  main { padding: 0 20px 48px; }
  .poolscape { margin: 0 -20px 16px; height: 132px; background-attachment: scroll; }
  .finish-preview { margin: 0 -20px 16px; height: clamp(220px, 36vh, 320px); }
  body.is-guest { background-attachment: scroll; }
  .login-hero h1 { font-size: 2.2rem; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media print {
  .sidebar, .noprint, .flash, .tabs, .picture-viewer, .poolscape, .icon-sprite { display: none !important; }
  .finish-preview { height: auto; margin: 0 0 12px; }
  .finish-scene { height: auto; }
  .shell { display: block; }
  main { padding: 0; }
  body, .proposal { background: white; background-image: none; color: #142226; }
  body.is-dark {
    --ink: #142226;
    --sand: white;
    --paper: white;
    --surface: white;
    --muted: #4d5c60;
    --line: #e4dacb;
    --lagoon: #0e4d5c;
    color: #142226;
  }
  .proposal { border: 0; box-shadow: none; max-width: none; }
}
