:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-soft: #F4EEE5;
  --ink: #12171E;
  --muted: #5A6472;
  --border: #E5DDD0;
  --burgundy: #821D20;
  --burgundy-hover: #671518;
  --burgundy-tint: #F8ECEC;
  --sea: #16689A;
  --sea-tint: #EAF3F9;
  --gold: #9A6418;
  --gold-tint: #FDF6E8;
  --success: #166534;
  --success-tint: #ECFDF3;
  --warn: #92400E;
  --warn-tint: #FEF3C7;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
}

.skip-link {
  position: absolute;
  top: -100px;
  right: 16px;
  background: var(--burgundy);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 999;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus {
  top: 12px;
}

[hidden] {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 2px solid var(--burgundy);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--burgundy);
  object-fit: cover;
  flex-shrink: 0;
}

.brand-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.25;
}

.brand-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-switch {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mode-btn:hover {
  color: var(--ink);
}

.mode-btn.active {
  background: var(--burgundy);
  color: #FFFFFF;
}

.skip-quiz-bar {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn:focus-visible,
.option-card:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--sea);
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-secondary {
  background: var(--ink);
  color: #FFFFFF;
}
.btn-secondary:hover {
  background: #232B36;
}

.btn-whatsapp {
  background: #15803D;
  color: #FFFFFF;
}
.btn-whatsapp:hover {
  background: #166534;
}
.btn-whatsapp.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
}

.btn-ghost {
  background: transparent;
  color: var(--burgundy);
}
.btn-ghost:hover {
  background: var(--burgundy-tint);
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.84rem;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Main */
.app-main {
  padding-top: 28px;
  padding-bottom: 48px;
  min-height: calc(100vh - 140px);
}

/* Quiz Intro */
.quiz-wrapper {
  max-width: 880px;
  margin: 0 auto;
}

.quiz-intro {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.quiz-intro-text h2 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.25;
}

.quiz-intro-text p {
  margin: 0;
  font-size: 0.96rem;
  color: var(--muted);
}

.quiz-progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--burgundy);
  margin-bottom: 8px;
}

.progress-track {
  height: 8px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--burgundy);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.step-dots {
  display: flex;
  gap: 6px;
}

.step-dot {
  flex: 1;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}
.step-dot.active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #fff;
}
.step-dot.done {
  background: var(--burgundy-tint);
  border-color: rgba(130, 29, 32, 0.35);
  color: var(--burgundy);
}

/* Quiz Card */
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.step-header {
  margin-bottom: 20px;
}

.step-tag {
  display: inline-block;
  background: var(--burgundy-tint);
  color: var(--burgundy);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.step-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--ink);
}

.step-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.options-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.option-card {
  text-align: right;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  position: relative;
}

.option-card:hover {
  border-color: rgba(130, 29, 32, 0.45);
  background: #FFFFFF;
}

.option-card.selected {
  border-color: var(--burgundy);
  background: var(--burgundy-tint);
}

.option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.option-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.option-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 900;
  color: transparent;
  flex-shrink: 0;
}

.option-card.selected .option-check {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #fff;
}

.option-sub {
  font-size: 0.83rem;
  color: var(--muted);
  font-weight: 600;
}

.option-price-hint {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--sea);
}

/* Sub controls inside steps */
.sub-control-box {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sub-control-label {
  font-weight: 800;
  font-size: 0.94rem;
  color: var(--ink);
}

.sub-control-help {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.stepper button {
  width: 34px;
  height: 34px;
  border: none;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 900;
  border-radius: 6px;
  cursor: pointer;
}
.stepper button:hover {
  background: var(--burgundy);
  color: #fff;
}

.stepper input, .budget-input {
  width: 72px;
  text-align: center;
  border: none;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--ink);
  background: transparent;
}

.budget-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}
.budget-input {
  width: 110px;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}
.chip-btn.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.section-divider-label {
  margin: 20px 0 8px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink);
}

.inline-alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-tint);
  color: var(--warn);
  border: 1px solid rgba(146, 64, 14, 0.25);
  font-size: 0.88rem;
  font-weight: 700;
}

.quiz-nav {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quiz-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.live-hint {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 700;
}

/* RESULT VIEW */
.result-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-title h2 {
  margin: 0 0 4px;
  font-size: 1.55rem;
  font-weight: 900;
}

.toolbar-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.toolbar-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.budget-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.budget-banner.ok {
  background: var(--success-tint);
  color: var(--success);
  border: 1px solid rgba(22, 101, 52, 0.22);
}
.budget-banner.info {
  background: var(--sea-tint);
  color: var(--sea);
  border: 1px solid rgba(22, 104, 154, 0.22);
}
.budget-banner.warn {
  background: var(--warn-tint);
  color: var(--warn);
  border: 1px solid rgba(146, 64, 14, 0.25);
}

.result-grid {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.result-grid.manual-layout {
  grid-template-columns: minmax(430px, 1.12fr) minmax(0, 1fr);
}

.result-grid > * {
  min-width: 0;
}

.editor-panel.is-manual #manual-budget-box { order: 1; }
.editor-panel.is-manual #catalog-box { order: 2; }
.editor-panel.is-manual #selected-box { order: 3; }
.editor-panel.is-manual #customer-box { order: 4; }

.panel-head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Manual Budget Planner */
.manual-budget-box {
  border-color: rgba(130, 29, 32, 0.28);
  background: linear-gradient(180deg, #FFFFFF 0%, #FDFBF7 100%);
}

.manual-controls-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: end;
}

.manual-control-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.manual-control-item label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.stepper-sm button {
  width: 30px;
  height: 30px;
  font-size: 1rem;
}

.stepper-sm input {
  width: 50px;
  font-size: 0.96rem;
}

.budget-input-sm {
  padding: 4px 10px;
}

.budget-input-sm .budget-input {
  width: 100%;
  text-align: right;
  font-size: 0.96rem;
}

.chips-compact {
  margin-top: 12px;
}

.manual-meter {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.manual-meter-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.progress-fill.over {
  background: #B91C1C;
}

.progress-fill.near {
  background: #D97706;
}

.progress-fill.ok {
  background: #15803D;
}

/* Category pills & stock toggle */
.catalog-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cat-pill {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.cat-pill.active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #FFFFFF;
}

.stock-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  cursor: pointer;
}

/* Visual 2-col Manual Catalog Grid */
.catalog-list.manual-grid {
  max-height: 480px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-left: 4px;
}

.catalog-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.catalog-card.in-cart {
  border-color: var(--burgundy);
  background: #FFF9F8;
}

.catalog-card-media {
  position: relative;
  height: 104px;
  background: #EAE4DA;
  border-bottom: 1px solid var(--border);
}

.catalog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-card-media.contain {
  background: #FFFFFF;
  padding: 6px;
}

.catalog-card-media.contain img {
  object-fit: contain;
}

.catalog-card-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(18, 23, 30, 0.86);
  color: #FDE68A;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.catalog-card-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.catalog-card-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.catalog-card-cat {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.catalog-card-foot {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.catalog-card-price {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--burgundy);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

/* Editor Panel */
.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.panel-note {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field textarea,
.catalog-controls input,
.catalog-controls select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.88rem;
  background: var(--bg);
  color: var(--ink);
}

.editor-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: #fff;
}

.editor-item-info {
  flex: 1;
  min-width: 0;
}

.editor-item-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
}

.editor-item-meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.editor-item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qty-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
}

.qty-mini button {
  width: 26px;
  height: 26px;
  border: none;
  background: var(--surface-soft);
  border-radius: 4px;
  font-weight: 900;
  cursor: pointer;
}
.qty-mini button:hover {
  background: var(--burgundy);
  color: #fff;
}
.qty-mini span {
  min-width: 20px;
  text-align: center;
  font-weight: 800;
  font-size: 0.88rem;
}

.editor-item-btns {
  display: flex;
  gap: 6px;
}

.btn-danger-text {
  background: transparent;
  border: none;
  color: #B91C1C;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
}
.btn-danger-text:hover {
  text-decoration: underline;
}

/* Catalog Drawer */
.catalog-controls {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 8px;
  margin-bottom: 10px;
}

.catalog-list {
  max-height: 310px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 2px;
}

.catalog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.catalog-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.catalog-thumb {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.catalog-name {
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-sub {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.tag-oos {
  color: #B45309;
  font-weight: 800;
}

/* PRINTABLE ORDER SHEET */
.order-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 2px 10px rgba(18, 23, 30, 0.04);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 3px solid var(--burgundy);
  flex-wrap: wrap;
}

.sheet-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sheet-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--burgundy);
  object-fit: cover;
  flex-shrink: 0;
}

.sheet-brand-ar {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--burgundy);
  line-height: 1.2;
}

.sheet-brand-en {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
}

.sheet-brand-contact,
.sheet-brand-phones {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

.sheet-order-badge {
  background: var(--burgundy-tint);
  border: 1px solid rgba(130, 29, 32, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.badge-cap {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--burgundy);
}

.sheet-order-badge strong {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--ink);
  direction: ltr;
}

.sheet-order-badge span:last-child {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.sheet-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.meta-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.meta-cell span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}

.meta-cell strong {
  display: block;
  font-size: 0.88rem;
  color: var(--ink);
  font-weight: 800;
  margin-top: 2px;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.sheet-table th {
  background: var(--ink);
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 9px 10px;
  text-align: right;
}

.sheet-table th:first-child {
  border-top-right-radius: 6px;
}
.sheet-table th:last-child {
  border-top-left-radius: 6px;
}

.sheet-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}

.sheet-table tr:nth-child(even) td {
  background: #FCFBF8;
}

.td-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.td-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: #fff;
}

.td-name {
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.td-cat {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.td-num {
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.td-total {
  font-weight: 900;
  color: var(--burgundy);
  white-space: nowrap;
}

.sheet-notes {
  background: var(--gold-tint);
  border: 1px solid rgba(154, 100, 24, 0.28);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--ink);
}

.sheet-notes strong {
  color: var(--gold);
}

.sheet-totals {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.totals-left {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.total-stat span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 700;
}

.total-stat strong {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
}

.grand-total {
  background: var(--burgundy);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.grand-total span {
  display: block;
  font-size: 0.74rem;
  color: #FDE68A;
  font-weight: 700;
}

.grand-total strong {
  font-size: 1.3rem;
  font-weight: 900;
}

.sheet-footer {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.empty-order {
  text-align: center;
  padding: 36px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 960px) {
  .result-grid,
  .result-grid.manual-layout {
    grid-template-columns: 1fr;
  }
  .order-sheet {
    order: -1;
  }
}

@media (max-width: 720px) {
  .quiz-intro,
  .manual-controls-row,
  .catalog-list.manual-grid {
    grid-template-columns: 1fr;
  }
  .options-grid,
  .options-grid.cols-3,
  .sheet-meta-grid,
  .form-grid,
  .catalog-controls {
    grid-template-columns: 1fr;
  }
  .quiz-card,
  .order-sheet {
    padding: 16px;
  }
  .sheet-footer span {
    word-break: break-word;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* PRINT / PDF STYLES */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }
  html, body {
    background: #FFFFFF !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .no-print {
    display: none !important;
  }
  .container,
  .app-main,
  .result-grid {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
  }
  .order-sheet {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .sheet-header {
    border-bottom: 2.5px solid #821D20 !important;
  }
  .sheet-meta-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .sheet-table tr {
    break-inside: avoid;
  }
  .sheet-totals,
  .sheet-notes,
  .sheet-header {
    break-inside: avoid;
  }
}
