/* Rickert Orders — EZ Floors → Rickert Tile prototype
   CALTX-adjacent: clean sans, calm blues/grays */

:root {
  /* Darker / higher-contrast palette for phone readability */
  --bg: #e8edf3;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --border: #c5d0dc;
  --border-strong: #94a3b8;
  --text: #0b1220;
  --text-muted: #334155;
  --text-soft: #475569;
  --primary: #143860;
  --primary-hover: #0f2c4a;
  --primary-soft: #d7e4f2;
  --accent: #1d5a8a;
  --accent-soft: #cfe0f2;
  --danger: #991b1b;
  --danger-soft: #fee2e2;
  --success: #14532d;
  --success-soft: #dcfce7;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "Consolas", "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #b6cbe055, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #c7d2fe44, transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* iOS Safari zooms focused fields under 16px — keep all editable controls at least 16px */
input,
select,
textarea {
  font-size: 16px;
}

a { color: var(--accent); }

/* ——— Layout ——— */
.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}



.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.brand-logo {
  height: 36px;
  width: auto;
  max-width: 132px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  background: transparent;
  border: none;
  box-shadow: none;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
  text-align: left;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  padding: 0.35rem 0.15rem;
}



/* ——— Cards ——— */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1rem;
}

.card-title {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ——— Gate (locked) ——— */
.gate-view {
  max-width: 440px;
  margin: 3rem auto 0;
  text-align: center;
}

.gate-view .card {
  padding: 2rem 1.75rem;
}

.gate-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.gate-view h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.gate-view .lede {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.gate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.gate-hint {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.gate-hint code {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--surface-2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ——— Form grid ——— */
.grid {
  display: grid;
  gap: 0.85rem 1rem;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.field .req { color: #dc2626; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 106, 159, 0.18);
}

.field textarea { resize: vertical; min-height: 72px; }

.field.span-2 { grid-column: 1 / -1; }

/* ——— Line items ——— */
.lines-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.lines-toolbar .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.line-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 0.9rem;
  margin-bottom: 0.65rem;
  position: relative;
}

.line-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.line-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.product-search-wrap {
  position: relative;
  z-index: 1;
}
.product-search-wrap:focus-within,
.product-search-wrap:has(.product-dropdown.open) {
  z-index: 60;
}

.product-search-wrap input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 16px;
}

.product-search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 106, 159, 0.18);
}

.product-dropdown {
  position: absolute;
  z-index: 70;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: none;
}

.product-dropdown.open { display: block; }

.product-option {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.product-option:last-child { border-bottom: none; }
.product-option:hover,
.product-option.active { background: var(--primary-soft); }

.product-option .sku {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

.product-option .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.selected-product {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  margin-bottom: 0.65rem;
  font-size: 0.88rem;
}

.selected-product .sku {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--primary);
}

.selected-product .empty {
  color: var(--text-soft);
  font-style: italic;
}

.line-fields {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.65rem;
}

@media (max-width: 520px) {
  .line-fields { grid-template-columns: 1fr; }
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger-ghost {
  background: transparent;
  border: none;
  color: var(--text-soft);
  padding: 0.25rem 0.4rem;
  cursor: pointer;
  border-radius: 6px;
}
.btn-danger-ghost:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-block { width: 100%; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 0.95rem; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
  padding-top: 0.25rem;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  margin-right: 0.35rem;
}

.status-dot.warn { background: #f59e0b; }

/* ——— Modal / preview ——— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 640px;
  width: 100%;
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--surface-2);
}

.preview-summary {
  font-size: 0.9rem;
}

.preview-summary dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1rem;
}

.preview-summary dt {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.preview-summary dd {
  margin: 0;
}

.preview-lines {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}

.preview-lines table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.preview-lines th,
.preview-lines td {
  padding: 0.45rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.preview-lines th {
  background: var(--surface-2);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.preview-lines tr:last-child td { border-bottom: none; }

.preview-json {
  margin: 0;
  padding: 0.85rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
}

.todo-note {
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: #92400e;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ——— On-file read-only panels + edit override ——— */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.card-head .card-title {
  margin: 0;
  flex: 1;
}

.card-head .card-title::after { display: none; }

.onfile-hint {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.onfile-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.onfile-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.35rem 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.onfile-row:last-child { border-bottom: none; padding-bottom: 0; }
.onfile-row:first-child { padding-top: 0; }

.onfile-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 0.15rem;
}

.onfile-value {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.45;
}

.onfile-value.mono {
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
}

.edit-panel {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border-strong);
}

.edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.override-badge {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
}

@media (max-width: 520px) {
  .onfile-row { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ——— Combo A+B line composer + locked cards ——— */
.line-composer {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.composer-grid {
  display: grid;
  grid-template-columns: 1fr minmax(110px, 130px) auto;
  gap: 0.65rem;
  align-items: end;
}

@media (max-width: 560px) {
  .composer-grid { grid-template-columns: 1fr 1fr; }
  .composer-search { grid-column: 1 / -1; }
  .composer-add { grid-column: 1 / -1; }
  .composer-add .btn { width: 100%; }
}

.composer-add { padding-bottom: 1px; }

.composer-pick {
  margin-top: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
}

.composer-pick .empty { color: var(--text-soft); font-style: italic; }
.composer-pick .sku {
  font-family: var(--mono);
  font-weight: 700;
  font-weight: 600;
  color: var(--primary);
}
.composer-pick .unit-pill,
.locked-row .unit-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #bfdbfe;
}
.composer-pick .unit-pill.trim,
.locked-row .unit-pill.trim {
  background: #f8fafc;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.composer-pick .sf-hint,
.locked-row .sf-meta { color: var(--text-muted); font-size: 0.82rem; }

.locked-lines-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}
.locked-lines-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.locked-lines-count {
  font-size: 0.875rem;
  color: var(--text-soft);
}

.locked-lines { display: flex; flex-direction: column; gap: 0.55rem; }

.locked-empty {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  font-style: italic;
}

/* Compact locked line rows */
.locked-row {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.35rem 0.5rem;
}

.locked-row.is-trim {
  border-left-color: #94a3b8;
}

.locked-row-main {
  display: grid;
  grid-template-columns:
    5.5rem                 /* sku fixed */
    minmax(5rem, 1.4fr)    /* name */
    minmax(3.5rem, 0.55fr) /* size */
    7.65rem                /* qty + unit (aligned) */
    4.8rem                 /* sf */
    auto                   /* note */
    1.75rem;               /* remove */
  gap: 0.35rem 0.45rem;
  align-items: center;
}

.qty-unit {
  display: inline-grid;
  grid-template-columns: 3.6rem 3.75rem; /* fixed: qty | CTNs/PCs/Sheets */
  align-items: center;
  column-gap: 0.3rem;
  width: 7.65rem;
  flex: 0 0 7.65rem;
}

.unit-after {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  white-space: nowrap;
  width: 3.75rem;
  text-align: left;
}

.unit-after.trim {
  color: var(--text-muted);
  font-weight: 600;
}

.locked-row-main .qty-unit .line-qty,
.composer-qty .qty-unit input {
  width: 3.6rem;
  max-width: 3.6rem;
  box-sizing: border-box;
  padding: 0.28rem 0.25rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 16px;
  text-align: center;
  background: var(--surface);
}

.composer-qty .qty-unit input {
  padding: 0.55rem 0.25rem;
}

.locked-row-main .sku {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.locked-row-main .name {
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locked-row-main .size {
  font-size: 0.875rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locked-row-main .qty-unit .line-qty:focus,
.composer-qty .qty-unit input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 106, 159, 0.15);
}

.locked-row-main .sf-val {
  font-size: 0.82rem;
  font-weight: 700;
  font-weight: 600;
  color: var(--primary);
  text-align: right;
  white-space: nowrap;
}

.locked-row-main .sf-val.omit {
  color: transparent;
  font-weight: 500;
  font-style: normal;
  min-height: 1em;
}

.locked-row-main .btn-note {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.locked-row-main .btn-note:hover {
  background: var(--surface-2);
  color: var(--text);
}

.locked-row-main .btn-note.has-note {
  color: var(--primary);
  border-color: #bfdbfe;
  background: var(--primary-soft);
}

.locked-row-main .btn-note.open {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.locked-row-main .btn-remove {
  border: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.15rem;
  border-radius: 4px;
}

.locked-row-main .btn-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.locked-row-note {
  padding: 0.35rem 0 0.15rem;
  border-top: 1px dashed var(--border);
  margin-top: 0.3rem;
}

.locked-row-note .line-note {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 0.85rem;
}

.locked-row-note .line-note:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 106, 159, 0.15);
}

@media (max-width: 720px) {
  .locked-row-main {
    grid-template-columns:
      5.2rem   /* sku fixed */
      1fr
      7.65rem  /* qty + unit */
      4.5rem   /* sf */
      auto
      1.5rem;
  }
  .locked-row-main .size { display: none; }
}

@media (max-width: 480px) {
  .locked-row-main {
    grid-template-columns: 5.2rem 1fr 7.65rem 4.2rem auto 1.5rem;
  }
  .locked-row-main .name { min-width: 0; }
  .locked-row-main .sku {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}



/* ——— Compact dealer + ship-to (mobile-first) ——— */
.onfile-duo {
  display: grid;
  grid-template-columns: 1fr; /* phones: stacked */
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.card-compact {
  padding: 0.7rem 0.85rem;
  margin-bottom: 0;
}

.card-compact .card-head {
  margin-bottom: 0.25rem;
}

.card-compact .card-title {
  font-size: 0.8rem;
}

.card-compact .onfile-hint {
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
}

.card-compact .onfile-hint.compact {
  margin-bottom: 0.25rem;
}

.onfile-panel-compact {
  padding: 0.45rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.onfile-panel-compact .onfile-row { display: none; }

.onfile-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
}

.onfile-primary .onfile-value {
  font-size: 0.9rem;
  font-weight: 600;
}

.onfile-primary .onfile-value.mono {
  font-size: 0.85rem;
  font-weight: 600;
}

.onfile-addr {
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--text);
  white-space: pre-line;
}

.onfile-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
}

.onfile-meta .onfile-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  font-weight: 600;
}

.card-compact .edit-panel {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
}

.card-compact .override-badge {
  margin-top: 0.35rem;
}

/* Tablet/desktop only: side-by-side */
@media (min-width: 760px) {
  .onfile-duo {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  .card-compact {
    padding: 0.85rem 1rem;
  }
}


/* mobile-first shell + lines */
@media (max-width: 480px) {
  .app-shell { padding: 0.75rem 0.65rem 2rem; }
  .card { padding: 0.9rem 0.85rem; }

  /* Center logo + title as a stacked header block on iPhone */
  .site-header {
    margin-bottom: 0.85rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .brand {
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-align: center;
  }
  .brand-logo { height: 32px; max-width: 112px; }
  .brand-text {
    width: 100%;
    text-align: center;
  }
  .brand-text h1 {
    font-size: 1.05rem;
    text-align: center;
    width: 100%;
  }

  .locked-row { padding: 0.4rem 0.45rem; }
  .locked-row-main .sku { font-size: 0.85rem; }
  .locked-row-main .name { font-size: 0.9rem; }
  .locked-row-main .btn-note { padding: 0.28rem 0.45rem; font-size: 0.75rem; }
  .composer-grid { grid-template-columns: 1fr; }
  .composer-qty { display: flex; flex-direction: column; align-items: flex-start; }
  .composer-add .btn { width: 100%; }
  .qty-unit { width: 7.65rem; }

  .field label { font-size: 0.9rem; }
  .card-title { font-size: 0.88rem; }
  .btn { font-size: 0.95rem; }
  .wizard-step-tab .wizard-label { font-size: 0.8rem; }
}

/* ——— 3-step wizard (mobile-first) ——— */
.wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.wizard-step-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.45rem 0.25rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  font: inherit;
}

.wizard-step-tab .wizard-num {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
}

.wizard-step-tab .wizard-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wizard-step-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.wizard-step-tab.active .wizard-num {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.wizard-step-tab.done .wizard-num {
  background: #dbeafe;
  border-color: #93c5fd;
  color: var(--primary);
}

.wizard-pane.hidden { display: none !important; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding-top: 0.25rem;
}

.wizard-nav .btn-lg { min-width: 9rem; }

@media (max-width: 480px) {
  .wizard-nav { flex-direction: column-reverse; }
  .wizard-nav .btn { width: 100%; }
  .wizard-nav .btn-lg { min-width: 0; }
}


/* Explicit anti-zoom for line notes / any remaining text fields */
.locked-row-note input,
input.line-note,
.composer-search input,
#composerSearch {
  font-size: 16px;
}


/* Submit / validation banners (no alert()) */
.form-banner,
.submit-status {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.4;
}
.form-banner[hidden],
.submit-status[hidden] { display: none !important; }
.form-banner.is-error,
.submit-status.is-error {
  background: var(--danger-soft);
  border-color: #f5c2c2;
  color: var(--danger);
}
.form-banner.is-ok,
.submit-status.is-ok {
  background: var(--success-soft);
  border-color: #a7f3d0;
  color: var(--success);
}
.form-banner.is-busy,
.submit-status.is-busy {
  background: var(--primary-soft);
  border-color: #93c5fd;
  color: var(--primary);
}
