:root {
  --navy: #102a43;
  --navy-2: #183b5b;
  --blue: #1f5f99;
  --sky: #69b4e5;
  --ink: #17212b;
  --muted: #63717d;
  --line: #dce4eb;
  --surface: #f4f7fa;
  --surface-2: #eaf1f6;
  --white: #fff;
  --green: #18794e;
  --amber: #a15c00;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(16, 42, 67, .11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 15px/1.5 Arial, Helvetica, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; color: var(--navy); font-size: 1.65rem; letter-spacing: -.025em; }
h2 { margin-bottom: 8px; color: var(--navy); font-size: clamp(1.75rem, 3vw, 2.65rem); line-height: 1.1; letter-spacing: -.035em; }
h3 { margin-bottom: 6px; color: var(--navy); font-size: 1.18rem; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 252px;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  background: var(--navy);
  color: var(--white);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; color: var(--white); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--sky); color: var(--navy); font-size: .75rem; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand small { color: #b9cfdf; font-size: .75rem; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 0; border-radius: 9px; background: transparent; color: #c6d8e6; text-align: left; font-weight: 700; }
.nav-item span { width: 22px; color: #8dbbd8; font-size: 1.15rem; text-align: center; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.1); color: var(--white); }
.sidebar-foot { margin-top: auto; padding: 15px; border: 1px solid rgba(255,255,255,.14); border-radius: 11px; background: rgba(255,255,255,.06); }
.sidebar-foot p, .sidebar-foot span { margin: 0; color: #aac4d6; font-size: .72rem; }
.sidebar-foot strong { display: block; margin: 3px 0; font-size: 1rem; }

.workspace { min-height: 100vh; margin-left: 252px; }
.topbar { min-height: 92px; display: flex; align-items: center; gap: 24px; padding: 18px clamp(20px, 4vw, 54px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.crumb { margin-bottom: 2px; color: var(--muted); font-size: .77rem; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.global-search { width: min(30vw, 320px); display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.global-search input { width: 100%; height: 42px; border: 0; outline: 0; background: transparent; }
.menu-button { display: none; border: 0; background: transparent; color: var(--navy); font-size: 1.4rem; }

.view { display: none; padding: 34px clamp(20px, 4vw, 54px) 70px; }
.view.active { display: block; }
.eyebrow { margin-bottom: 8px; color: var(--sky); font-size: .72rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow.dark { color: var(--blue); }
.button { min-height: 42px; padding: 9px 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 800; }
.button.primary { background: var(--blue); color: var(--white); }
.button.primary:hover { background: #174a78; }
.button.ghost { border-color: var(--line); background: var(--white); color: var(--navy); }
.button.white { background: var(--white); color: var(--navy); }
.button.transparent { border-color: rgba(255,255,255,.35); background: transparent; color: var(--white); }
.button.wide { width: 100%; }
.text-button { padding: 5px; border: 0; background: transparent; color: var(--blue); font-weight: 800; }

.welcome { display: grid; grid-template-columns: 1fr 270px; gap: clamp(30px, 5vw, 70px); padding: clamp(32px, 5vw, 58px); border-radius: 20px; background: linear-gradient(135deg, #0e2740, #1f5f99); color: var(--white); box-shadow: var(--shadow); }
.welcome h2 { max-width: 720px; color: var(--white); font-size: clamp(2rem, 4vw, 3.6rem); }
.welcome p:not(.eyebrow) { max-width: 760px; color: #d7e7f3; font-size: 1.04rem; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.template-score { align-self: center; padding: 24px; border: 1px solid rgba(255,255,255,.17); border-radius: 14px; background: rgba(255,255,255,.08); }
.template-score span, .template-score small { display: block; color: #c8dce9; }
.template-score strong { display: block; margin: 4px 0; font-size: 2.6rem; }
.progress { height: 7px; overflow: hidden; border-radius: 10px; background: rgba(100,128,149,.25); }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--sky); }
.template-score .progress { margin: 10px 0 12px; background: rgba(255,255,255,.18); }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0 42px; }
.metrics article { padding: 22px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.metrics span, .metrics small { display: block; color: var(--muted); }
.metrics strong { display: block; margin: 4px 0; color: var(--navy); font-size: 2rem; }
.metrics strong.alert { color: var(--red); }

.section-title, .panel-head, .view-heading, .step-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-title { margin: 42px 0 18px; }
.section-title h2, .view-heading h2 { margin-bottom: 0; }
.view-heading { margin-bottom: 24px; }
.view-heading p:not(.eyebrow), .step-head p { margin-bottom: 0; color: var(--muted); }
.view-heading.compact { align-items: center; }
.save-state { display: flex; align-items: center; gap: 8px; color: var(--green); font-weight: 800; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }

.community-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.community-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: 0 8px 24px rgba(16,42,67,.06); }
.community-image { height: 130px; background-size: cover; background-position: center; }
.community-image.default { background: linear-gradient(135deg, #b9cbd8, #eaf1f6); }
.community-body { padding: 20px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.community-body h3 { margin: 10px 0 3px; font-size: 1.35rem; }
.community-body p { margin-bottom: 18px; color: var(--muted); font-size: .87rem; }
.tag { display: inline-flex; padding: 4px 8px; border-radius: 20px; background: #e9f6ef; color: var(--green); font-size: .7rem; font-weight: 900; text-transform: uppercase; }
.tag.draft { background: #fff2dd; color: var(--amber); }
.community-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 15px 0; }
.community-meta span { color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.community-meta strong { display: block; color: var(--navy); font-size: .86rem; }
.card-actions { display: flex; gap: 8px; margin-top: 14px; }
.card-actions button { flex: 1; }

.two-column { display: grid; grid-template-columns: 1.35fr .8fr; gap: 18px; margin-top: 34px; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.attention-list { margin-top: 14px; }
.attention-item { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.attention-item:first-child { border-top: 0; }
.attention-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #fff0ee; color: var(--red); font-weight: 900; }
.attention-item strong, .attention-item small { display: block; }
.attention-item small { color: var(--muted); }
.attention-item time { color: var(--muted); font-size: .74rem; }
.quick-steps { display: grid; gap: 17px; padding: 0; list-style: none; }
.quick-steps li { display: flex; gap: 12px; }
.quick-steps li > span { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--blue); font-weight: 900; }
.quick-steps strong, .quick-steps small { display: block; }
.quick-steps small { color: var(--muted); }

.filter-row { display: flex; align-items: end; gap: 12px; margin-bottom: 22px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.filter-row.embedded { margin: 10px 0 18px; padding: 0; border: 0; }
.filter-row label, .form-grid label, dialog label { display: grid; gap: 6px; }
.filter-row label > span, .form-grid label > span, dialog label > span { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.filter-row .grow { flex: 1; }
input, select { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #cfdbe4; border-radius: 8px; background: var(--white); color: var(--ink); }
input:focus, select:focus { outline: 3px solid rgba(31,95,153,.16); border-color: var(--blue); }

.builder-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.builder-main, .builder-summary { border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: 0 8px 24px rgba(16,42,67,.05); }
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); padding: 20px 26px; border-bottom: 1px solid var(--line); }
.stepper button { display: grid; justify-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font-size: .76rem; font-weight: 800; }
.stepper button span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); }
.stepper button.active { color: var(--blue); }
.stepper button.active span { background: var(--blue); color: var(--white); }
.builder-step { display: none; min-height: 480px; padding: 28px; }
.builder-step.active { display: block; }
.step-head { align-items: flex-start; margin-bottom: 22px; }
.step-head > div > span { color: var(--blue); font-size: .73rem; font-weight: 900; text-transform: uppercase; }
.template-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.radio-card { position: relative; display: block; padding: 17px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.radio-card input { position: absolute; top: 12px; right: 12px; width: auto; min-height: auto; }
.radio-card strong, .radio-card small { display: block; padding-right: 22px; }
.radio-card small { margin-top: 4px; color: var(--muted); }
.radio-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,95,153,.1); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.span-2 { grid-column: span 2; }
.builder-footer { display: flex; align-items: center; justify-content: space-between; padding: 17px 26px; border-top: 1px solid var(--line); }
.builder-footer span { color: var(--muted); font-size: .8rem; font-weight: 800; }
.builder-summary { position: sticky; top: 18px; padding: 23px; }
.builder-summary dl { margin: 24px 0; }
.builder-summary dl div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.builder-summary dt { color: var(--muted); }
.builder-summary dd { margin: 0; color: var(--navy); font-weight: 800; text-align: right; }
.readiness > div:first-child { display: flex; justify-content: space-between; margin-bottom: 8px; }
.blocker-box { margin-top: 20px; padding: 14px; border-left: 4px solid var(--amber); border-radius: 8px; background: #fff7e9; }
.blocker-box strong { color: #7b4800; }
.blocker-box p { margin: 3px 0 0; color: #87622d; font-size: .78rem; }

.selection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.compact-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.select-card { position: relative; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.select-card.selected { border-color: var(--blue); background: #f1f7fb; }
.select-card input { position: absolute; top: 13px; right: 13px; width: auto; min-height: auto; }
.select-card strong, .select-card small { display: block; padding-right: 24px; }
.select-card small { margin-top: 3px; color: var(--muted); }
.product-picks .select-card { min-height: 106px; }
.product-picks .select-card .mini-status { margin-top: 10px; }
.mini-status { display: inline-flex; width: fit-content; padding: 3px 7px; border-radius: 20px; background: #e9f6ef; color: var(--green); font-size: .65rem; font-weight: 900; }
.mini-status.warning { background: #fff2dd; color: var(--amber); }

.collection-picks, .collections-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.collection-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.collection-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,95,153,.1); }
.collection-card img { width: 100%; height: 130px; display: block; object-fit: cover; }
.collection-card-body { padding: 14px; }
.collection-card-body p { margin: 2px 0 12px; color: var(--muted); font-size: .78rem; }
.collection-card-body label { display: flex; align-items: center; gap: 7px; color: var(--blue); font-weight: 800; }
.collection-card-body input { width: auto; min-height: auto; }

.review-summary { display: grid; gap: 16px; }
.review-card { padding: 18px; border: 1px solid var(--line); border-radius: 11px; }
.review-card header { display: flex; justify-content: space-between; gap: 18px; }
.review-card ul { margin: 12px 0 0; padding-left: 20px; color: var(--muted); }
.review-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }

.product-library { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.product-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.product-card img { width: 100%; height: 150px; object-fit: contain; padding: 14px; background: #f8fafc; }
.product-card-body { padding: 15px; }
.product-card .category { color: var(--blue); font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.product-card h3 { margin: 5px 0 2px; font-size: 1rem; }
.product-card p { margin-bottom: 12px; color: var(--muted); font-size: .78rem; }
.product-facts { display: grid; gap: 5px; font-size: .74rem; }
.product-facts div { display: flex; justify-content: space-between; gap: 8px; }
.product-facts span { color: var(--muted); }

.standards-table, .approval-table { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.table-row { display: grid; grid-template-columns: 60px 1.2fr 2fr 130px 90px; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.table-row:first-child { border-top: 0; }
.table-row.header { background: var(--surface-2); color: var(--muted); font-size: .7rem; font-weight: 900; text-transform: uppercase; }
.table-row small { color: var(--muted); }
.approval-table .table-row { grid-template-columns: 1.15fr 1fr 2fr 130px 110px; }

dialog { width: min(94vw, 560px); border: 0; border-radius: 16px; padding: 0; box-shadow: 0 30px 100px rgba(10,30,48,.35); }
dialog::backdrop { background: rgba(8,22,35,.68); }
.dialog-card { display: grid; gap: 16px; padding: 27px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; }
.dialog-head h2 { margin-bottom: 0; font-size: 1.7rem; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface); color: var(--navy); font-size: 1.25rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
#previewDialog { width: min(96vw, 1000px); }
.preview-shell { padding: 28px; }
.catalog-preview { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; }
.preview-hero { padding: 44px; background: linear-gradient(135deg,#102a43,#1f5f99); color: var(--white); }
.preview-hero h2 { color: var(--white); font-size: 2.7rem; }
.preview-section { padding: 28px; border-top: 1px solid var(--line); }
.preview-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.preview-chip { padding: 6px 10px; border-radius: 20px; background: var(--surface-2); color: var(--navy); font-size: .76rem; font-weight: 800; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; padding: 12px 16px; border-radius: 9px; background: var(--navy); color: var(--white); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: none; }
.empty { grid-column: 1 / -1; padding: 42px; border: 1px dashed #b8c7d3; border-radius: 12px; color: var(--muted); text-align: center; }

@media (max-width: 1180px) {
  .product-library { grid-template-columns: repeat(3, 1fr); }
  .community-grid { grid-template-columns: repeat(2, 1fr); }
  .selection-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  .workspace { margin-left: 0; }
  .menu-button { display: block; }
  .global-search { display: none; }
  .welcome, .two-column, .builder-layout { grid-template-columns: 1fr; }
  .builder-summary { position: static; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 650px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .top-actions { width: 100%; margin-left: 0; }
  .top-actions .button { flex: 1; }
  .view { padding-inline: 16px; }
  .community-grid, .product-library, .selection-grid, .compact-cards, .collection-picks, .collections-grid, .template-choice, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .stepper { overflow-x: auto; grid-template-columns: repeat(5, 90px); }
  .filter-row, .view-heading, .section-title, .panel-head { align-items: stretch; flex-direction: column; }
  .table-row, .approval-table .table-row { grid-template-columns: 1fr; gap: 3px; }
  .table-row.header { display: none; }
}
@media print {
  .sidebar, .topbar, .builder-footer, .builder-summary, .review-actions { display: none !important; }
  .workspace { margin: 0; }
  .view { display: none !important; }
  #builderView { display: block !important; padding: 0; }
  .builder-step { display: none !important; }
  [data-step-panel="5"] { display: block !important; }
  .builder-main { border: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
