:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --text: #161a1d;
  --muted: #64748b;
  --line: #dbe2ea;
  --line-strong: #c7d0da;
  --header: #111820;
  --header-text: #f8fafc;
  --accent: #F59E0B;
  --accent-strong: #D97706;
  --success: #15803d;
  --danger: #b91c1c;
  --warning-bg: #FFF7ED;
  --warning-text: #9A3412;
  --shadow: 0 14px 40px rgba(15, 23, 42, .08);
  --radius: 14px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0b1117;
  --surface: #131c25;
  --surface-2: #18232e;
  --surface-3: #202d39;
  --text: #edf2f7;
  --muted: #9aa9ba;
  --line: #2b3a48;
  --line-strong: #405263;
  --header: #070c11;
  --header-text: #f8fafc;
  --warning-bg: #302115;
  --warning-text: #FDBA74;
  --shadow: 0 14px 40px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 1000;
  background: var(--accent);
  color: #111820;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 700;
}
.skip-link:focus { top: 16px; }

.app-header {
  min-height: 78px;
  padding: 12px clamp(16px, 3vw, 44px);
  background: var(--header);
  color: var(--header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-area { min-width: 330px; flex: 0 1 520px; }
.brand-logo { display: block; height: 55px; width: min(100%, 520px); object-fit: contain; object-position: left center; }
.brand-logo-light { display: none; }
html[data-theme="light"] .brand-logo-dark { display: block; }
html[data-theme="light"] .brand-logo-light { display: none; }
html[data-theme="dark"] .brand-logo-dark { display: block; }
html[data-theme="dark"] .brand-logo-light { display: none; }
.header-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; min-width: 0; }
.header-actions .btn { white-space: nowrap; }

.ui-icon { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; overflow: visible; }
.button-arrow { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn, .icon-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 13px;
  font-weight: 700;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.btn:hover, .icon-btn:hover { transform: translateY(-1px); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(245,158,11,.28);
  outline-offset: 1px;
}
.btn-primary { background: var(--accent); color: #111820; border-color: var(--accent); }
.btn-primary:hover { background: #FFAD1F; }
.btn-secondary { background: var(--header); color: #fff; border-color: var(--header); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost { background: rgba(255,255,255,.04); color: #f8fafc; border-color: rgba(255,255,255,.10); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.icon-btn { width: 38px; padding: 0; display: inline-grid; place-items: center; background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.12); font-size: 18px; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.app-shell { width: min(1550px, calc(100% - 32px)); margin: 22px auto 48px; }
.intro-strip {
  background: linear-gradient(110deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.intro-strip h1 { margin: 3px 0 5px; font-size: clamp(22px, 3vw, 34px); letter-spacing: -.035em; line-height: 1.15; }
.intro-strip p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--accent-strong) !important; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; font-weight: 900; }
.estimate-meta-inline { display: flex; gap: 10px; min-width: 310px; }
.estimate-meta-inline label { flex: 1; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; align-items: start; }
.form-column { min-width: 0; display: grid; gap: 12px; }
.summary-column { position: sticky; top: 96px; }

.panel, .summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-heading {
  width: 100%;
  border: 0;
  background: var(--surface);
  color: var(--text);
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) 22px;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  text-align: left;
}
.panel-heading:hover { background: var(--surface-2); }
.panel-heading strong { display: block; font-size: 15px; }
.panel-heading small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
.step-number { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: var(--header); color: #fff; font-weight: 900; }
.chevron { color: var(--muted); font-size: 20px; transition: transform .15s; }
.panel.is-open .chevron { transform: rotate(180deg); }
.panel-body { padding: 0 18px 20px; border-top: 1px solid var(--line); display: none; }
.panel.is-open .panel-body { display: block; }

label { color: var(--muted); font-weight: 700; font-size: 12px; display: block; }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 10px;
  min-height: 40px;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.grid { display: grid; gap: 12px; margin-top: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 15px 0 10px; }
.section-toolbar p { color: var(--muted); margin: 0; font-size: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
.wide-table table { min-width: 930px; }
th { background: var(--surface-3); color: var(--muted); font-size: 11px; letter-spacing: .035em; text-transform: uppercase; padding: 9px; text-align: left; border-bottom: 1px solid var(--line); }
td { padding: 7px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td input, td select { margin: 0; min-height: 36px; padding: 7px 8px; }
td:last-child, th:last-child { width: 44px; text-align: center; }
.num-col { width: 100px; }
.money-col { width: 120px; text-align: right; }
.row-total { text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-delete { width: 31px; height: 31px; border: 1px solid var(--line); background: transparent; color: var(--danger); border-radius: 7px; font-size: 18px; }
.row-delete:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.logo-upload-row { display: grid; grid-template-columns: 1fr 150px auto; align-items: center; gap: 12px; margin-top: 14px; }
.file-drop { border: 1px dashed var(--line-strong); padding: 10px; border-radius: 9px; position: relative; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop span { display: inline-block; margin-left: 8px; color: var(--accent-strong); }
.logo-preview { height: 56px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); overflow: hidden; background: #fff; }
.logo-preview img { max-height: 48px; max-width: 140px; }
.notice { margin-top: 14px; padding: 11px 13px; background: var(--surface-3); color: var(--muted); border-left: 3px solid var(--accent); border-radius: 7px; }
.actual-summary { margin-top: 14px; }

.summary-card { padding: 18px; }
.summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.summary-head h2 { margin: 2px 0 0; font-size: 19px; line-height: 1.25; }
.status-badge { background: var(--surface-3); color: var(--muted); padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.status-badge.saved { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.warning-list { display: grid; gap: 7px; margin-top: 12px; }
.warning-item { background: var(--warning-bg); color: var(--warning-text); padding: 8px 10px; border-radius: 7px; border: 1px solid color-mix(in srgb, var(--warning-text) 22%, transparent); font-size: 12px; font-weight: 650; }
.cost-breakdown { margin: 14px 0; }
.cost-breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.cost-breakdown dt { color: var(--muted); }
.cost-breakdown dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.cost-breakdown .divider { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 10px; }
.price-block { padding: 12px; border-radius: 10px; margin-top: 9px; }
.price-block span, .price-block small { display: block; }
.price-block span { font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.price-block strong { display: block; font-size: 27px; margin: 2px 0; font-variant-numeric: tabular-nums; }
.break-even { background: var(--surface-3); }
.recommended { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
.recommended strong { color: var(--accent-strong); }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.metric-grid div { background: var(--surface-2); border: 1px solid var(--line); padding: 9px; border-radius: 8px; }
.metric-grid span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 800; }
.metric-grid strong { display: block; margin-top: 2px; font-size: 14px; font-variant-numeric: tabular-nums; }
.pdf-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.pdf-actions .btn { min-height: 58px; padding: 10px 12px; line-height: 1.25; }
.pdf-actions .btn .ui-icon { width: 19px; height: 19px; }
.pdf-actions .btn span { text-align: center; }
.privacy-note { color: var(--muted); font-size: 10px; margin: 9px 0 0; text-align: center; }

.app-footer { display: flex; justify-content: space-between; gap: 14px; width: min(1550px, calc(100% - 32px)); margin: 0 auto 28px; color: var(--muted); font-size: 11px; }

dialog {
  width: min(650px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 35px 90px rgba(0,0,0,.3);
  padding: 18px;
  max-height: calc(100dvh - 28px);
  overflow: auto;
}
dialog::backdrop { background: rgba(5, 10, 15, .66); backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 11px; }
.dialog-head h2 { margin: 2px 0 0; }
dialog .icon-btn { background: var(--surface-3); color: var(--text); border-color: var(--line); }
.saved-list { display: grid; gap: 8px; margin-top: 13px; max-height: 55vh; overflow: auto; }
.saved-item { border: 1px solid var(--line); border-radius: 9px; padding: 11px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; }
.saved-item h3 { margin: 0 0 2px; font-size: 14px; }
.saved-item p { margin: 0; color: var(--muted); font-size: 11px; }
.saved-actions { display: flex; gap: 6px; }
.saved-actions button { padding: 6px 9px; min-height: 32px; }
.empty-state { color: var(--muted); text-align: center; padding: 30px 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 100; background: var(--header); color: #fff; border: 1px solid rgba(255,255,255,.1); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .summary-column { position: static; }
  .summary-card { max-width: none; }
}
@media (max-width: 780px) {
  .app-header { position: static; align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .brand-logo { height: 44px; }
  .intro-strip { flex-direction: column; align-items: stretch; }
  .estimate-meta-inline { min-width: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .logo-upload-row { grid-template-columns: 1fr; }
  .section-toolbar { align-items: stretch; flex-direction: column; }
  .pdf-actions { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .app-shell, .app-footer { width: min(100% - 18px, 1550px); }
  .intro-strip { padding: 17px; }
  .panel-heading { padding: 13px; grid-template-columns: 31px minmax(0,1fr) 18px; }
  .panel-heading small { display: none; }
  .panel-body { padding: 0 12px 15px; }
  .estimate-meta-inline { display: grid; grid-template-columns: 1fr 1fr; }
  .header-actions .btn { padding-inline: 10px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .app-footer { flex-direction: column; }
}

@media print {
  .app-header, .intro-strip, .form-column, .app-footer { display: none !important; }
  .app-shell { width: 100%; margin: 0; }
  .workspace { display: block; }
  .summary-column { position: static; }
  .summary-card { box-shadow: none; border: 0; }
}

@media (max-width: 760px) {
  .brand-area { min-width: 0; flex: 1 1 auto; }
  .brand-logo { height: 44px; width: min(100%, 390px); }
  .header-actions .btn span { display: none; }
  .header-actions .btn { width: 38px; padding: 0; }
}


/* v0.2.0 field-ready workflow */

.wide-dialog { width: min(900px, calc(100% - 28px)); }
.dialog-intro { color: var(--muted); margin: 14px 0 4px; }
.profile-logo-row { display: grid; grid-template-columns: 1fr 170px auto; gap: 12px; align-items: center; margin-top: 14px; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 14px; color: var(--text); }
.check-row input { width: 18px; height: 18px; min-height: 0; margin: 0; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 14px; max-height: 58vh; overflow: auto; padding-right: 3px; }
.template-card { border: 1px solid var(--line); border-radius: 11px; padding: 14px; background: var(--surface-2); display: grid; gap: 8px; }
.template-card h3 { margin: 0; font-size: 15px; }
.template-card p { margin: 0; color: var(--muted); font-size: 12px; }
.template-meta { display: flex; gap: 7px; flex-wrap: wrap; }
.template-meta span { border: 1px solid var(--line); border-radius: 999px; padding: 3px 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.template-card .btn { justify-self: start; }
.readiness-summary { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; margin: 14px 0; }
.readiness-stat { border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: var(--surface-2); }
.readiness-stat span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.readiness-stat strong { display: block; font-size: 21px; margin-top: 2px; }
.readiness-list { display: grid; gap: 7px; max-height: 48vh; overflow: auto; }
.readiness-item { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 9px 11px; background: var(--surface-2); }
.readiness-item strong { display: block; font-size: 12px; }
.readiness-item span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.readiness-item.ready { border-left-color: var(--success); }
.readiness-item.warning { border-left-color: var(--accent); }
.readiness-item.critical { border-left-color: var(--danger); }
.readiness-stat.ready strong { color: var(--success); }
.readiness-stat.warning strong { color: var(--accent-strong); }
.readiness-stat.critical strong { color: var(--danger); }
@media (max-width:780px){.profile-logo-row{grid-template-columns:1fr}.template-grid{grid-template-columns:1fr}.readiness-summary{grid-template-columns:1fr 1fr 1fr}}


/* v0.2.1 interaction and precision pass */
.readiness-action-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 11px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface));
}
.readiness-action-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--accent-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}
.readiness-action-icon .ui-icon { width: 21px; height: 21px; }
.readiness-action-copy { min-width: 0; }
.readiness-action-copy strong { display: block; color: var(--text); font-size: 13px; line-height: 1.25; }
.readiness-action-copy span { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.4; margin-top: 3px; }
.review-quote-btn { min-height: 36px; padding: 7px 10px; border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--text); background: var(--surface); }
.review-quote-btn:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: var(--accent); }
.profile-dialog form { display: block; }
.profile-address-label { margin-top: 14px; }
.required-mark { color: var(--danger); }
.profile-storage-note { margin: 8px 0 0; color: var(--muted); font-size: 10.5px; }
.profile-save-status { margin: 12px 0 2px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 700; }
.profile-save-status.success { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, var(--line)); background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.profile-save-status.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.profile-dialog-actions { position: sticky; bottom: -18px; margin: 18px -18px -18px; padding: 13px 18px; background: var(--surface); border-top: 1px solid var(--line); z-index: 2; }
#businessProfileBtn.has-profile { border-color: color-mix(in srgb, var(--accent) 55%, rgba(255,255,255,.15)); }
#businessProfileBtn.has-profile::after { content: ''; width: 6px; height: 6px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 2px var(--header); margin-left: -3px; }
@media (max-width: 1280px) {
  .brand-area { min-width: 260px; flex-basis: 390px; }
  .header-actions { overflow-x: auto; justify-content: flex-start; scrollbar-width: thin; padding-bottom: 2px; }
  .header-actions::-webkit-scrollbar { height: 4px; }
}
@media (max-width: 780px) {
  .readiness-action-card { grid-template-columns: 40px minmax(0,1fr); }
  .review-quote-btn { grid-column: 1 / -1; width: 100%; }
  .profile-dialog-actions { bottom: -18px; }
}
@media (max-width: 520px) {
  .readiness-action-card { padding: 10px; gap: 9px; }
  .readiness-action-copy span { font-size: 10px; }
  .pdf-actions .btn { min-height: 52px; }
}

.profile-dialog-actions { align-items: center; justify-content: space-between; gap: 14px; }
.profile-apply-check { margin: 0; flex: 1 1 260px; }
.profile-action-buttons { display: flex; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
@media (max-width: 620px) {
  .profile-dialog-actions { align-items: stretch; flex-direction: column; }
  .profile-apply-check { flex-basis: auto; }
  .profile-action-buttons { width: 100%; }
  .profile-action-buttons .btn { flex: 1; }
}

/* v0.2.2 mobile header correction */
@media (max-width: 780px) {
  .app-header {
    min-height: 0;
    height: auto;
    padding: 10px 12px 9px;
    gap: 10px;
    align-items: stretch;
    justify-content: flex-start;
  }

  .brand-area {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    flex-basis: auto;
    height: auto;
    display: flex;
    align-items: center;
  }

  .brand-logo {
    width: min(100%, 300px);
    height: 42px;
    object-fit: contain;
    object-position: left center;
  }

  .header-actions {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 2px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .header-actions::-webkit-scrollbar { display: none; }

  .header-actions .btn,
  .header-actions .icon-btn,
  .header-actions .file-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    flex: 0 0 40px;
    border-radius: 9px;
  }

  .header-actions .btn span,
  .header-actions .file-button span { display: none; }
}

@media (max-width: 420px) {
  .app-header { padding: 9px 10px 8px; gap: 8px; }
  .brand-logo { width: min(100%, 260px); height: 38px; }
  .header-actions { gap: 5px; }
  .header-actions .btn,
  .header-actions .icon-btn,
  .header-actions .file-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    flex-basis: 38px;
  }
}


/* v0.2.3 mobile tools drawer */
.mobile-menu-toggle,
.mobile-menu-backdrop,
.mobile-tools-drawer { display: none; }

@media (max-width: 780px) {
  .app-header {
    position: sticky;
    top: 0;
    min-height: 64px;
    height: 64px;
    padding: 9px 12px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .brand-area {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    overflow: hidden;
  }

  .brand-logo {
    width: min(100%, 265px);
    height: 42px;
    object-fit: contain;
    object-position: left center;
  }

  .header-actions { display: none !important; }

  .mobile-menu-toggle {
    display: inline-grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.20);
    background: rgba(255,255,255,.06);
    color: #f8fafc;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
  }

  .mobile-menu-toggle:hover,
  .mobile-menu-toggle[aria-expanded="true"] {
    background: rgba(245,158,11,.14);
    border-color: rgba(245,158,11,.72);
  }

  .mobile-menu-toggle:active { transform: scale(.97); }
  .mobile-menu-toggle:focus-visible { outline: 3px solid rgba(245,158,11,.32); outline-offset: 2px; }
  .mobile-menu-icon { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }

  .mobile-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 89;
    background: rgba(5,10,15,.58);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }

  .mobile-menu-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-tools-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 90;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 340px);
    background: var(--surface);
    color: var(--text);
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 55px rgba(0,0,0,.22);
    transform: translateX(104%);
    visibility: hidden;
    transition: transform .24s cubic-bezier(.2,.75,.25,1), visibility .24s ease;
    overflow: hidden;
  }

  .mobile-tools-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-drawer-head {
    min-height: 78px;
    padding: 15px 15px 13px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 3px solid var(--accent);
    background: var(--surface);
  }

  .mobile-drawer-eyebrow {
    margin: 0 0 2px;
    color: var(--accent-strong);
    font-size: 10px;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
  }

  .mobile-drawer-head h2 { margin: 0; font-size: 20px; line-height: 1.2; }

  .mobile-drawer-close {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    display: grid;
    place-items: center;
  }

  .mobile-drawer-close:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
  .mobile-drawer-close .ui-icon { width: 21px; height: 21px; }

  .mobile-drawer-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 12px 24px;
  }

  .mobile-drawer-group-title {
    margin: 14px 8px 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .10em;
    text-transform: uppercase;
  }

  .mobile-tool-item {
    width: 100%;
    min-height: 62px;
    padding: 9px 9px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) auto;
    align-items: center;
    gap: 11px;
    text-align: left;
    transition: background .14s ease, border-color .14s ease, transform .14s ease;
  }

  .mobile-tool-item:hover,
  .mobile-tool-item:focus-visible {
    background: var(--surface-2);
    border-color: var(--line);
  }

  .mobile-tool-item:active { transform: scale(.99); }
  .mobile-tool-item:focus-visible { outline: 3px solid rgba(245,158,11,.24); outline-offset: 1px; }

  .mobile-tool-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 11%, var(--surface));
    color: var(--accent-strong);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  }

  .mobile-tool-icon .ui-icon { width: 20px; height: 20px; }
  .mobile-tool-copy { min-width: 0; }
  .mobile-tool-copy strong { display: block; color: var(--text); font-size: 13px; line-height: 1.25; }
  .mobile-tool-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.35; font-weight: 600; }
  .mobile-tool-chevron { width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-profile-dot { display: none; width: 7px; height: 7px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
  .mobile-tool-item.has-profile .mobile-profile-dot { display: block; }
  .mobile-tool-item.has-profile { grid-template-columns: 42px minmax(0,1fr) 8px auto; }

  body.mobile-menu-open { overflow: hidden; touch-action: none; }
}

@media (max-width: 420px) {
  .app-header { height: 60px; min-height: 60px; padding: 8px 10px; }
  .brand-logo { width: min(100%, 235px); height: 38px; }
  .mobile-menu-toggle { width: 42px; height: 42px; flex-basis: 42px; }
  .mobile-tools-drawer { width: min(92vw, 330px); }
}


/* v0.3.0 SEO content and crawlable site navigation */
.mobile-site-link { text-decoration: none; }
.home-seo-section { width: min(1550px, calc(100% - 32px)); margin: 0 auto 22px; }
.home-seo-inner { padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.home-seo-inner h2 { margin: 4px 0 10px; font-size: clamp(22px, 2.2vw, 34px); line-height: 1.18; }
.home-seo-inner > p:not(.eyebrow):not(.home-seo-links) { max-width: 950px; margin: 0; color: var(--muted); line-height: 1.75; }
.home-seo-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-top: 22px; }
.home-seo-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.home-seo-grid h3 { margin: 0 0 7px; font-size: 15px; }
.home-seo-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.home-seo-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; font-size: 13px; }
.home-seo-links a, .app-footer-links a { color: var(--text); text-decoration: none; }
.home-seo-links a:hover, .app-footer-links a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.app-footer { align-items: center; }
.app-footer-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.app-footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; }
@media (max-width: 780px) {
  .home-seo-section { width: min(100% - 18px, 1550px); }
  .home-seo-inner { padding: 20px 16px; }
  .home-seo-grid { grid-template-columns: 1fr; }
  .app-footer-links { justify-content: flex-start; }
}
@media print { .home-seo-section { display: none !important; } }
