/* PolygonLogix Lite — styled after the desktop (ref/TrueShapeNest.App/MainWindow.xaml and its windows).
   App.xaml carries no theme, so controls use the WPF Aero2 defaults; colors below are the XAML's literal values. */

:root {
  --font: "Segoe UI", "Segoe UI Variable", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --control: #F0F0F0;
  --btn-bg: #DDDDDD;
  --btn-border: #707070;
  --btn-hover-bg: #BEE6FD;
  --btn-hover-border: #3C7FB1;
  --btn-press-bg: #C4E5F6;
  --btn-press-border: #2C628B;
  --text-border: #ABADB3;
  --focus-border: #569DE5;
  --hover-border: #7EB4EA;
  --grid-line: #A0A0A0;
  --orange: #FF9800;
  --blue: #2196F3;
  --blue-dark: #1976D2;
  --green: #4CAF50;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 12px;
  color: #000;
  background: #FFFFFF;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
u { text-decoration: none; }
body.alt-keys u { text-decoration: underline; }
.semibold { font-weight: 600; }
.bold { font-weight: 700; }
.center { text-align: center; }

#app { display: flex; flex-direction: column; height: 100vh; min-width: 1180px; }

/* ── WPF default controls (Aero2) ─────────────────────────────────────── */
.wpf-button {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  padding: 1px 8px;
  min-height: 22px;
  cursor: default;
}
.wpf-button:hover:not(:disabled) { background: var(--btn-hover-bg); border-color: var(--btn-hover-border); }
.wpf-button:active:not(:disabled) { background: var(--btn-press-bg); border-color: var(--btn-press-border); }
.wpf-button:disabled { background: #F4F4F4; border-color: #ADB2B5; color: #838383; }
.wpf-button:focus-visible, .wpf-combo:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.icon-button { padding: 2px 6px; margin-left: 8px; }

.wpf-text {
  border: 1px solid var(--text-border);
  background: #FFF;
  padding: 2px 4px;
  height: 22px;
  outline: none;
  min-width: 0;
}
.wpf-text:hover { border-color: var(--hover-border); }
.wpf-text:focus { border-color: var(--focus-border); }
.wpf-text.readonly, .wpf-text[readonly] { background: #F0F0F0; }
.wpf-text.num { text-align: right; }
textarea.wpf-text { height: auto; resize: none; font-size: 13px; }

.wpf-combo {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #ACACAC;
  background: linear-gradient(#F0F0F0, #E5E5E5) padding-box;
  padding: 2px 22px 2px 6px;
  height: 22px;
  min-width: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='4'%3E%3Cpath d='M0 0 L4 4 L8 0' fill='none' stroke='%23606060'/%3E%3C/svg%3E"), linear-gradient(#F0F0F0, #E5E5E5);
  background-repeat: no-repeat, repeat;
  background-position: right 7px center, 0 0;
  outline: none;
}
.wpf-combo:hover:not(:disabled) {
  border-color: var(--hover-border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='4'%3E%3Cpath d='M0 0 L4 4 L8 0' fill='none' stroke='%23606060'/%3E%3C/svg%3E"), linear-gradient(#ECF4FC, #DCECFC);
}
.wpf-combo:disabled { color: #838383; border-color: #D9D9D9; }
select.wpf-combo option { background: #FFF; color: #000; }

.wpf-check { display: inline-flex; align-items: center; gap: 4px; user-select: none; }
.wpf-check input, .wpf-radio input {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin: 0;
  border: 1px solid #333;
  background: #FFF;
  display: inline-grid;
  place-content: center;
  flex: none;
}
.wpf-check input:hover, .wpf-radio input:hover { border-color: #005499; background: #F3F9FF; }
.wpf-check input:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 1.6px solid #212121;
  border-bottom: 1.6px solid #212121;
  transform: translate(0, -1px) rotate(-45deg);
}
.wpf-check input:disabled { border-color: #BCBCBC; background: #E6E6E6; }
.wpf-radio { display: inline-flex; align-items: center; gap: 4px; user-select: none; }
.wpf-radio input { border-radius: 50%; }
.wpf-radio input:checked::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #212121; }

.wpf-label { padding: 5px; display: inline-block; }

.wpf-slider { width: 100px; accent-color: #007ACC; height: 18px; margin: 0; }

.wpf-progress {
  position: relative;
  height: 24px;
  border: 1px solid #BCBCBC;
  background: #E6E6E6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wpf-progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #06B025; transition: width .2s; }
.wpf-progress span { position: relative; font-weight: 700; }
.wpf-progress.indeterminate .wpf-progress-fill { width: 30%; animation: indet 1.4s linear infinite; }
@keyframes indet { from { left: -30%; } to { left: 100%; } }

.wpf-tooltip {
  position: fixed;
  z-index: 1000;
  background: #FFF;
  border: 1px solid #767676;
  padding: 3px 6px;
  pointer-events: none;
  box-shadow: 1px 1px 3px rgba(0,0,0,.25);
  max-width: 420px;
}

.wpf-groupbox {
  border: 1px solid #D5DFE5;
  border-radius: 3px;
  padding: 14px 8px 8px;
  margin-top: 8px;
  position: relative;
}
.wpf-groupbox > .gb-header {
  position: absolute;
  top: -8px;
  left: 6px;
  padding: 0 3px;
  background: inherit;
  background-color: var(--gb-bg, #FFF);
}

/* DataGrid */
.wpf-datagrid { background: #F0F0F0; border: 1px solid #688CAF; overflow: auto; position: relative; }
table.grid { border-collapse: collapse; background: transparent; }
table.grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #FFF;
  font-weight: 400;
  text-align: left;
  padding: 4px 5px 4px 5px;
  border-right: 1px solid #E5E5E5;
  border-bottom: 1px solid #D5D5D5;
  white-space: nowrap;
  user-select: none;
}
table.grid td {
  background: #FFF;
  padding: 1px 4px;
  border-bottom: 1px solid var(--grid-line);
  border-right: 1px solid var(--grid-line);
  white-space: nowrap;
  vertical-align: middle;
}
table.grid tr.selected td { background: #0078D7; color: #FFF; }
table.grid tr.selected td .muted { color: #E0E0E0; }
table.grid tr.selected td input.wpf-text { color: #000; }
table.grid:focus-within tr.selected td { background: #0078D7; }
table.grid td.c-fill, table.grid th.c-fill { width: 100%; border-right: none; }
table.grid td.c-fill { background: transparent; border-bottom-color: transparent; }
table.grid td.center, table.grid th.center { text-align: center; }
table.grid td.right, table.grid th.right { text-align: right; }

/* ── Menu ─────────────────────────────────────────────────────────────── */
.menubar {
  display: flex;
  align-items: stretch;
  background: #F0F0F0;
  height: 20px;
  flex: none;
  position: relative;
  z-index: 50;
  user-select: none;
}
.menu { position: relative; }
.menu-title { display: block; padding: 1px 7px; border: 1px solid transparent; line-height: 16px; }
.menu:hover > .menu-title, .menu.open > .menu-title { background: rgba(38,160,218,.24); border-color: #26A0DA; }
.menu-pop {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 190px;
  background: #F0F0F0;
  border: 1px solid #999;
  box-shadow: 2px 2px 3px rgba(0,0,0,.3);
  padding: 2px;
  z-index: 60;
}
.menu.open > .menu-pop { display: block; }
.mi {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: 1px solid transparent;
  padding: 3px 12px 3px 30px;
  text-align: left;
  white-space: nowrap;
  position: relative;
  cursor: default;
}
.mi:hover:not(:disabled) { background: rgba(38,160,218,.24); border-color: #26A0DA; }
.mi:disabled { color: #9D9D9D; }
.mi .gesture { margin-left: auto; padding-left: 36px; }
.mi.check.on::before { content: "✓"; position: absolute; left: 10px; }
.msep { height: 1px; background: #D7D7D7; margin: 2px 2px 2px 28px; }
.has-sub .sub-arrow { margin-left: auto; padding-left: 30px; font-size: 8px; }
.has-sub > .menu-pop.sub { top: -3px; left: 100%; }
.has-sub:hover > .menu-pop.sub { display: block; }
.menu-hint { padding: 2px 0 0 12px; color: #0078D4; font-size: 11px; font-style: italic; }
.menu-pop.context { display: block; position: fixed; min-width: 150px; }

/* ── Toolbar with tabs ────────────────────────────────────────────────── */
.billing-banner { flex: none; display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: #FEF2F2; border-bottom: 1px solid #FCA5A5; color: #991B1B; }
.billing-banner[hidden] { display: none; }
.billing-banner span { flex: 1; }
.billing-banner .wpf-button { height: 26px; padding: 0 12px; }
.toolbar {
  display: flex;
  align-items: center;
  height: 41px;
  background: #F5F5F5;
  border-bottom: 1px solid #E0E0E0;
  flex: none;
}
.tab-button {
  width: 110px;
  height: 40px;
  border: 0;
  background: #E5E7EB;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tab-button:hover { background: #D1D5DB; }
.tab-button.active { background: #3B82F6; color: #FFF; }
.tab-icon { font-size: 14px; margin-right: 6px; }
.toolbar-sep { width: 1px; align-self: stretch; margin: 8px; background: #D1D5DB; }
.toolbar-button {
  background: #FFF;
  border: 1px solid #D1D5DB;
  padding: 6px 12px;
  margin: 0 4px;
  cursor: pointer;
}
.toolbar-button:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-border); }

.toolbar-fill { flex: 1; }
.account-indicator { display: flex; align-items: center; gap: 6px; margin-right: 12px; background: transparent; border: 1px solid transparent; padding: 4px 8px; color: #374151; cursor: pointer; }
.account-indicator:hover { background: #E5E7EB; border-color: #D1D5DB; }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.ai-dot.inactive { background: #F59E0B; }
.ai-dot.trial { background: #3b82f6; }
body:not(.accounts) .account-only { display: none !important; }

/* Sign-in (same look as the welcome overlay) */
/* While signed out only the landing page exists: the desktop-width app must not widen a phone's page. */
body.landing-open #app { display: none; }
.signin { position: fixed; inset: 0; z-index: 150; background: #F8FAFC; overflow: auto; }
.landing-page { max-width: 1040px; margin: 0 auto; padding: 14px 24px 0; min-height: 100%; display: flex; flex-direction: column; box-sizing: border-box; }
.landing-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.landing-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.landing-logo { width: 180px; height: auto; max-height: 73px; display: block; }
.lite-badge { font-size: 12px; font-weight: 700; color: #FFF; background: #1976D2; border-radius: 4px; padding: 2px 8px; letter-spacing: .04em; line-height: 18px; }
.landing-link { background: none; border: 1px solid #CBD5E1; border-radius: 6px; padding: 7px 16px; color: #1F2937; font-weight: 600; cursor: pointer; }
.landing-link:hover { background: #FFF; border-color: #94A3B8; }
.landing-view { flex: 1; }
.landing-hero { margin-bottom: 18px; }
.landing-h1 { font-size: 30px; line-height: 1.2; color: #111827; margin: 0 0 6px; }
.landing-lead { font-size: 15px; color: #475569; line-height: 1.5; margin: 0; }
.landing-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.plan-card { background: #FFF; border: 1px solid #E2E8F0; border-radius: 8px; padding: 18px 20px; box-shadow: 0 2px 8px rgba(15,23,42,.06); display: flex; flex-direction: column; }
.plan-card.featured { border-color: #3b82f6; box-shadow: 0 2px 12px rgba(37,99,235,.15); }
.plan-card .plan-name { font-size: 15px; font-weight: 700; color: #1F2937; }
.plan-card .plan-price { font-size: 28px; font-weight: 700; color: #111827; margin: 4px 0 2px; }
.plan-card .plan-note { color: #64748b; min-height: 18px; }
.plan-card ul { margin: 10px 0 14px; padding-left: 18px; color: #475569; line-height: 1.6; flex: 1; }
.plan-card .signin-button { width: 100%; height: 40px; margin: 0; flex-direction: row; font-size: 13px; font-weight: 700; }
.landing-plans.unavailable { grid-template-columns: 1fr; }
.landing-plans .plan-card.plan-unavailable { border-left: 4px solid #1976D2; display: block; }
.plan-unavailable p { margin: 8px 0 14px; color: #475569; line-height: 1.55; max-width: 640px; }
.plan-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; }
.plan-card .plan-actions .signin-button { display: inline-flex; align-items: center; justify-content: center; width: auto; min-width: 160px; padding: 0 20px; text-decoration: none; }
.plan-secondary { color: #1976D2; }
.landing-fine { color: #64748b; margin: 10px 0 0; }
.landing-notice { border-radius: 6px; padding: 10px 14px; margin: 0 0 14px; line-height: 1.45; }
.landing-notice.ok { background: #ECFDF5; border: 1px solid #6EE7B7; color: #065F46; }
.landing-notice.info { background: #F1F5F9; border: 1px solid #CBD5E1; color: #334155; }
.landing-notice.error { background: #FEF2F2; border: 1px solid #FCA5A5; color: #991B1B; }
.landing-section { margin-top: 34px; }
.landing-section h2 { font-size: 18px; color: #111827; margin: 0 0 10px; }
.landing-note { color: #64748b; }
.landing-units { margin: 10px 0 0; color: #475569; font-size: 13px; }
.landing-units[hidden] { display: none; }
.landing-features { margin: 0; padding-left: 20px; color: #334155; line-height: 1.9; font-size: 14px; }
.landing-upgrade { background: #FFF; border: 1px solid #E2E8F0; border-left: 4px solid #1976D2; border-radius: 6px; padding: 14px 18px; }
.landing-upgrade p { margin: 0; color: #475569; line-height: 1.55; }
.landing-upgrade a { color: #1976D2; font-weight: 600; }
.landing-signin { display: flex; justify-content: center; align-items: flex-start; padding-top: 48px; }
.signin-alt { margin-top: 12px; color: #64748b; }
.signin-pw { position: relative; }
.signin-pw .signin-input { padding-right: 58px; }
.signin-eye { position: absolute; right: 1px; top: 1px; height: 30px; padding: 0 10px; border: 0; background: none; color: #1976D2; font-size: 12px; font-weight: 600; cursor: pointer; }
.signin-keep { margin: 0 0 14px; color: #374151; }
.signin-alt a, .landing-footer a { color: #1976D2; }
.landing-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; border-top: 1px solid #E2E8F0; margin-top: 36px; padding: 16px 0 20px; color: #64748b; }
.landing-footer nav { display: flex; gap: 18px; }
.landing-footer nav a { color: #475569; text-decoration: none; }
.landing-footer nav a:hover { color: #1976D2; text-decoration: underline; }
@media (max-width: 640px) {
  .landing-page { padding: 10px 16px 0; }
  .landing-logo { width: 140px; }
  .landing-top { margin-bottom: 10px; }
  .landing-h1 { font-size: 22px; }
  .landing-lead { font-size: 14px; }
  .landing-hero { margin-bottom: 12px; }
  .landing-plans { grid-template-columns: 1fr; gap: 10px; }
  .plan-card { padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
  .plan-card .plan-price { font-size: 22px; }
  .plan-card ul { display: none; }
  .plan-card .plan-note { grid-column: 1; }
  .plan-card .signin-button { grid-column: 2; grid-row: 1 / span 3; width: 130px; }
  .landing-signin { padding-top: 16px; }
}
.signin-card { background: #FFF; border: 1px solid #E2E8F0; border-radius: 8px; padding: 24px 28px; width: 100%; max-width: 400px; box-sizing: border-box; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.signin-title { font-size: 20px; font-weight: 700; color: #1F2937; margin-bottom: 4px; }
.signin-sub { color: #64748b; margin-bottom: 14px; }
.signin-input { width: 100%; height: 32px; font-size: 14px; margin-bottom: 14px; }
.signin .signin-button { width: 100%; height: 40px; margin: 0; flex-direction: row; font-size: 13px; font-weight: 700; }
.signin-status { margin-top: 12px; min-height: 18px; color: #475569; white-space: pre-wrap; }
.signin-status.error { color: #B91C1C; }
.signin-status.ok { color: #047857; }
.signin-status.beta { color: #92400E; }
.signin-status.beta a { color: #1976D2; font-weight: 600; }

/* Account window (Company Settings layout) */
.account { width: 560px; max-width: 100%; box-sizing: border-box; }
.account .row { display: grid; grid-template-columns: 130px 1fr; gap: 6px; align-items: center; margin-bottom: 8px; }
.usage-bar { height: 8px; background: #E2E8F0; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.usage-bar > div { height: 100%; background: #3b82f6; }
.usage-bar.full > div { background: #EF4444; }
.plan-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-weight: 600; }
.plan-badge.on { background: #DCFCE7; color: #166534; }
.plan-badge.off { background: #FEF3C7; color: #92400E; }
.plan-badge.trial { background: #DBEAFE; color: #1E40AF; }
.account .buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ── Quoting content: 2* | 3* ─────────────────────────────────────────── */
.quoting {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 2fr 3fr;
  position: relative;
}

/* Welcome overlay */
.welcome {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome-inner { display: flex; flex-direction: column; align-items: center; }
.welcome-logo { width: 280px; height: auto; margin-bottom: 40px; }
.welcome-actions { display: flex; }
.welcome-btn {
  width: 140px;
  height: 100px;
  margin: 10px;
  border: 0;
  border-radius: 8px;
  color: #FFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 10px;
}
.welcome-btn.new { background: #3b82f6; }
.welcome-btn.new:hover { background: #2563eb; }
.welcome-btn.open { background: #10b981; }
.welcome-btn.open:hover { background: #059669; }
.welcome-btn.add { background: #8b5cf6; }
.welcome-btn.add:hover { background: #7c3aed; }
.wb-icon { font-size: 28px; line-height: 1.2; }
.wb-title { font-size: 14px; font-weight: 700; margin-top: 8px; }
.wb-sub { font-size: 10px; opacity: .8; }
.welcome-hint { font-size: 11px; color: #94a3b8; margin-top: 30px; }
.getting-started { margin-top: 28px; width: 560px; max-width: calc(100vw - 32px); background: #FFF; border: 1px solid #E2E8F0; border-left: 4px solid #1976D2; border-radius: 6px; padding: 14px 18px; box-shadow: 0 2px 8px rgba(15,23,42,.06); text-align: left; }
.getting-started[hidden] { display: none; }
.gs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.gs-title { font-size: 15px; font-weight: 700; color: #1F2937; }
.gs-count { color: #64748b; margin-left: 8px; font-weight: 400; }
.gs-close { background: none; border: 0; color: #64748b; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; }
.gs-close:hover { color: #1F2937; }
.gs-step { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-top: 1px solid #F1F5F9; }
.gs-step:first-of-type { border-top: 0; }
.gs-check { flex: none; width: 20px; height: 20px; border-radius: 10px; border: 2px solid #CBD5E1; box-sizing: border-box; color: #FFF; font-size: 12px; line-height: 16px; text-align: center; margin-top: 1px; }
.gs-step.done .gs-check { background: #16A34A; border-color: #16A34A; }
.gs-step.done .gs-label { color: #64748b; text-decoration: line-through; }
.gs-label { font-weight: 600; color: #1F2937; }
.gs-sub { color: #64748b; font-size: 12px; }
.gs-step a { color: #1976D2; cursor: pointer; }
.loading-status { font-size: 18px; font-weight: 600; color: #1e3a5f; margin-bottom: 15px; }
.welcome-progress { width: 350px; height: 8px; background: #e2e8f0; position: relative; overflow: hidden; }
.welcome-progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 30%; background: #3b82f6; animation: indet 1.4s linear infinite; }
.loading-count { font-size: 12px; color: #64748b; margin-top: 10px; }

/* LEFT column: auto | 50* | auto | 50* */
.left-col {
  display: grid;
  grid-template-rows: auto minmax(90px, 1fr) auto minmax(120px, 1fr);
  min-height: 0;
  min-width: 0;
}

.combo-panel { margin: 4px 4px 0; background: #F5F5F5; }
.combo-head { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.legend { display: flex; align-items: center; font-size: 9px; color: #555; margin-right: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; border: 1px solid; margin: 0 2px 0 6px; }
.dot.done { background: #C8E6C9; border-color: #4CAF50; }
.dot.check { background: #BBDEFB; border-color: #2196F3; }
.dot.notstarted { background: #FFCDD2; border-color: #F44336; }

.combo-select {
  position: relative;
  border: 1px solid #ACACAC;
  background: linear-gradient(#F0F0F0, #E5E5E5);
  margin-bottom: 8px;
  min-height: 40px;
  outline: none;
  cursor: default;
}
.combo-select:hover { border-color: var(--hover-border); }
.combo-select:focus-visible { outline: 1px dotted #000; outline-offset: -3px; }
.combo-select.disabled { pointer-events: none; }
.combo-select > .combo-item { margin: 1px 20px 1px 1px; }
.combo-arrow {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 8px;
  height: 4px;
  margin-top: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='4'%3E%3Cpath d='M0 0 L4 4 L8 0' fill='none' stroke='%23606060'/%3E%3C/svg%3E");
}
.combo-item { padding: 6px 8px; font-size: 12px; }
.combo-item.done { background: #C8E6C9; }
.combo-item.check { background: #BBDEFB; }
.combo-item.notStarted { background: #FFCDD2; }
.combo-item.nomaterial { background: #FFF3E0; }
.combo-item.empty { background: transparent; }
.ci-title { font-weight: 600; }
.ci-sub { font-size: 10px; color: #444; margin-top: 2px; }
.combo-list {
  position: absolute;
  left: -1px;
  right: -1px;
  top: 100%;
  z-index: 30;
  background: #FFF;
  border: 1px solid #646464;
  max-height: 320px;
  overflow: auto;
  box-shadow: 2px 2px 4px rgba(0,0,0,.25);
}
.combo-list .combo-item { border: 1px solid transparent; }
.combo-list .combo-item:hover { border-color: #26A0DA; filter: brightness(.97); }
.combo-list .combo-item.current { border-color: #26A0DA; }

.gas-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; min-height: 24px; }
.gas-panel, .quality-panel { display: flex; align-items: center; }
.gas-panel .wpf-label, .quality-panel .wpf-label { padding: 0 8px 0 0; }
.quality-panel { margin-bottom: 8px; }
.mymind { display: flex; align-items: center; margin-left: auto; }
.mymind .semibold { margin-right: 10px; }
.mymind .wpf-check { margin-right: 15px; }
.mymind .wpf-check:last-child { margin-right: 0; }

.parts-grid-wrap { margin: 0 4px 4px; min-height: 0; }
#partsGrid { width: 100%; }
#partsGrid td { height: 42px; }
#partsGrid tr.row { cursor: default; }
#partsGrid .c-dot { width: 30px; text-align: center; }
#partsGrid .c-preview { width: 70px; }
#partsGrid td.c-preview { padding: 1px 5px; position: relative; }
#partsGrid .c-qty { width: 50px; text-align: center; }
#partsGrid .c-check { width: 50px; text-align: center; }
#partsGrid .c-op { width: 38px; text-align: center; padding-left: 2px; padding-right: 2px; }
.nested-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: red; vertical-align: middle; }
.nested-dot.on { background: limegreen; }
.op-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: #CCCCCC; vertical-align: middle; }
.op-dot.on { background: #4CAF50; }
.preview { width: 60px; height: 40px; display: block; }
.preview-wrap { position: relative; display: inline-block; border: 0 solid orange; }
.preview-wrap.open { border-width: 2px; }
.warn-open { position: absolute; right: -2px; top: -2px; color: orange; font-weight: 700; font-size: 14px; line-height: 1; }
.qty-input { width: 40px; border: 1px solid transparent; background: transparent; text-align: center; padding: 1px; }
.qty-input:hover { border-color: var(--text-border); background: #FFF; }
.qty-input:focus { border-color: var(--focus-border); background: #FFF; color: #000; outline: none; }
.grid-note { padding: 16px; color: #666; }
.unit-note { margin-left: 6px; padding: 0 5px; border-radius: 3px; background: #E3F2FD; border: 1px solid #90CAF9;
             color: #0D47A1; font-size: 10px; font-weight: 600; white-space: nowrap; cursor: help; }
.part-sub { font-size: 10px; color: gray; }

/* Job Settings */
.job-settings {
  margin: 4px 4px 0;
  background: #FFF;
  border: 1px solid #CCCCCC;
  display: flex;
}
.js-fields { flex: 1; padding: 8px; min-width: 0; }
.js-title { font-size: 14px; font-weight: 700; color: #FF9800; margin-bottom: 8px; }
.js-row { display: flex; align-items: center; margin-bottom: 6px; }
.js-row:last-child { margin-bottom: 0; }
.js-label { width: 80px; flex: none; }
.js-row > .wpf-text { flex: 1; height: 24px; }
.js-fees .wpf-text { flex: none; width: 70px; }
.save-button { background: #4CAF50; color: #FFF; border: 0; padding: 2px 8px; margin-left: 5px; height: 24px; cursor: pointer; }
.save-button:hover:not(:disabled) { background: #45A049; }
.save-button:disabled { opacity: .55; cursor: default; }
.js-gap { width: 20px; flex: none; }
.rush { color: #E67E22; font-weight: 600; }
.rush.bold { font-weight: 700; margin-left: 5px; }
.js-actions { padding: 8px; display: flex; flex-direction: column; justify-content: center; }
.nest-split { position: relative; display: flex; width: 110px; height: 70px; }
.nest-main {
  flex: 1;
  border: 0;
  border-radius: 6px 0 0 6px;
  background: #1976D2;
  color: #FFF;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  padding: 4px;
  cursor: pointer;
}
.nest-main:hover:not(:disabled) { background: #1565C0; }
.nest-main:active:not(:disabled) { background: #0D47A1; }
.nest-main .nest-busy { font-size: 14px; }
.nest-main:disabled, .nest-toggle:disabled, .bulk-button:disabled { opacity: .55; cursor: default; }
.nest-split.running .nest-main, .nest-split.running .nest-toggle { opacity: 1; }
.nest-toggle {
  width: 24px;
  border: 0;
  border-left: 1px solid #0D47A1;
  border-radius: 0 6px 6px 0;
  background: #1565C0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nest-toggle:hover:not(:disabled) { background: #1976D2; }
.nest-toggle.checked { background: #0D47A1; }
.nest-caret { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid #FFF; }
.nest-popup {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 35;
  background: #FFF;
  border: 1px solid #1976D2;
  border-radius: 4px;
  padding: 2px;
  min-width: 180px;
  box-shadow: 2px 2px 5px rgba(0,0,0,.2);
}
.nest-popup button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 12px; cursor: pointer; white-space: nowrap; }
.nest-popup button:hover { background: #E3F2FD; }
.nest-popup-sep { height: 1px; background: #E0E0E0; margin: 2px 4px; }
.bulk-button {
  width: 110px;
  height: 32px;
  margin-top: 6px;
  border: 0;
  border-radius: 4px;
  background: #FF9800;
  color: #FFF;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.bulk-button:hover:not(:disabled) { background: #F57C00; }
.bulk-button:active:not(:disabled) { background: #E65100; }

/* Pricing summary */
.pricing-panel {
  margin: 4px;
  background: #FFF;
  border: 1px solid #CCCCCC;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pricing-scroll { overflow-y: auto; padding: 8px; flex: 1; min-height: 0; }
.stale-warning {
  background: #FFF3E0;
  border-bottom: 2px solid #FF9800;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #E65100;
  font-weight: 600;
  z-index: 10;
}
.stale-btn { border: 0; color: #FFF; font-weight: 600; padding: 3px 10px; margin-left: 12px; cursor: pointer; }
.stale-btn + .stale-btn { margin-left: 6px; }
.stale-btn.green { background: #4CAF50; }
.stale-btn.orange { background: #FF9800; }
.stale-overlay {
  position: absolute;
  inset: 40px 0 0 0;
  background: rgba(255,255,255,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}
.sample-banner { display: flex; align-items: center; gap: 10px; background: #FFF8E1; border: 1px solid #FFB300; color: #7A4F00; padding: 6px 10px; margin-bottom: 10px; line-height: 1.35; }
.sample-banner span { flex: 1; }
.sample-banner a { color: #7A4F00; font-weight: 600; cursor: pointer; }
.lock-overlay { position: absolute; inset: 40px 0 0 0; background: rgba(255,255,255,.82); display: flex; align-items: center; justify-content: center; z-index: 3; }
.lock-overlay[hidden] { display: none; }
.lock-card { background: #FFF; border: 1px solid #90CAF9; box-shadow: 0 2px 8px rgba(0,0,0,.12); padding: 16px 20px; max-width: 340px; text-align: center; line-height: 1.45; }
.lock-card .lock-title { font-size: 16px; font-weight: 700; color: #1976D2; margin-bottom: 6px; }
.lock-card .flat-btn { margin-top: 12px; }
.pp-locked { padding: 16px; color: #555; text-align: center; white-space: normal; }
.stale-overlay span { font-size: 16px; font-weight: 700; color: #E65100; opacity: .8; }
.jp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.jp-title { font-size: 16px; font-weight: 700; color: #1976D2; }
.jp-notes { display: flex; align-items: center; }
.notes-dot { width: 10px; height: 10px; border-radius: 50%; background: #F44336; margin-right: 6px; }
.notes-dot.has { background: #4CAF50; }
.notes-button { background: #E3F2FD; border: 1px solid #2196F3; padding: 4px 12px; cursor: pointer; }
.notes-button:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-border); }
.pbox { border: 1px solid; padding: 8px; margin-bottom: 8px; }
.pbox.material { background: #E3F2FD; border-color: #2196F3; }
.pbox.cutting { background: #FFF3E0; border-color: #FF9800; }
.pbox.setup { background: #F3E5F5; border-color: #9C27B0; }
.pbox.total {
  background: #E8F5E9;
  border: 2px solid #4CAF50;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  color: #2E7D32;
  margin-bottom: 0;
}
.pbox-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.pbox-options { display: flex; flex-direction: column; margin-bottom: 8px; }
.pbox-options > * { margin-bottom: 4px; }
.lead-row { display: flex; align-items: center; gap: 0; }
.lead-row > span:first-child { margin-right: 8px; }
.lead-row #expeditedHours, .lead-row #customLeadTimePanel { margin-left: 5px; }
.lead-date { color: #FF9800; font-weight: 600; margin-left: 12px; }
.margin-row { display: flex; align-items: center; margin-left: 20px; }
.margin-row > span:first-child { margin-right: 5px; }
.margin-value { margin-left: 5px; min-width: 35px; }
.kv { display: flex; justify-content: space-between; margin: 2px 0; }
.kv.gap { margin-top: 6px; }
.kv.small { font-size: 11px; color: #666; }
.kv.etch { color: #00BCD4; }
.machine-row { margin-bottom: 8px; }
.machine-row .semibold { margin-right: 8px; }
.pricing-warnings { margin-top: 8px; color: #B71C1C; font-size: 11px; }
.pricing-warnings div { margin-bottom: 2px; }

/* RIGHT column */
.right-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.controls { margin: 4px 8px; flex: none; }
.controls-grid { display: grid; grid-template-columns: auto 1fr; }
.ctl-row { display: flex; align-items: center; margin-top: 8px; white-space: nowrap; }
.ctl-row:first-child { margin-top: 0; }
.ctl-label { width: 120px; margin-right: 8px; flex: none; }
.ctl-hint { margin-left: 8px; font-style: italic; color: gray; font-size: 10px; }
.engine-status { margin-left: 16px; font-weight: 600; color: #4CAF50; }
.controls-right { margin-left: 20px; min-width: 0; }
.summary-box {
  background: #E8F5E9;
  border: 2px solid #4CAF50;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.summary-title { font-size: 14px; font-weight: 700; color: #2E7D32; margin-bottom: 8px; }
.summary-count { font-size: 18px; font-weight: 700; color: #1B5E20; margin-left: 4px; }
.matprice-box {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  background: #F5F5F5;
  border: 1px solid #E0E0E0;
  border-radius: 4px;
  padding: 6px 12px;
  margin-bottom: 8px;
}
.mp-label { font-weight: 600; color: #555; margin-right: 12px; }
.mp-supplied { font-weight: 600; color: #FF9800; }
.mp-k { color: #777; }
.mp-cost, .mp-markup, .mp-value { font-weight: 600; margin: 0 16px 0 4px; }
.mp-cost { color: #2196F3; }
.mp-markup { color: #FF9800; }
.mp-value { color: #4CAF50; margin-right: 0; }
.nest-message { background: #FFEBEE; border: 1px solid #E57373; color: #B71C1C; padding: 6px 10px; border-radius: 4px; white-space: normal; }

.progress-panel { margin: 16px 0 8px; }
.progress-panel > .bold { margin-bottom: 4px; }
.progress-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.eta { font-style: italic; color: gray; }
.sheet-nav { display: flex; align-items: center; justify-content: center; margin: 16px 0 8px; }
.sheet-nav-btn { width: 100px; height: 30px; border: 0; background: #2196F3; color: #FFF; cursor: pointer; }
.sheet-nav-btn:hover:not(:disabled) { background: #1E88E5; }
.sheet-nav-btn:disabled { background: #F4F4F4; color: #838383; border: 1px solid #ADB2B5; }
#previousSheetButton { margin-right: 10px; }
#nextSheetButton { margin-left: 10px; }
.sheet-indicator { font-size: 16px; font-weight: 700; color: #4CAF50; margin: 0 10px; }
.sheet-dxf { margin-left: 16px; height: 30px; }

/* Canvas */
.canvas-area { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.canvas-toolbar {
  background: #2D2D30;
  border-bottom: 1px solid #3F3F46;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  height: 33px;
  flex: none;
  color: #E0E0E0;
}
.dark-check { display: inline-flex; align-items: center; gap: 4px; user-select: none; }
.dark-check input { accent-color: #3E3E42; margin: 0; }
.ct-sep { width: 1px; align-self: stretch; background: #4B5563; margin: 2px 12px; }
.zoom-controls { display: flex; align-items: center; }
.zoom-controls button { width: 28px; height: 24px; background: #3E3E42; color: #E0E0E0; border: 1px solid #555; margin-right: 4px; cursor: pointer; }
.zoom-controls button.wide { width: auto; padding: 0 8px; }
.zoom-controls button:hover { background: #505056; }
.zoom-level { color: #9CA3AF; margin-left: 4px; min-width: 45px; }
.canvas-scroll { flex: 1; min-height: 0; background: #F0F0F0; overflow: hidden; position: relative; }
.canvas-scroll.zoom { overflow: auto; }
.nest-canvas { display: block; background: #F0F0F0; }
.nest-canvas .part { cursor: pointer; }
.nest-canvas .part:hover path, .nest-canvas .part:hover circle { stroke-width: 2; }
.canvas-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9A9A9A; font-size: 14px; pointer-events: none; }

.pp-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  margin-top: -40px;
  width: 32px;
  height: 80px;
  background: #2196F3;
  border: 1px solid #1976D2;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  color: #FFF;
  font-size: 20px;
  font-weight: 700;
  z-index: 21;
  cursor: pointer;
  padding: 0;
}
.pp-toggle:hover { background: #1976D2; }
.pp-panel {
  position: absolute;
  right: 0;
  top: 4px;
  bottom: 4px;
  width: min(1100px, 100%);
  background: #FFF;
  border-left: 1px solid #CCCCCC;
  z-index: 20;
  display: flex;
  flex-direction: column;
  box-shadow: -3px 0 8px rgba(0,0,0,.12);
}
.pp-head { background: #2196F3; padding: 12px 16px; font-size: 16px; font-weight: 600; color: #FFF; }
.pp-body { flex: 1; min-height: 0; border: 0; background: #FFF; }
.pp-grid { width: 100%; }
.pp-grid th { border-right: 1px solid #E5E5E5; }
.pp-grid td { height: 60px; border-right: none; border-bottom: 1px solid #E0E0E0; }
.pp-grid .pp-preview { width: 50px; height: 50px; margin: 5px; display: block; }
.pp-grid .medium { font-weight: 500; }
.pp-grid .money { text-align: right; font-weight: 600; }
.pp-grid .piece { color: #1976D2; }
.pp-grid .ext { color: #388E3C; font-weight: 700; }
.pp-foot {
  background: #E3F2FD;
  border-top: 1px solid #BBDEFB;
  padding: 12px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
}
#partPricingGrandTotal { font-size: 18px; color: #388E3C; margin: 0 10px 0 20px; }

/* ── Windows (dialogs) ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.08);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.window {
  background: #FFF;
  border: 1px solid #4A90D9;
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
}
.window.inactive { border-color: #AAA; }
.window-title {
  height: 30px;
  flex: none;
  display: flex;
  align-items: center;
  background: #FFF;
  padding-left: 10px;
  user-select: none;
  cursor: default;
}
.window-title .wt-icon { width: 16px; height: 16px; margin-right: 8px; }
.window-title .wt-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.window-close { width: 46px; height: 30px; border: 0; background: transparent; font-size: 14px; cursor: default; }
.window-close:hover { background: #E81123; color: #FFF; }
.window-body { flex: 1; min-height: 0; overflow: auto; position: relative; }
.window-body.no-scroll { overflow: hidden; }

.msgbox { min-width: 360px; max-width: 520px; }
.msgbox .mb-content { display: flex; padding: 22px 24px 20px 14px; gap: 12px; white-space: pre-wrap; background: #FFF; }
.msgbox .mb-icon { width: 32px; height: 32px; flex: none; border-radius: 50%; color: #FFF; font-weight: 700; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.mb-icon.info { background: #1E71CD; font-family: Georgia, serif; }
.mb-icon.warning { background: none; color: #000; }
.mb-icon.warning::before { content: ""; position: absolute; }
.mb-icon.error { background: #E81123; }
.mb-icon.question { background: #1E71CD; }
.msgbox .mb-buttons { background: #F0F0F0; padding: 10px 12px; display: flex; justify-content: flex-end; gap: 8px; }
.msgbox .mb-buttons .wpf-button { min-width: 88px; height: 26px; }

.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.flat-btn { border: 0; color: #FFF; font-weight: 600; cursor: pointer; height: 32px; min-width: 80px; padding: 0 12px; }
.flat-btn.green { background: #4CAF50; }
.flat-btn.green:hover { background: #45A049; }
.flat-btn.gray { background: #757575; }
.flat-btn.gray:hover { background: #616161; }
.flat-btn.blue { background: #3b82f6; }
.flat-btn.blue:hover { background: #2563eb; }
.flat-btn:disabled { background: #d1d5db; color: #FFF; cursor: default; }

/* New Quote window */
.newquote { padding: 20px; display: flex; flex-direction: column; height: 100%; }
.nq-title { font-size: 24px; font-weight: 700; margin-bottom: 20px; }
.nq-bar { display: flex; align-items: center; }
.nq-bar .grow { flex: 1; }
.nq-bar .wpf-button { height: 35px; margin-left: 10px; }
.nq-machine { display: flex; align-items: center; margin: 10px 0; }
.nq-machine .wpf-combo { width: 250px; height: 30px; margin-left: 10px; }
.nq-machine .wpf-button { width: 100px; height: 30px; margin-left: 10px; }
.nq-machine .hint { color: #6b7280; font-style: italic; margin-left: 10px; }
.nq-main { display: grid; grid-template-columns: 250px 1fr; gap: 15px; flex: 1; min-height: 0; margin-bottom: 20px; }
.nq-bar .ai-parse { width: 140px; height: 35px; margin-left: 10px; border: 0; background: #8b5cf6; color: #FFF; cursor: pointer; }
.nq-bar .ai-parse:hover:not(:disabled) { background: #7c3aed; }
.nq-bar .ai-parse:disabled { opacity: 0.5; cursor: default; }
.nq-doc { display: flex; align-items: center; margin-top: 10px; }
.nq-doc .wpf-text { width: 400px; height: 24px; margin: 0 10px; background: #FFF; }
.nq-doc .wpf-button { width: 100px; height: 30px; margin-right: 10px; }
.ai-progress { background: #f0f4ff; border: 2px solid #8b5cf6; border-radius: 8px; padding: 15px; margin-bottom: 10px;
  display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; }
.ai-progress[hidden] { display: none; }
.ai-progress .ai-status { font-size: 14px; font-weight: 600; color: #4c1d95; margin-bottom: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-progress .ai-percent { font-size: 14px; font-weight: 700; color: #8b5cf6; margin: 0 0 8px 10px; }
.ai-progress .ai-elapsed { font-size: 14px; color: #6b7280; margin: 0 0 8px 15px; }
.ai-progress .ai-bar { grid-column: 1 / -1; height: 12px; background: #e0e7ff; border: 1px solid #bcbcbc; }
.ai-progress .ai-bar > div { height: 100%; width: 0; background: #8b5cf6; transition: width 0.2s; }
.paste-text { width: min(640px, calc(100vw - 48px)); height: 320px; font: 12px Consolas, "Courier New", monospace; resize: vertical; }
.drop-zone {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}
.drop-zone.over { background: #e0f2fe; border-color: #3b82f6; }
.dz-icon { font-size: 48px; margin-bottom: 10px; }
.dz-title { font-size: 16px; font-weight: 600; color: #475569; }
.dz-sub { font-size: 14px; color: #64748b; }
.dz-extra { font-size: 12px; color: #94a3b8; margin: 5px 0 10px; }
.nq-grid { border-color: #d1d5db; }
.nq-grid table { width: 100%; }
.nq-grid td { height: 35px; border-right: none; border-bottom-color: #e5e7eb; }
.nq-grid td.qty input { width: 60px; }

/* Add Parts / Edit windows */
.addparts { background: #F5F5F5; padding: 20px; width: 650px; }
.ap-title { font-size: 18px; font-weight: 700; margin-bottom: 5px; }
.ap-count { font-size: 12px; color: #666; margin-bottom: 10px; }
.ap-sep { height: 1px; background: #D5D5D5; margin-bottom: 20px; }
.ap-label { font-weight: 600; margin-bottom: 5px; padding: 5px 5px 0; display: block; }
.ap-field { width: 100%; margin-bottom: 15px; height: 30px; font-size: 13px; padding-left: 8px; }
.info-box { background: #E3F2FD; border: 1px solid #2196F3; padding: 10px; color: #1976D2; margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; }

.partedit { display: grid; grid-template-columns: 1fr 1fr; padding: 16px; gap: 0; width: 780px; }
.pe-left { padding-right: 16px; border-right: 1px solid #DDD; }
.pe-right { padding-left: 16px; display: flex; flex-direction: column; }
.pe-h { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.pe-h2 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.pe-h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.pe-sep { height: 1px; background: #DDD; margin: 12px 0; }
.pe-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 8px; align-items: center; }
.pe-op { display: flex; align-items: center; margin-bottom: 6px; min-height: 22px; }
.pe-op > .wpf-check:first-child { width: 130px; }
.pe-op .unit { color: #666; margin-left: 4px; }
.pe-op .cur { margin: 0 2px 0 8px; }
.pe-preview { flex: 1; min-height: 300px; border: 2px solid #999; background: #F5F5F5; border-radius: 4px; }
.pe-preview svg { width: 100%; height: 100%; display: block; }
.pe-info { margin-top: 12px; color: #444; text-align: center; }

/* Bulk Quote */
.bulk { display: grid; grid-template-columns: 1fr 8px 1fr; padding: 16px; width: 950px; height: 550px; position: relative; }
.bulk h2 { font-size: 18px; font-weight: 700; margin: 0 0 16px; }
.bulk .col { display: flex; flex-direction: column; min-height: 0; }
.bulk .gb-fill { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bulk .gb-fill .wpf-datagrid { flex: 1; }
.bulk .err { color: red; font-size: 11px; margin-top: 4px; }
.bulk .discounts { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.bulk .disc { display: flex; flex-direction: column; align-items: center; }
.bulk .disc b { font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.bulk .disc small { font-size: 10px; color: gray; }
.bulk .ovr { width: 60px; height: 22px; text-align: center; }
.bulk-progress { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.6); }
.bulk-progress .box { background: #FFF; border: 1px solid #CCC; padding: 24px; border-radius: 4px; }
.bulk-progress .wpf-progress { width: 300px; height: 20px; }

/* Reports window */
.reports { background: #F5F5F5; padding: 20px; width: 1100px; }
.rp-card { background: #FFF; padding: 20px; border-radius: 8px; }
.rp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.rp-head h1 { font-size: 24px; font-weight: 700; color: #333; margin: 0; }
.rp-head .sub { font-size: 12px; color: #666; margin-top: 5px; }
.rp-cols { display: grid; grid-template-columns: repeat(3, 1fr); }
.rp-col { margin: 10px; padding: 20px; background: #F8F9FA; border-radius: 8px; display: flex; flex-direction: column; }
.rp-col h3 { font-size: 18px; font-weight: 700; color: #333; margin: 0 0 10px; }
.rp-col p { color: #666; margin: 0 0 20px; }
.modern-btn {
  background: #336699;
  color: #FFF;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 20px;
  margin: 5px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.modern-btn:hover:not(:disabled) { filter: brightness(.85); }
.modern-btn:disabled { opacity: .5; cursor: default; }
.modern-btn.accent { background: #3C8D40; }
.bulk-notice { background: #FFF3E0; border: 2px solid #FF9800; border-radius: 4px; padding: 8px; margin-bottom: 10px; font-weight: 700; color: #E65100; }
.rp-status { background: #FFF; padding: 10px 15px; border-radius: 8px; margin-top: 20px; display: flex; align-items: center; justify-content: space-between; color: #666; }
.rp-close { background: #888; color: #FFF; border: 0; padding: 8px 20px; cursor: pointer; }
.quick { background: #673AB7; color: #FFF; border: 0; font-weight: 600; padding: 8px 15px; cursor: pointer; }

/* Saved Quotes (QuotesBrowserWindow) */
.quotes-browser { background: #F5F5F5; padding: 20px; width: 900px; height: 600px; display: grid; grid-template-rows: auto auto 1fr auto; }
.qb-title { font-size: 24px; font-weight: 700; color: #333; margin-bottom: 15px; }
.qb-search { display: grid; grid-template-columns: 1fr 150px auto; gap: 10px; align-items: center; margin-bottom: 15px; }
.qb-search .wpf-text, .qb-search .wpf-combo { height: 34px; font-size: 14px; border-color: #CCC; background-color: #FFF; }
.qb-grid { background: #FFF; border-color: #CCC; }
.qb-grid table { width: 100%; }
.qb-grid td { height: 28px; }
.qb-grid tbody tr:nth-child(even) td { background: #F9F9F9; }
.qb-grid tbody tr.selected td { background: #0078D7; color: #FFF; }
.qb-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.qb-status { color: #888; }
.action-btn { background: #0078D4; color: #FFF; border: 0; padding: 8px 15px; margin: 5px; cursor: pointer; }
.action-btn:hover:not(:disabled) { background: #106EBE; }
.action-btn:disabled { background: #CCC; cursor: default; }
.secondary-btn { background: #E1E1E1; color: #333; border: 1px solid #CCC; padding: 8px 15px; margin: 5px; cursor: pointer; }
.secondary-btn:hover { background: #D0D0D0; }

/* Settings windows */
.settings-body { padding: 16px; }
.section-h { font-weight: 700; font-size: 13px; margin: 12px 0 4px; }
.section-h:first-child { margin-top: 0; }
.section-sep { height: 1px; background: #D5D5D5; margin-bottom: 10px; }
.rate-row { display: grid; grid-template-columns: 1fr auto 100px; gap: 6px; align-items: center; margin-bottom: 8px; }
.defaults { background: #F5F5F5; padding: 12px; width: 480px; }
.defaults .wpf-groupbox { --gb-bg: #F5F5F5; background: #F5F5F5; margin-bottom: 10px; }
.defaults .row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.defaults .row > span:first-child { width: 110px; }
.defaults .wpf-check { margin-bottom: 6px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid #E5E5E5; background: #FFF; }
.dlg-foot.gray { background: #F0F0F0; }
.dlg-foot .wpf-button { min-width: 80px; height: 30px; }
.color-btn { border: 0; color: #FFF; height: 30px; padding: 0 14px; cursor: pointer; }

.materials { width: 1400px; height: 760px; display: flex; flex-direction: column; }
.mat-bar { display: flex; align-items: center; gap: 6px; padding: 10px; flex-wrap: wrap; }
.mat-bar .wpf-button { height: 26px; }
.mat-grid { flex: 1; margin: 0 10px 10px; }
.mat-grid table { width: 100%; }
.mat-grid td input, .mat-grid td select { width: 100%; border: 1px solid transparent; background: transparent; text-align: right; padding: 1px 2px; }
/* the text columns (material, grade, part code) read left to right */
.mat-grid td:nth-child(1) input, .mat-grid td:nth-child(2) input, .mat-grid td:nth-child(7) input { text-align: left; }
.mat-grid td select { text-align: left; height: 20px; }
/* room for the editable text columns (the desktop's grid sizes to its content) */
.mat-grid th:nth-child(1), .mat-grid td:nth-child(1) { min-width: 120px; }
.mat-grid th:nth-child(2), .mat-grid td:nth-child(2) { min-width: 110px; }
.mat-grid th:nth-child(7), .mat-grid td:nth-child(7) { min-width: 110px; }
.mat-grid th:nth-child(3), .mat-grid td:nth-child(3),
.mat-grid th:nth-child(4), .mat-grid td:nth-child(4),
.mat-grid th:nth-child(5), .mat-grid td:nth-child(5) { min-width: 70px; }
.mat-grid th:nth-child(6), .mat-grid td:nth-child(6) { min-width: 110px; }
.mat-grid td input:focus { border-color: var(--focus-border); background: #FFF; outline: none; }
.mat-grid tr.dirty td { background: #FFFDE7; }
.no-selection { padding: 40px; font-size: 14px; color: gray; text-align: center; }

.machines { width: 900px; padding: 12px; }
.machines .wpf-datagrid { height: 220px; background: #F5F5F5; }
.machines table { width: 100%; }
.machine-details .kvline { display: grid; grid-template-columns: 180px 1fr; gap: 4px 8px; align-items: center; margin-bottom: 4px; }
.pe-scale { display: flex; gap: 8px; margin: 6px 0; }
.pe-scale .wpf-button { width: 100px; height: 28px; }
.support-dlg { width: 560px; padding: 16px; }
.support-dlg textarea { width: 100%; margin-top: 6px; }
.export-files { width: 820px; padding: 12px; }
.export-files .wpf-datagrid { height: 300px; background: #F5F5F5; }
.export-files table { width: 100%; }
.ef-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ef-row .wpf-button { width: 110px; height: 26px; }
.ef-count { color: #555; margin-left: auto; }
.ef-hint { color: #666; margin-top: 8px; }
.customers { width: 940px; padding: 12px; }
.customers .wpf-datagrid { height: 300px; background: #F5F5F5; }
.customers table { width: 100%; }
.customers tr.selected { background: #CCE4F7; }
.cust-bar { display: flex; gap: 8px; margin-bottom: 8px; }
.cust-bar .wpf-button { width: 130px; height: 26px; }
.cust-form { width: 520px; padding: 16px; }
.cust-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cust-row > .cust-label { width: 140px; flex: none; font-weight: 600; }
.cust-row > .wpf-text { flex: 1; }
.cust-check { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; }
/* the button beside the Customer box in Job Settings */
.js-icon-button { margin-left: 4px; width: 26px; height: 24px; flex: none; border: 1px solid #ABADB3; background: #F0F0F0; cursor: pointer; border-radius: 2px; }
.js-icon-button:hover { background: #E3F0FC; border-color: #7EB4EA; }
.tt-bar { display: flex; gap: 8px; margin-bottom: 8px; }
.tt-bar .wpf-button { width: 110px; height: 26px; }
.techtable tr.selected { background: #CCE4F7; }
.techtable td input { border: 1px solid transparent; background: transparent; height: 20px; }
.techtable td input:focus { border-color: #7EB4EA; background: #fff; }
.techtable { width: 940px; height: 640px; display: flex; flex-direction: column; padding: 12px; }
.techtable .wpf-datagrid { flex: 1; background: #F9F9F9; }
.techtable table { width: 100%; }
.techtable td input { width: 100%; border: 1px solid transparent; background: transparent; padding: 1px 2px; }
.techtable td input:focus { border-color: var(--focus-border); background: #FFF; outline: none; }

.company { width: 550px; }
.company .row { display: grid; grid-template-columns: 110px 1fr; gap: 6px; align-items: center; margin-bottom: 8px; }
.company .addr { display: grid; grid-template-columns: 70px 1fr 90px; gap: 6px; }
.company .csz { display: grid; grid-template-columns: 1fr 60px 90px; gap: 6px; }
.company .text-preview { background: #FAFAFA; border: 1px solid #DDD; padding: 10px; }
.logo-box { background: #F9F9F9; border: 1px solid #DDD; height: 80px; display: flex; align-items: center; justify-content: center; margin-top: 6px; }
.logo-box img { max-height: 70px; max-width: 100%; }

.terms textarea { width: 100%; height: 140px; font-size: 12px; }
.terms .text-preview { background: #FAFAFA; border: 1px solid #DDD; height: 100px; overflow: auto; padding: 6px; font-size: 10px; color: #666; }

.quicksettings { width: 520px; }
.quicksettings .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }

/* User Guide (desktop HelpCenterWindow: its own dark palette with the orange accent) */
.gloss dt { font-weight: 700; color: #E0E0E0; margin-top: 10px; }
.gloss dd { margin: 2px 0 0; color: #C8C8C8; }

.about { width: 420px; padding: 20px; text-align: center; }
.bundle-dlg { width: min(520px, calc(100vw - 48px)); padding: 16px 20px; }
.bundle-dlg .bundle-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; word-break: break-all; }
.bundle-dlg ul { margin: 8px 0 12px; padding-left: 22px; }
.bundle-dlg li { margin: 3px 0; }
.bundle-dlg .hint { color: #666; margin-bottom: 12px; }
.bundle-dlg .bundle-warn { color: #92400E; background: #FEF3C7; border: 1px solid #F59E0B; padding: 6px 8px; margin-bottom: 12px; white-space: pre-line; }
.about img { width: 240px; height: auto; margin: 10px 0 16px; }

/* ── Tablet (iPad landscape 1024, portrait 768): no horizontal page scroll ─────────────────────────
   The desktop layout (2* | 3* columns in one screen) needs ~1180px. Below that the quoting page scrolls
   vertically: combination + parts grid next to job settings + pricing, then the nest controls and the
   sheet view at full width. Below 900px everything is one column. */
@media (max-width: 1179px) {
  #app { min-width: 0; }
  .toolbar-fill { min-width: 0; }
  .quoting { display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
  .quoting:has(> .welcome:not([hidden])) { overflow: hidden; }
  .left-col {
    flex: none;
    grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
    grid-template-rows: auto auto;
    grid-template-areas: "combo settings" "grid pricing";
  }
  .combo-panel { grid-area: combo; }
  .parts-grid-wrap { grid-area: grid; height: 340px; margin-top: 4px; }
  .job-settings { grid-area: settings; margin-top: 4px; }
  .pricing-panel { grid-area: pricing; height: 340px; }
  .right-col { flex: none; height: max(560px, calc(100vh - 72px)); border-top: 1px solid #CCCCCC; margin-top: 4px; }
  .controls-grid { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
  .ctl-row { white-space: normal; }
  .ctl-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}
@media (max-width: 899px) {
  .left-col { grid-template-columns: minmax(0, 1fr); grid-template-areas: "combo" "grid" "settings" "pricing"; }
  .parts-grid-wrap { height: auto; max-height: 360px; min-height: 140px; }
  .pricing-panel { height: auto; max-height: 460px; }
  .controls-grid { grid-template-columns: minmax(0, 1fr); }
  .controls-right { margin: 12px 0 0; }
  .ctl-hint { display: none; }
}

/* Email Quote (Lite) */
.eq { width: 560px; max-width: calc(100vw - 40px); padding: 14px 16px; }
.eq-intro { color: #374151; margin-bottom: 10px; line-height: 1.45; }
.eq-note { background: #FFF8E1; border: 1px solid #FFE082; padding: 6px 10px; margin-bottom: 10px; color: #795548; }
.eq-row { display: grid; grid-template-columns: 70px 1fr; align-items: start; gap: 8px; margin-bottom: 8px; }
.eq-label { padding-top: 4px; }
.eq textarea.eq-body { width: 100%; height: 220px; font-family: inherit; }
.eq-history { margin: 6px 0 4px 78px; color: #4B5563; font-size: 12px; line-height: 1.5; }
.eq-status { min-height: 18px; margin: 6px 0 0 78px; color: #4B5563; white-space: pre-line; }
.eq-status.error { color: #B71C1C; }
.eq .dlg-buttons { margin-top: 10px; }

/* Delete My Account (Lite) */
.wpf-button.danger { color: #B71C1C; }
.wpf-button.danger:disabled { color: #838383; }
.delete-account { width: 480px; max-width: calc(100vw - 40px); padding: 14px 16px; line-height: 1.45; }
.delete-account ul { margin: 6px 0 10px; padding-left: 20px; color: #374151; }
.delete-account .eq-status { margin-left: 0; }

/* Phones (Lite): the quoting screen is replaced by a notice below 700px */
.phone-notice { position: fixed; inset: 0; z-index: 180; background: #F8FAFC; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; box-sizing: border-box; }
.phone-notice[hidden] { display: none; }
.phone-card { background: #FFF; border: 1px solid #E2E8F0; border-left: 4px solid #1976D2; border-radius: 8px; padding: 20px; max-width: 420px; width: 100%; box-sizing: border-box; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.phone-logo { width: 150px; height: auto; display: block; margin-bottom: 14px; }
.phone-card h1 { font-size: 20px; line-height: 1.3; margin: 0 0 10px; color: #111827; }
.phone-card p { color: #475569; line-height: 1.55; margin: 0 0 10px; font-size: 14px; }
.phone-sub { color: #64748b; font-size: 13px; }
.phone-actions { display: flex; gap: 10px; align-items: center; margin: 16px 0 14px; }
.phone-actions .signin-button { flex: 1; width: auto; height: 44px; margin: 0; flex-direction: row; font-size: 14px; font-weight: 700; }
.phone-secondary { height: 44px; padding: 0 18px; border: 1px solid #CBD5E1; border-radius: 6px; background: #FFF; color: #1F2937; font-size: 14px; cursor: pointer; }
.phone-continue { color: #64748b; font-size: 13px; }
@media (max-width: 699px) {
  /* Windows opened from the notice (Account, Delete My Account, message boxes) use the whole width. */
  .modal-backdrop { align-items: flex-start; padding-top: 8px; }
  .window { max-height: calc(100dvh - 16px); }
  .msgbox { min-width: 0; max-width: calc(100vw - 16px); }
  .account .row { grid-template-columns: 96px minmax(0, 1fr); }
  .account .row .wpf-text { min-width: 0; width: 100%; }
  .dlg-foot { flex-wrap: wrap; }
  .signin-card { padding: 20px 18px; }
  /* iOS Safari zooms into inputs under 16px; touch targets of at least 40px. */
  .signin-input, .account input.wpf-text, .delete-account input.wpf-text { font-size: 16px; height: 40px; }
  .account .wpf-button, .dlg-foot .wpf-button, .delete-account .wpf-button, .msgbox .mb-buttons .wpf-button { min-height: 40px; }
  .window-close { min-width: 40px; min-height: 30px; }
}

/* Customer Portal settings (Lite) */
.portal-settings { width: 720px; max-width: calc(100vw - 40px); padding: 14px 16px; }
.ps-intro { margin: 0 0 10px; color: #374151; line-height: 1.45; }
.ps-prefix { color: #6B7280; margin-right: 2px; }
.ps-link { margin-top: 4px; font-size: 12px; }
.ps-link a { color: #1976D2; word-break: break-all; }
.ps-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 6px; }
.ps-count { color: #6B7280; flex: 1; }
.ps-grid { height: 260px; }
.ps-grid table.grid { width: 100%; }
.ps-grid td { padding: 3px 6px; height: auto; }
.ps-grid td .wpf-combo { height: 24px; }
.ps-grid tr[hidden] { display: none; }

/* Change Password (Lite) */
.change-password { width: 420px; max-width: calc(100vw - 40px); padding: 14px 16px; }
.change-password p { margin: 0 0 12px; color: #374151; line-height: 1.45; }
.change-password .eq-status { margin-left: 0; }
