:root {
  --ink: #171717;
  --ink-soft: #676869;
  --paper: #eeeeee;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --line: #c6c7c8;
  --gold: #e51e21;
  --gold-dark: #b81619;
  --green: #2f6b50;
  --green-soft: #e8f1ec;
  --red: #a7483d;
  --red-soft: #f8eae7;
  --blue: #3e5c76;
  --shadow: 0 20px 50px rgba(32, 29, 22, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 5%, rgba(179, 144, 82, 0.12), transparent 30%),
    var(--paper);
  font-family: Arimo, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  color: #f8f4eb;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand, .mobile-brand {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-align: left;
  padding: 0 8px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark, .mobile-brand {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font: 600 24px/1 Georgia, serif;
}

.brand strong { display: block; font: 700 18px/1 Arimo, sans-serif; letter-spacing: 0.22em; }
.brand small { display: block; margin-top: 7px; color: #aaa79f; font-size: 9px; letter-spacing: 0.16em; }

.main-nav { display: grid; gap: 7px; margin-top: 28px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  color: #bbb8b0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}
.nav-item:hover, .nav-item.is-active { color: #fff; background: rgba(255,255,255,0.08); }
.nav-item.is-active { box-shadow: inset 2px 0 var(--gold); }
.nav-icon { width: 20px; color: var(--gold); font-size: 17px; }

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #d8d4cb;
  background: rgba(255,255,255,0.04);
}
.sidebar-note.is-online .status-dot { background: #49b578; box-shadow: 0 0 0 4px rgba(73,181,120,.13); }
.sidebar-note.is-error .status-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(229,30,33,.13); }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-note small { margin-top: 4px; color: #8f8c85; font-size: 10px; }
.status-dot { width: 8px; height: 8px; margin-top: 3px; border-radius: 50%; background: #79b394; box-shadow: 0 0 0 4px rgba(121,179,148,.12); }

.main-content { min-width: 0; }
.topbar {
  min-height: 106px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px clamp(24px, 4vw, 56px);
  border-bottom: 1px solid rgba(91, 82, 63, 0.12);
  background: rgba(244,241,234,.8);
  backdrop-filter: blur(14px);
}
.topbar-copy { min-width: 0; }
.topbar-copy p { margin: 0 0 5px; color: var(--gold-dark); font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.topbar-copy h1 { margin: 0; font: 500 clamp(25px, 3vw, 36px)/1.1 Gelasio, Georgia, serif; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.user-chip > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; background: var(--ink); font-size: 11px; font-weight: 700; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { font-size: 12px; }
.user-chip small { margin-top: 2px; color: #77736b; font-size: 10px; }
.mobile-brand { display: none; flex: 0 0 auto; }

.view { padding: 34px clamp(24px, 4vw, 56px) 70px; }
.content-limit { max-width: 1220px; margin: 0 auto; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font: 500 25px/1.2 Gelasio, Georgia, serif; }
.section-heading p { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; }

.hero-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 30px;
  align-items: center;
  min-height: 236px;
  padding: clamp(28px, 4vw, 48px);
  border-radius: 24px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
}
.hero-panel::after { content: ""; position: absolute; right: -80px; top: -170px; width: 430px; height: 430px; border: 1px solid rgba(179,144,82,.35); border-radius: 50%; box-shadow: 0 0 0 60px rgba(179,144,82,.035), 0 0 0 120px rgba(179,144,82,.025); }
.hero-panel > * { position: relative; z-index: 1; }
.hero-kicker { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.hero-panel h2 { max-width: 650px; margin: 12px 0 10px; font: 400 clamp(30px, 4vw, 48px)/1.05 Gelasio, Georgia, serif; }
.hero-panel p { max-width: 620px; margin: 0; color: #bcb8af; line-height: 1.65; }
.hero-actions { display: flex; justify-content: flex-end; }

.primary-button, .secondary-button, .ghost-button, .danger-button {
  border: 0;
  border-radius: 10px;
  padding: 12px 17px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .02em;
  cursor: pointer;
  transition: 160ms ease;
}
.primary-button { color: #fff; background: var(--gold-dark); box-shadow: 0 8px 22px rgba(119,93,48,.22); }
.primary-button:hover { transform: translateY(-1px); background: #8a6b38; }
.secondary-button { color: #fff; background: var(--ink); }
.secondary-button:hover { background: #303028; }
.ghost-button { border: 1px solid var(--line); background: transparent; }
.ghost-button:hover { background: var(--surface-2); }
.danger-button { color: var(--red); background: var(--red-soft); }
.compact { padding: 9px 12px; font-size: 11px; }
.wide { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0 34px; }
.stat-card, .panel, .service-card, .choice-card, .customer-card, .profile-card {
  border: 1px solid rgba(98,88,68,.13);
  background: rgba(255,253,250,.86);
  box-shadow: 0 10px 28px rgba(34,30,23,.04);
}
.stat-card { padding: 20px; border-radius: 14px; }
.stat-card span { color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 10px; font: 500 28px/1 Gelasio, Georgia, serif; }
.stat-card small { display: block; margin-top: 8px; color: #7d786f; font-size: 11px; }

.two-column { display: grid; grid-template-columns: 1.4fr .6fr; gap: 20px; align-items: start; }
.panel { border-radius: var(--radius); padding: 24px; }
.panel + .panel { margin-top: 18px; }
.panel-title { margin: 0 0 18px; font: 500 20px/1.2 Gelasio, Georgia, serif; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 10px 12px; color: #777168; border-bottom: 1px solid var(--line); text-align: left; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.data-table td { padding: 14px 12px; border-bottom: 1px solid #ebe6dc; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table strong { display: block; }
.data-table small { color: #7e786e; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.badge.gold { color: var(--gold-dark); background: #f1e8d5; }
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.blue { color: var(--blue); background: #e8eef4; }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.neutral { color: #5d5a53; background: #ece9e2; }

.activity-list { display: grid; gap: 16px; }
.activity-item { display: grid; grid-template-columns: 9px 1fr; gap: 12px; }
.activity-item::before { content: ""; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(179,144,82,.1); }
.activity-item strong, .activity-item small { display: block; }
.activity-item strong { font-size: 12px; }
.activity-item small { margin-top: 4px; color: #79746b; line-height: 1.45; }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; max-width: 900px; margin: 0 auto 28px; }
.step { position: relative; text-align: center; color: #8a857c; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.step::before { content: ""; position: absolute; left: 0; right: 0; top: 14px; height: 1px; background: var(--line); z-index: -1; }
.step:first-child::before { left: 50%; }
.step:last-child::before { right: 50%; }
.step-number { display: grid; place-items: center; width: 29px; height: 29px; margin: 0 auto 8px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); }
.step.is-active, .step.is-done { color: var(--ink); }
.step.is-active .step-number { color: #fff; border-color: var(--ink); background: var(--ink); }
.step.is-done .step-number { color: #fff; border-color: var(--gold-dark); background: var(--gold-dark); }

.workflow-panel { max-width: 1020px; margin: 0 auto; }
.workflow-header { margin-bottom: 24px; text-align: center; }
.workflow-header h2 { margin: 0; font: 500 29px/1.2 Gelasio, Georgia, serif; }
.workflow-header p { margin: 8px auto 0; max-width: 670px; color: var(--ink-soft); line-height: 1.55; }
.choice-grid, .service-grid { display: grid; gap: 16px; }
.choice-grid { grid-template-columns: repeat(2, 1fr); max-width: 780px; margin: 0 auto; }
.service-grid { grid-template-columns: repeat(3, 1fr); }
.choice-card, .service-card { border-radius: var(--radius); text-align: left; cursor: pointer; transition: 180ms ease; }
.choice-card { min-height: 210px; padding: 28px; }
.service-card { min-height: 175px; padding: 22px; }
.choice-card:hover, .service-card:hover, .customer-card:hover { transform: translateY(-2px); border-color: rgba(119,93,48,.5); box-shadow: var(--shadow); }
.choice-symbol, .service-symbol { display: grid; place-items: center; color: var(--gold-dark); border: 1px solid rgba(179,144,82,.35); background: #faf4e9; }
.choice-symbol { width: 54px; height: 54px; border-radius: 50%; font: 400 25px Georgia, serif; }
.service-symbol { width: 42px; height: 42px; border-radius: 12px; font-size: 19px; }
.choice-card h3, .service-card h3 { margin: 22px 0 7px; font: 500 20px/1.2 Gelasio, Georgia, serif; }
.service-card h3 { margin-top: 17px; }
.choice-card p, .service-card p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.service-route { display: inline-block; margin-top: 14px; color: var(--gold-dark); font-size: 9px; font-weight: 800; letter-spacing: .08em; }

.search-box { position: relative; max-width: 650px; margin: 0 auto 18px; }
.search-box input { width: 100%; padding: 16px 18px 16px 46px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); outline: none; }
.search-box input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(179,144,82,.12); }
.search-box::before { content: "⌕"; position: absolute; left: 17px; top: 11px; color: var(--gold-dark); font-size: 24px; }
.customer-results { display: grid; gap: 10px; max-width: 750px; margin: 0 auto; }
.customer-card { width: 100%; display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 13px; text-align: left; cursor: pointer; }
.customer-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: #fff; background: var(--ink); font-size: 11px; font-weight: 800; }
.customer-card-copy { min-width: 0; flex: 1; }
.customer-card-copy strong, .customer-card-copy small { display: block; }
.customer-card-copy small { margin-top: 4px; color: #7c776e; }
.customer-card-meta { color: var(--gold-dark); font-size: 10px; font-weight: 800; }

.form-card { border: 1px solid rgba(98,88,68,.15); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.form-section { padding: 25px; border-bottom: 1px solid #e8e3d9; }
.form-section:last-child { border-bottom: 0; }
.form-section-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.form-section-header h3 { margin: 0; font: 500 20px/1.2 Gelasio, Georgia, serif; }
.form-section-header p { margin: 5px 0 0; color: #7c776e; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 15px; }
.field { grid-column: span 4; display: grid; align-content: start; gap: 7px; }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: span 3; }
.field.span-4 { grid-column: span 4; }
.field.span-6 { grid-column: span 6; }
.field.span-8 { grid-column: span 8; }
.field.span-12 { grid-column: 1 / -1; }
.field label { color: #59554e; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(179,144,82,.1); }
.field small { color: #8b857b; font-size: 9px; line-height: 1.4; }

.inline-switch { display: flex; align-items: center; gap: 9px; color: #5f5b53; font-size: 11px; font-weight: 700; }
.inline-switch input { accent-color: var(--gold-dark); }
.current-profile { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px solid #d8e4dc; border-radius: 10px; background: var(--green-soft); }
.current-profile span { color: var(--green); font-size: 10px; }
.current-profile strong { margin-left: 3px; }

.demo-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(229, 30, 33, .3);
  border-radius: 9px;
  color: #8f1618;
  background: #fff0f0;
}
.demo-warning strong { flex: 0 0 auto; font-size: 9px; letter-spacing: .08em; }
.demo-warning span { font-size: 10px; line-height: 1.45; }

.measurement-matrix { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.measurement-matrix-head, .measurement-row { display: grid; grid-template-columns: minmax(145px, 1.25fr) repeat(2, minmax(90px, 1fr)); align-items: center; gap: 1px; }
.measurement-matrix-head { color: #fff; background: var(--ink); }
.measurement-matrix-head span { padding: 10px 12px; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.measurement-row { border-top: 1px solid #e4e4e4; background: #eeeeee; }
.measurement-row label { height: 100%; display: flex; align-items: center; padding: 10px 12px; color: #4e4e4e; background: #f7f7f7; font-size: 10px; font-weight: 700; }
.measurement-row input { width: 100%; min-width: 0; height: 42px; padding: 8px 11px; border: 0; outline: none; background: #fff; }
.measurement-row input:focus { position: relative; z-index: 1; box-shadow: inset 0 0 0 2px var(--gold); }
.garment-calculator .calculator-button { width: 100%; margin-top: 13px; color: #fff; border-color: rgba(255,255,255,.25); }

.preset-summary { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 16px; border-radius: 12px; background: #f4f0e7; }
.preset-art { min-height: 135px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.preset-art svg { width: 94px; height: 120px; }
.preset-summary h4 { margin: 2px 0 7px; font: 500 17px Gelasio, Georgia, serif; }
.preset-summary p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.preset-summary dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 13px 0 0; }
.preset-summary dt { color: #8b857c; font-size: 9px; text-transform: uppercase; }
.preset-summary dd { margin: 1px 0 0; font-size: 11px; font-weight: 700; }

.calculator { padding: 18px; border-radius: 13px; color: #fff; background: var(--ink); }
.calculator-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.calculator-head strong { font: 500 17px Gelasio, Georgia, serif; }
.calculator-head span { color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.formula-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.formula-result { padding: 12px 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; text-align: center; background: rgba(255,255,255,.04); }
.formula-result.is-selected { border-color: var(--gold); background: rgba(179,144,82,.16); }
.formula-result small, .formula-result strong { display: block; }
.formula-result small { color: #aaa69d; font-size: 8px; text-transform: uppercase; }
.formula-result strong { margin-top: 5px; font: 500 18px Gelasio, Georgia, serif; }
.trial-result { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 13px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.13); }
.trial-result small { color: #aaa69d; }
.trial-result strong { color: var(--gold); font: 500 22px Gelasio, Georgia, serif; }

.correction-row { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.correction-row .field { grid-column: auto; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 9px; color: var(--red); background: #fff; cursor: pointer; }

.workflow-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.workflow-actions-right { display: flex; gap: 10px; margin-left: auto; }

.summary-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; align-items: start; }
.summary-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.summary-card h3 { margin: 0 0 18px; font: 500 20px Gelasio, Georgia, serif; }
.summary-list { display: grid; gap: 0; margin: 0; }
.summary-list div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 11px 0; border-bottom: 1px solid #ebe7de; }
.summary-list div:last-child { border-bottom: 0; }
.summary-list dt { color: #827d74; font-size: 10px; text-transform: uppercase; }
.summary-list dd { margin: 0; font-size: 12px; font-weight: 700; }
.route-card { padding: 22px; border-radius: var(--radius); color: #fff; background: var(--ink); }
.route-card .route-label { color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.route-card h3 { margin: 12px 0 8px; font: 500 24px Gelasio, Georgia, serif; }
.route-card p { margin: 0; color: #b9b5ac; font-size: 11px; line-height: 1.5; }
.route-card code { display: block; margin-top: 16px; padding: 10px; border-radius: 8px; color: #dbd6cc; background: rgba(255,255,255,.07); font-size: 10px; }
.external-destination { display: grid; gap: 3px; margin-top: 15px; padding: 11px; border: 1px solid rgba(229,30,33,.5); border-radius: 9px; background: rgba(229,30,33,.12); }
.external-destination strong { color: #fff; font-size: 10px; }
.external-destination span { color: #c6c6c6; font-size: 9px; }
.trello-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 16px; }
.trello-fields > small { grid-column: 1 / -1; color: #a5a5a5; font-size: 8px; letter-spacing: .1em; }
.trello-fields span { display: grid; gap: 2px; padding: 7px; border-radius: 6px; background: rgba(255,255,255,.06); color: #d3d3d3; font-size: 8px; }
.trello-fields b { color: #fff; font-size: 7px; letter-spacing: .05em; }

.customer-directory { display: grid; grid-template-columns: 340px 1fr; gap: 20px; }
.directory-list { display: grid; gap: 9px; }
.directory-button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; text-align: left; cursor: pointer; }
.directory-button.is-active { border-color: var(--gold); background: #faf5eb; }
.directory-button strong, .directory-button small { display: block; }
.directory-button small { margin-top: 3px; color: #847e74; }
.profile-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.profile-header h2 { margin: 0; font: 500 28px Gelasio, Georgia, serif; }
.profile-header p { margin: 5px 0 0; color: #777168; font-size: 11px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.profile-card { padding: 17px; border-radius: 13px; }
.profile-card h4 { margin: 0 0 12px; font: 500 16px Gelasio, Georgia, serif; }
.measure-group + .measure-group { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.measure-group small { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.measure-list { display: flex; flex-wrap: wrap; gap: 7px; }
.measure-list span { padding: 6px 8px; border-radius: 7px; color: #4f4b44; background: #efebe3; font-size: 9px; }
.measurement-row > label span, .measurement-row > label small { display: block; }
.measurement-row > label small { margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 400; line-height: 1.25; }
.calculator-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.source-note { border-color: rgba(23,23,23,.16); background: #f1f0ed; }
.source-note strong { color: var(--ink); }
.size-load-status { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f7f6f3; color: var(--muted); font-size: 11px; }
.size-load-status.is-loaded { border-color: rgba(30,112,75,.28); background: #edf7f1; color: #185f40; }

.image-choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.image-choice { position: relative; display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.image-choice:hover { transform: translateY(-1px); border-color: #a7a198; }
.image-choice.is-selected { border: 2px solid var(--accent); box-shadow: 0 0 0 3px rgba(229,30,33,.09); }
.image-choice input { position: absolute; opacity: 0; pointer-events: none; }
.image-choice img { display: block; width: 100%; aspect-ratio: 1.45 / 1; object-fit: contain; padding: 8px; background: #f5f4f1; }
.image-choice > span { display: flex; justify-content: space-between; gap: 8px; padding: 10px; }
.image-choice strong { font-size: 11px; line-height: 1.3; }
.image-choice small { color: var(--muted); font-size: 9px; }
.waistcoat-pdf-image { display: block; width: 100%; max-height: 320px; object-fit: contain; }
.art-caption { display: block; margin-top: 8px; color: var(--muted); text-align: center; }

.empty-state { padding: 45px 20px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }
.empty-state strong { display: block; font: 500 20px Gelasio, Georgia, serif; }
.empty-state p { max-width: 500px; margin: 8px auto 0; color: #7d776e; font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(18,18,15,.72); backdrop-filter: blur(8px); }
.modal { width: min(960px, 100%); max-height: calc(100vh - 48px); overflow: auto; border-radius: 18px; background: var(--paper); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 20px; border-bottom: 1px solid var(--line); background: rgba(244,241,234,.95); backdrop-filter: blur(8px); }
.modal-header h2 { margin: 0; font: 500 20px Gelasio, Georgia, serif; }
.modal-close { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.modal-body { padding: 24px; }

.pdf-page { width: min(100%, 794px); min-height: 1080px; margin: 0 auto 20px; padding: 38px; border: 1px solid #ddd5c7; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.08); }
.pdf-brand { display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.pdf-brand strong { font: 700 22px Arimo, sans-serif; letter-spacing: .18em; }
.pdf-brand span { color: #777; font-size: 10px; }
.pdf-title { display: flex; justify-content: space-between; gap: 20px; margin: 28px 0; }
.pdf-title h2 { margin: 0; font: 500 29px Gelasio, Georgia, serif; }
.pdf-title p { margin: 5px 0 0; color: #777; font-size: 11px; }
.pdf-code { text-align: right; }
.pdf-code strong { display: block; font-size: 18px; }
.pdf-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pdf-block { margin-bottom: 20px; }
.pdf-block h3 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid #bbb; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.pdf-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #ddd; border: 1px solid #ddd; }
.pdf-kv div { min-height: 39px; padding: 8px; background: #fff; }
.pdf-kv small, .pdf-kv strong { display: block; }
.pdf-kv small { color: #777; font-size: 8px; text-transform: uppercase; }
.pdf-kv strong { margin-top: 4px; font-size: 10px; }
.pdf-art { min-height: 260px; display: grid; place-items: center; border: 1px solid #bbb; }
.pdf-art svg { width: 175px; height: 230px; }
.pdf-note { min-height: 100px; padding: 12px; border: 1px solid #bbb; white-space: pre-wrap; font-size: 11px; line-height: 1.5; }
.pdf-footer { margin-top: 28px; padding-top: 10px; border-top: 1px solid #bbb; display: flex; justify-content: space-between; color: #777; font-size: 8px; }

.toast-root { position: fixed; z-index: 200; right: 22px; bottom: 22px; display: grid; gap: 10px; }
.toast { width: min(370px, calc(100vw - 44px)); padding: 14px 16px; border-radius: 11px; color: #fff; background: var(--ink); box-shadow: 0 18px 50px rgba(0,0,0,.25); animation: toast-in 180ms ease; }
.toast strong, .toast span { display: block; }
.toast strong { font-size: 12px; }
.toast span { margin-top: 4px; color: #bbb7ae; font-size: 10px; line-height: 1.4; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column, .summary-grid { grid-template-columns: 1fr; }
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-actions { justify-content: flex-start; }
  .field { grid-column: span 6; }
  .field.span-2, .field.span-3, .field.span-4 { grid-column: span 6; }
  .customer-directory { grid-template-columns: 280px 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: auto 0 0 0; width: auto; height: 67px; padding: 8px 14px; flex-direction: row; align-items: center; }
  .brand, .sidebar-note { display: none; }
  .main-nav { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0; }
  .nav-item { justify-content: center; padding: 9px 4px; font-size: 10px; }
  .nav-icon { width: auto; }
  .topbar { min-height: 82px; padding: 16px 18px; }
  .mobile-brand { display: grid; }
  .topbar-actions .ghost-button, .user-chip div { display: none; }
  .user-chip { padding-left: 0; border-left: 0; }
  .view { padding: 24px 16px 95px; }
  .stats-grid, .choice-grid, .service-grid, .profile-grid, .customer-directory { grid-template-columns: 1fr; }
  .choice-card { min-height: 170px; }
  .step { font-size: 0; }
  .field, .field.span-2, .field.span-3, .field.span-4, .field.span-6, .field.span-8 { grid-column: 1 / -1; }
  .preset-summary { grid-template-columns: 100px 1fr; }
  .preset-summary dl { grid-template-columns: 1fr; }
  .formula-grid { grid-template-columns: repeat(2, 1fr); }
  .correction-row { grid-template-columns: 1fr 1fr; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .correction-row .field:first-child, .correction-row .field:nth-child(4) { grid-column: 1 / -1; }
  .workflow-actions { align-items: stretch; flex-direction: column; }
  .workflow-panel > .workflow-actions { position: sticky; z-index: 15; bottom: 72px; margin: 18px -8px -10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(238,238,238,.95); box-shadow: 0 -8px 24px rgba(0,0,0,.08); backdrop-filter: blur(10px); }
  .workflow-actions-right { width: 100%; margin-left: 0; }
  .workflow-actions-right button { flex: 1; }
  .summary-list div { grid-template-columns: 110px 1fr; }
  .pdf-page { min-height: 0; padding: 24px; }
  .pdf-columns { grid-template-columns: 1fr; }
  .measurement-matrix-head, .measurement-row { grid-template-columns: minmax(105px, 1.15fr) repeat(2, minmax(70px, 1fr)); }
  .measurement-matrix-head span, .measurement-row label { padding-left: 8px; padding-right: 8px; }
  .demo-warning { align-items: flex-start; flex-direction: column; gap: 5px; }
  .trello-fields { grid-template-columns: 1fr; }
  .image-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .size-load-status { align-items: stretch; flex-direction: column; }
  .size-load-status button { width: 100%; }
}

@media print {
  body { background: #fff; }
  .app-shell, .modal-header { display: none !important; }
  .modal-backdrop { position: static; display: block; padding: 0; background: #fff; }
  .modal { width: 100%; max-height: none; overflow: visible; box-shadow: none; background: #fff; }
  .modal-body { padding: 0; }
  .pdf-page { width: 210mm; min-height: 297mm; margin: 0; padding: 13mm; border: 0; box-shadow: none; break-after: page; }
  .pdf-page:last-child { break-after: auto; }
}

/* Fase 1: disegno aggiusti, note e pagine PDF in stile Jotform */
.drawing-pad { width: 100%; max-width: 640px; height: auto; aspect-ratio: 4 / 3; border: 1px solid var(--line, #ddd); border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; display: block; margin-bottom: 8px; }
.muted-note { color: #777; font-size: 12px; margin: 6px 0; }
.summary-pre { white-space: pre-wrap; font-size: 11px; background: #f6f6f6; padding: 10px; border-radius: 6px; margin: 8px 0; max-height: 220px; overflow: auto; }
.jf-head { display: grid; grid-template-columns: 1.2fr 1fr 1.3fr 0.8fr; gap: 10px; align-items: start; background: #eaecf6; margin: -38px -38px 18px; padding: 26px 38px 18px; }
.jf-head .jf-logo { font-weight: 700; letter-spacing: .25em; }
.jf-head .jf-logo::before { content: "▼ "; color: #e51e21; }
.jf-stage { color: #e51e21; font-weight: 800; background: #fff; padding: 6px 10px; border-radius: 4px; text-align: center; }
.jf-row { display: flex; flex-wrap: wrap; gap: 14px 22px; padding: 12px 0; border-bottom: 1px solid #999; }
.jf-item { min-width: 90px; }
.jf-item small { display: block; font-size: 9px; font-weight: 800; color: #1c1c3a; margin-bottom: 4px; text-transform: uppercase; }
.jf-item b { display: inline-block; background: #e6e8f2; padding: 5px 8px; border-radius: 4px; font-size: 10.5px; min-height: 22px; min-width: 24px; }
.jf-red small { color: #e51e21; }
.jf-name { font-size: 15px; font-weight: 700; padding: 12px 0; border-bottom: 1px solid #999; display: flex; gap: 30px; flex-wrap: wrap; }
.jf-size { font-size: 15px; font-weight: 800; margin: 12px 0 6px; }
.jf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 10px; }
.jf-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.jf-table th { background: #eef0f8; text-align: center; padding: 5px; }
.jf-table td { border-top: 1px solid #e3e3ea; padding: 4px 6px; text-align: center; }
.jf-table td:first-child { text-align: left; font-weight: 800; background: #f4f5fb; }
.jf-notes { color: #e51e21; font-weight: 700; white-space: pre-wrap; font-size: 12px; }
.jf-notes h4 { margin: 0 0 4px; font-size: 13px; }
.jf-photo { text-align: center; margin: 10px 0 18px; break-inside: avoid; }
.jf-photo img { max-width: 100%; max-height: 120mm; object-fit: contain; }
.jf-photo h4 { text-align: left; margin: 0 0 6px; }
.jf-drawing { max-width: 100%; border: 1px solid #ccc; }
.model-image { display: block; max-width: 100%; max-height: 240px; margin: 0 auto; object-fit: contain; }
.pdf-art .model-image { max-height: 300px; }

/* Versione web: pagina di accesso */
.login-card { max-width: 460px; margin: 40px auto; }
