:root {
  --ink: #f4f1e9;
  --muted: #b7c5c1;
  --paper: #10191b;
  --panel: #1a292b;
  --panel-raised: #243b3a;
  --line: #36504c;
  --green: #44e0cb;
  --green-dark: #9be5d8;
  --lime: #44e0cb;
  --orange: #f28c38;
  --danger-bg: #2b1916;
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

* { 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 50% -15rem, rgba(68, 224, 203, .11), transparent 34rem), var(--paper);
  font-family: "Open Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 900px); margin: 0 auto; padding: 0 20px 60px; }
.topbar { height: 80px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.brand { letter-spacing: .08em; }
.brand em { color: var(--green); font-style: normal; }
.brand-mark { width: 48px; height: 28px; display: grid; place-items: center; border: 1px solid #36504c; border-radius: 14px; background: #152727; box-shadow: inset 0 0 10px #000, 0 0 16px rgba(68,224,203,.12); }
.brand-mark span { width: 28px; height: 6px; border-radius: 4px; background: var(--green); box-shadow: 0 0 8px rgba(68,224,203,.75); }
.mode-badge { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(26, 41, 43, .90); font-size: 12px; font-weight: 700; }
.mode-badge.ai { color: var(--green-dark); background: #d6e9dc; border-color: #99bfaa; }

.welcome { padding: 48px 0 34px; max-width: 680px; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(42px, 8vw, 72px); line-height: 1; letter-spacing: -.045em; font-weight: 750; }
.welcome > p:last-child { max-width: 590px; margin-bottom: 0; color: var(--muted); font-size: 18px; line-height: 1.55; }

.panel { margin-bottom: 24px; padding: clamp(20px, 4vw, 34px); border: 1px solid var(--line); border-radius: 20px; background: rgba(26, 41, 43, .96); box-shadow: var(--shadow); }
.step-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.step-heading h2 { margin: 0 0 3px; font-size: 21px; letter-spacing: -.02em; }
.step-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.step-number { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--paper); font-weight: 900; }

textarea, input, select { width: 100%; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #152727; outline: none; transition: border-color .15s, box-shadow .15s; color-scheme: dark; }
textarea { padding: 16px; resize: vertical; line-height: 1.5; }
input, select { height: 48px; padding: 0 13px; }
textarea:focus, input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(68, 224, 203, .20); }
#instructionText { min-height: 132px; border: 0; padding: 5px 0 16px; background: transparent; font-family: Georgia, "Times New Roman", serif; font-size: clamp(22px, 4vw, 31px); line-height: 1.35; }
#instructionText::placeholder { color: #a5aaa6; }

.capture-actions, .review-actions { display: flex; gap: 12px; margin-top: 18px; }
.attachment-button { white-space: nowrap; }
.conversation-context { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; padding: 10px 12px; border-radius: 12px; color: var(--green-dark); background: #1c3e3c; font-size: 12px; font-weight: 800; }
.conversation-context button { border: 0; padding: 6px 9px; border-radius: 8px; color: var(--green-dark); background: #243b3a; font-size: 11px; font-weight: 800; }
.image-preview-tray { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0 16px; }
.image-preview { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #243b3a; }
.image-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.image-preview button { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; color: white; background: rgba(23, 35, 30, .82); font-size: 20px; line-height: 1; }
.primary-button, .secondary-button, .voice-button, .icon-button { min-height: 48px; border: 0; border-radius: 13px; font-weight: 800; }
.primary-button { padding: 0 20px; color: white; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.secondary-button { padding: 0 20px; color: var(--ink); background: #243b3a; }
.voice-button { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 11px; padding: 0 20px; color: var(--paper); background: var(--lime); }
.voice-button.listening { color: var(--paper); background: var(--green-dark); animation: pulse 1.3s infinite; }
.voice-button.transcribing { color: var(--green-dark); background: #1c3e3c; cursor: wait; }
.mic-icon { width: 13px; height: 21px; border: 2px solid currentColor; border-radius: 9px; position: relative; }
.mic-icon::after { content: ""; position: absolute; width: 21px; height: 12px; left: -6px; bottom: -7px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 12px 12px; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; }

.warning-box { margin: -6px 0 22px; padding: 13px 15px; border-left: 4px solid var(--orange); border-radius: 8px; background: var(--danger-bg); font-size: 14px; }
.warning-box.command-success { border-left-color: var(--green); background: #1c3e3c; color: var(--green-dark); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.full-width { grid-column: 1 / -1; }
.check-label { display: flex !important; align-items: center; align-self: end; height: 48px; color: var(--ink) !important; }
.check-label input { width: 22px; height: 22px; accent-color: var(--green); }
.review-actions { justify-content: flex-end; padding-top: 4px; }

.orders-section, .archive-section { padding: 38px 0; }
.archive-section { padding-top: 8px; }
.section-title-row { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.section-title-row h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 32px; font-weight: 500; letter-spacing: -.03em; }
.icon-button { width: 44px; min-height: 44px; font-size: 22px; color: var(--green-dark); background: #243b3a; }
.orders-list { display: grid; gap: 11px; }
.order-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: rgba(26, 41, 43, .90); }
.order-date { width: 54px; padding: 8px 4px; border-radius: 12px; text-align: center; color: var(--paper); background: var(--green); }
.order-date strong, .order-date span { display: block; }
.order-date strong { font-size: 20px; line-height: 1; }
.order-date span { margin-top: 4px; font-size: 10px; text-transform: uppercase; }
.order-main strong { display: block; margin-bottom: 4px; }
.order-main span { color: var(--muted); font-size: 13px; }
.order-number { color: var(--green); font-size: 11px; font-weight: 800; }
.order-actions { display: grid; justify-items: end; gap: 7px; }
.manage-order-button, .cancel-item-button { border: 0; border-radius: 9px; color: var(--green-dark); background: #243b3a; font-weight: 800; }
.manage-order-button { padding: 7px 10px; font-size: 11px; }
.cancel-item-button { padding: 6px 9px; font-size: 11px; }
.detail-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 20px; }
.detail-heading h2 { margin: 0 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: 32px; font-weight: 500; }
.totals-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 28px; }
.total-card { padding: 15px; border-radius: 14px; background: #243b3a; }
.total-card span, .total-card strong { display: block; }
.total-card span { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.total-card strong { font-size: 20px; }
.detail-section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.detail-section-heading h3, .item-entry-card h3, .authorization-panel h3 { margin: 0; font-size: 17px; }
.work-order-items { display: grid; gap: 9px; }
.work-order-item { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.work-order-item.cancelled { opacity: .52; text-decoration: line-through; }
.item-main strong, .item-main span { display: block; }
.item-main span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.item-amount { text-align: right; font-weight: 800; }
.item-amount span { display: block; color: var(--muted); font-size: 10px; font-weight: 600; }
.item-entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 28px; }
.item-entry-grid.single-column { grid-template-columns: 1fr; }
.item-entry-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #1a292b; }
.item-entry-card > .hint { margin-top: 7px; }
.compact-actions { align-items: stretch; }
.item-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; }
.item-form label, .authorization-panel label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.pending-items { display: grid; gap: 8px; margin-top: 15px; }
.pending-item { padding: 11px; border-left: 4px solid var(--lime); border-radius: 8px; background: #243b3a; font-size: 13px; }
.pending-attachment-summary { margin-top: 18px; padding: 13px 15px; border-left: 4px solid var(--green); border-radius: 8px; background: #1c3e3c; font-size: 13px; line-height: 1.45; }
.attachment-gallery-section { margin-top: 28px; }
.attachment-gallery-section h3 { margin-bottom: 12px; font-size: 17px; }
.attachment-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.attachment-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #1a292b; text-decoration: none; }
.attachment-card img { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: cover; background: #243b3a; }
.attachment-card span { display: block; padding: 9px 10px; font-size: 11px; line-height: 1.35; }
.full-action { width: 100%; margin-top: 12px; }
.assistant-shortcut { width: 100%; margin-bottom: 22px; }
.authorization-panel { margin-top: 22px; padding: 20px; border: 1px solid #e7ad83; border-radius: 16px; background: var(--danger-bg); }
.authorization-panel label { margin: 13px 0; }
.empty-state { margin: 0; padding: 28px; border: 1px dashed #c7c2b7; border-radius: 16px; color: var(--muted); text-align: center; }
.archive-search { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; margin-bottom: 16px; }
.conversations-list { display: grid; gap: 11px; }
.conversation-card { border: 1px solid var(--line); border-radius: 17px; background: rgba(26, 41, 43, .90); overflow: hidden; }
.conversation-card summary { display: grid; gap: 4px; padding: 17px; cursor: pointer; }
.conversation-card summary::marker { color: var(--green); }
.conversation-card summary strong { padding-left: 5px; }
.conversation-card summary span { padding-left: 5px; color: var(--muted); font-size: 12px; }
.conversation-body { padding: 0 20px 18px; }
.conversation-body > p { color: var(--muted); font-size: 13px; }
.conversation-message { margin-top: 12px; padding: 13px 15px; border-radius: 12px; background: #243b3a; }
.conversation-message strong { color: var(--green-dark); font-size: 12px; }
.conversation-message p { margin: 5px 0 0; white-space: pre-wrap; line-height: 1.45; }
.toast-message { position: fixed; z-index: 10; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 40px), 460px); padding: 15px 18px; border-radius: 13px; color: var(--paper); background: var(--green); box-shadow: 0 15px 40px rgba(0,0,0,.22); text-align: center; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@keyframes pulse { 50% { transform: scale(.98); } }

@media (max-width: 640px) {
  .app-shell { padding: 0 14px 40px; }
  .topbar { height: 66px; }
  .welcome { padding: 34px 4px 27px; }
  .welcome > p:last-child { font-size: 16px; }
  .panel { border-radius: 19px; }
  .capture-actions, .review-actions { flex-direction: column; }
  .capture-actions .primary-button { order: -1; }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .order-card { grid-template-columns: auto 1fr; }
  .order-number { grid-column: 2; }
  .order-actions { grid-column: 2; }
  .totals-grid { grid-template-columns: 1fr 1fr; }
  .item-entry-grid { grid-template-columns: 1fr; }
  .work-order-item { grid-template-columns: 1fr auto; }
  .work-order-item .cancel-item-button { grid-column: 2; }
  .archive-search { grid-template-columns: 1fr 1fr; }
  .archive-search input { grid-column: 1 / -1; }
  .image-preview-tray, .attachment-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Accesso e sessione */
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.workshop-badge { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 11px; border: 1px solid #99bfaa; border-radius: 999px; color: var(--green-dark); background: #d6e9dc; font-size: 12px; font-weight: 700; }
.logout-form { margin: 0; }
.logout-button { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(26, 41, 43, .90); font-size: 12px; font-weight: 700; }
.logout-button:hover { color: var(--ink); border-color: var(--muted); }

.auth-shell { width: min(100%, 440px); margin: 0 auto; padding: 34px 20px 60px; }
.auth-panel { margin-top: 26px; }
.auth-panel h1 { font-size: clamp(34px, 7vw, 46px); margin-bottom: 12px; }
.auth-lead { color: var(--muted); font-size: 16px; line-height: 1.55; }
.auth-form { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; }
.auth-form label { margin-top: 12px; font-size: 13px; font-weight: 700; }
.auth-form input { padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.auth-form input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.auth-form button { margin-top: 24px; padding: 15px 18px; border: 0; border-radius: 999px; color: white; background: var(--green-dark); font-size: 15px; font-weight: 700; }
.auth-form button:hover { background: var(--green); }
.auth-optional { color: var(--muted); font-weight: 500; }
.auth-hint { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.auth-error { margin: 18px 0 0; padding: 13px 15px; border: 1px solid #e7c3b2; border-radius: 14px; background: var(--danger-bg); font-size: 14px; }
.auth-switch { margin: 22px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.auth-switch a { color: var(--green-dark); font-weight: 700; }
.confirmation-panel { text-align: center; }
.confirmation-mark { display: grid; width: 64px; height: 64px; margin: 4px auto 22px; place-items: center; border-radius: 50%; font-size: 34px; font-weight: 800; }
.confirmation-mark-success { color: #123c2a; background: var(--green); }
.confirmation-mark-error { color: #4d2115; background: #ffb18f; }
.confirmation-action { display: inline-flex; margin-top: 24px; align-items: center; justify-content: center; text-decoration: none; }

/* Scheda di lavorazione da stampare */
.sheet { width: min(100%, 820px); margin: 0 auto; padding: 28px 22px 60px; color: var(--ink); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.sheet-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.sheet-number { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.sheet-number strong { font-size: 22px; }
.sheet-muted { color: var(--muted); font-size: 12px; }
.sheet-print { margin: 18px 0 0; padding: 11px 20px; border: 0; border-radius: 999px; color: white; background: var(--green-dark); font-size: 14px; font-weight: 700; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sheet-actions form { margin: 0; }
.sheet-email { background: var(--ink); }
.sheet-notice { margin: 14px 0 0; color: var(--green-dark); font-size: 14px; }
.sheet-notice-error { color: #a24c2c; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; margin: 22px 0; }
.sheet-grid div { display: flex; flex-direction: column; gap: 2px; }
.sheet-grid strong { font-size: 15px; }
.sheet-block { margin: 0 0 22px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.sheet-block p { margin: 3px 0 12px; font-size: 15px; }
.sheet-block p:last-child { margin-bottom: 0; }
.sheet-items { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet-items th { padding: 8px 6px; border-bottom: 1px solid var(--ink); text-align: left; font-size: 12px; }
.sheet-items td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sheet-items .right, .sheet-items th.right { text-align: right; }
.sheet-totals { margin: 18px 0 0; margin-left: auto; width: min(100%, 320px); display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.sheet-totals div { display: flex; justify-content: space-between; gap: 16px; }
.sheet-total { padding-top: 7px; border-top: 1px solid var(--ink); font-size: 17px; }
.sheet-warning { margin: 16px 0 0; padding: 11px 14px; border: 1px solid #e7c3b2; border-radius: 10px; background: var(--danger-bg); font-size: 13px; }
.sheet-foot { margin-top: 36px; }
.sheet-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; margin-top: 40px; }
.sheet-signatures div { padding-top: 8px; border-top: 1px solid var(--ink); }
.sheet-printed { margin-top: 26px; }

@media print {
  /* Su carta il foglio non ha sfondi, e il pulsante non serve. */
  html, body { background: white; }
  .sheet { width: auto; padding: 0; }
  .sheet-print { display: none; }
  .sheet-block, .sheet-warning { border-color: #999; }
  .sheet-items { page-break-inside: auto; }
  .sheet-items tr { page-break-inside: avoid; }
  .sheet-foot { page-break-inside: avoid; }
  @page { margin: 14mm; }
}
.detail-actions { display: flex; align-items: center; gap: 10px; }
.sheet-link { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--green-dark); background: rgba(26, 41, 43, .90); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.sheet-link:hover { border-color: var(--green); }

/* Il timbro della build: presente e leggibile, mai in mezzo al lavoro. */
.build-stamp { margin: 34px 0 14px; color: var(--muted); font-size: 11px; text-align: center; letter-spacing: .04em; }
@media print { .build-stamp { display: none; } }

/* Titoli delle due sezioni del conto cliente: interventi e pagamenti. */
.sheet-section-title { margin: 30px 0 10px; font-size: 15px; letter-spacing: .02em; }

/* Riga dei debitori: si apre sul conto stampabile del cliente, quindi e' un collegamento. */
.order-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(26, 41, 43, .90); color: inherit; text-decoration: none; }
.order-row:hover { border-color: var(--green); }
.order-row + .order-row { margin-top: 10px; }

/* Backoffice: sola consultazione, pensato prima per il monitor dell'ufficio. */
.backoffice-shell { width: min(100% - 32px, 1180px); margin: 0 auto; padding-bottom: 56px; }
.backoffice-topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.backoffice-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; padding: 48px 0 30px; }
.backoffice-heading h1 { margin-bottom: 10px; font-size: clamp(38px, 6vw, 64px); }
.backoffice-heading p { margin-bottom: 0; color: var(--muted); }
.snapshot-time, .result-count { white-space: nowrap; color: var(--muted); font-size: 12px; font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 48px; }
.summary-card { min-height: 126px; display: flex; flex-direction: column; justify-content: space-between; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.summary-card span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.summary-card strong { font-family: Georgia, "Times New Roman", serif; font-size: 34px; font-weight: 500; }
.summary-card.money { color: var(--ink); background: #1c3e3c; border-color: #42645a; }
.summary-card.money span { color: var(--muted); }
.backoffice-section { margin-bottom: 48px; }
.backoffice-filters { display: grid; grid-template-columns: minmax(260px, 1fr) 180px auto auto; align-items: end; gap: 12px; margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(26,41,43,.90); }
.backoffice-filters label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.backoffice-filters .primary-button { height: 48px; }
.secondary-link { height: 48px; display: inline-flex; align-items: center; padding: 0 18px; border-radius: 13px; color: var(--ink); background: #243b3a; font-weight: 800; text-decoration: none; }
.data-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 13px 15px; color: var(--muted); background: #152727; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.data-table td { padding: 15px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table small { display: block; margin-top: 3px; color: var(--muted); }
.activity-cell { max-width: 280px; }
.plate { letter-spacing: .05em; }
.status-pill { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 900; }
.status-pill.open { color: #174c37; background: #dff1c4; }
.status-pill.closed { color: #42544b; background: #e7ebe8; }
.status-pill.cancelled { color: #8b3d29; background: #f7ded5; }
.table-link { color: var(--green-dark); font-weight: 800; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.pagination a { color: var(--green-dark); font-weight: 800; }
.account-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.account-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--panel); text-decoration: none; }
.account-card:hover { border-color: var(--green); }
.account-card span, .account-card small { display: block; }
.account-card small { margin-top: 4px; color: var(--muted); font-weight: 400; }
@media (max-width: 760px) {
  .backoffice-heading { align-items: start; flex-direction: column; gap: 10px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .backoffice-filters { grid-template-columns: 1fr 1fr; }
  .backoffice-filters label:first-child { grid-column: 1 / -1; }
  .account-grid { grid-template-columns: 1fr; }
}

/* Palette del sito vetrina: verde antracite, avorio e menta. */
.backoffice-topbar { border-color: var(--line); }
.workshop-badge, .mode-badge.ai { color: #9be5d8; background: #1c3e3c; border-color: #42645a; }
.logout-button, .mode-badge { color: var(--muted); background: #1a292b; border-color: var(--line); }
.logout-button:hover { color: var(--ink); border-color: #91a9a3; }
.eyebrow, .order-number, .table-link, .auth-switch a { color: var(--green-dark); }
.section-title-row h2, .detail-heading h2 { font-family: inherit; font-weight: 750; }
.summary-card, .account-card, .order-card, .conversation-card, .attachment-card {
  border-color: var(--line);
  color: var(--ink);
  background: linear-gradient(145deg, #1a292b, #152727);
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}
.summary-card::after { background: linear-gradient(90deg, var(--green), transparent); }
.summary-card.money strong { color: #9be5d8; }
.backoffice-filters { border-color: var(--line); background: #152727; }
.primary-button, .auth-form button, .sheet-print { color: #10191b; background: var(--green); }
.primary-button:hover, .auth-form button:hover, .sheet-print:hover { background: #9be5d8; }
.secondary-link, .secondary-button, .icon-button, .manage-order-button, .cancel-item-button { color: var(--ink); background: var(--panel-raised); }
.data-table-wrap { border-color: var(--line); background: var(--panel); box-shadow: var(--shadow); }
.data-table th { color: var(--muted); background: #152727; }
.data-table th, .data-table td { border-color: var(--line); }
.data-table tbody tr:hover { background: #243b3a; }
.data-table small, .account-card small { color: var(--muted); }
.status-pill.open { color: #9be5d8; background: #1c3e3c; }
.status-pill.closed { color: #b7c5c1; background: #243b3a; }
.status-pill.cancelled { color: #ffb18f; background: #35201c; }
.empty-state { border-color: #42645a; color: var(--muted); background: rgba(26,41,43,.55); }
.auth-shell { padding-top: clamp(34px, 8vh, 90px); }
.auth-shell > .brand { display: flex; justify-content: center; }
.auth-panel { border-top-color: #42645a; }
.auth-form input { color: var(--ink); border-color: var(--line); background: #152727; }
.auth-form input:focus-visible { outline-color: var(--green); }
.auth-error, .sheet-warning { color: #ffc2ad; border-color: #63372b; background: var(--danger-bg); }
.confirmation-mark-success { color: #07150f; }
.confirmation-mark-error { color: #2b120a; }
.build-stamp { color: #91a9a3; }
.ai-status { margin: 18px 0 22px; color: var(--muted); font-size: 12px; font-weight: 700; }
.ai-status span { margin-right: 6px; color: #f28c38; }
.ai-status.available span { color: #7cc6ae; }

/* A video i documenti appartengono alla stessa plancia; in stampa tornano carta bianca. */
.sheet { margin-top: 28px; margin-bottom: 28px; padding: 34px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
.sheet-head { border-color: #607071; }
.sheet-block { border-color: var(--line); background: #152727; }
.sheet-items th { border-color: #607071; }
.sheet-items td { border-color: var(--line); }
.sheet-total { border-color: #607071; }

@media (max-width: 640px) {
  .brand-mark { width: 42px; }
  .sheet { margin: 0; padding: 22px 14px 44px; border: 0; border-radius: 0; box-shadow: none; }
}

@media print {
  html, body { color: #17231e; background: white !important; }
  .sheet { margin: 0; padding: 0; border: 0; border-radius: 0; color: #17231e; background: white; box-shadow: none; }
  .sheet-block { border-color: #dcd8cc; background: white; }
  .sheet-muted { color: #66736d; }
  .sheet-items td { border-color: #dcd8cc; }
}
