/* Computo Studio - Style CSS */

:root {
  --bg-page: #f1f4f8;
  --bg-card: #ffffff;
  --bg-header: #172338;
  --text-main: #172338;
  --text-muted: #6c7990;
  --text-light: #9aa5b8;
  --primary-petrol: #174860;
  --primary-hover: #12384c;
  --primary-light: #e6f1f7;
  --badge-source-bg: #e0f2fe;
  --badge-source-text: #0369a1;
  --badge-warn-bg: #fef3c7;
  --badge-warn-text: #b45309;
  --review-box-bg: #eaf3fb;
  --review-box-border: #c8e0f4;
  --border-light: #e4e9f0;
  --border-hover: #cbd5e1;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(23, 35, 56, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.45;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP HEADER */
.top-header {
  background-color: var(--bg-header);
  color: #ffffff;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background-color 0.18s;
}

.brand-logo-wrap:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.brand-logo {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  white-space: nowrap;
}

.project-breadcrumb {
  color: #9cb0c9;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.project-breadcrumb:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

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

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-pill {
  border-radius: var(--radius-pill);
}

.btn-header-dictate {
  background-color: #ffffff;
  color: var(--bg-header);
  border: none;
  font-weight: 700;
  padding: 8px 18px;
}

.btn-header-dictate:hover {
  background-color: #f0f4f8;
}

.btn-header-dictate.listening {
  background-color: #ef4444;
  color: #ffffff;
  animation: pulse 1.5s infinite;
}

.btn-header-export {
  background-color: #21324c;
  color: #ffffff;
  border: 1px solid #334868;
}

.btn-header-export:hover {
  background-color: #2c4161;
}

.btn-header-icon {
  background: transparent;
  border: 1px solid #334868;
  color: #9cb0c9;
  padding: 7px 10px;
  border-radius: var(--radius-md);
}

.btn-header-icon:hover {
  background-color: #21324c;
  color: #ffffff;
}

.btn-primary {
  background-color: var(--primary-petrol);
  color: #ffffff;
}

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

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: var(--border-hover);
}

.btn-danger {
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger:hover {
  background-color: #fee2e2;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-icon {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

/* APP MAIN CONTAINER */
.app-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

.editor-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.prezzari-column {
  min-width: 0;
}

/* DICTATION REVIEW BOX (RIQUADRO DI CONTROLLO) */
.dictation-review-box {
  background-color: var(--review-box-bg);
  border: 1px solid var(--review-box-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.review-header {
  margin-bottom: 14px;
}

.review-spoken-text {
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.review-spoken-text strong {
  font-weight: 700;
}

.review-transcript {
  font-style: italic;
  color: #274060;
}

.review-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.review-table-wrap {
  overflow-x: auto;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid #d8e5f2;
  margin-bottom: 16px;
}

.review-table {
  width: 100%;
  border-collapse: collapse;
}

.review-table th {
  background-color: #f7fafc;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #e4edf5;
}

.review-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #edf3f8;
  vertical-align: middle;
}

.review-table tr:last-child td {
  border-bottom: none;
}

.review-input-title {
  width: 100%;
  border: 1px solid transparent;
  padding: 5px 8px;
  font-weight: 600;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.review-input-title:focus,
.review-input-title:hover {
  border-color: #b8d4ee;
  background-color: #f9fcff;
  outline: none;
}

.review-select-unit {
  border: 1px solid #e2e8f0;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background-color: #ffffff;
}

.review-input-qty {
  width: 70px;
  border: 1px solid #e2e8f0;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  text-align: right;
  font-size: 13.5px;
  font-weight: 600;
}

.btn-missing-qty {
  background-color: var(--badge-warn-bg);
  color: var(--badge-warn-text);
  border: 1px solid #fde68a;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-missing-qty:hover {
  transform: scale(1.05);
}

.price-edit-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.review-input-price {
  width: 75px;
  border: 1px solid #e2e8f0;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  text-align: right;
  font-size: 13.5px;
}

.source-badge {
  display: inline-block;
  background-color: var(--badge-source-bg);
  color: var(--badge-source-text);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.review-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* CHAPTERS & COMPUTO TABLE */
.chapter-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s;
}

.chapter-card.active-chapter {
  border-color: #b0cce3;
}

.chapter-header {
  background-color: #f8fafc;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}

.chapter-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chap-badge {
  font-weight: 800;
  font-size: 16px;
  color: var(--text-main);
}

.chap-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  outline: none;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.chap-title:focus {
  background-color: #ffffff;
  box-shadow: 0 0 0 2px #93c5fd;
}

.chapter-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chapter-subtotal {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.chapter-table-wrap {
  overflow-x: auto;
}

.computo-table {
  width: 100%;
  border-collapse: collapse;
}

.computo-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background-color: #ffffff;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.computo-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f4f8;
  vertical-align: middle;
}

.computo-table tr:hover td {
  background-color: #fafbfc;
}

.th-desc { min-width: 280px; }
.th-um { width: 95px; min-width: 95px; text-align: center; }
.td-um { width: 95px; min-width: 95px; text-align: center; padding: 8px 4px; }
.th-qty { width: 110px; text-align: right; }
.th-price { width: 120px; text-align: right; }
.th-total { width: 130px; text-align: right; }
.th-action { width: 40px; text-align: center; }

.cell-um {
  width: 100%;
  min-width: 85px;
  text-align: center;
  font-size: 13px;
  padding: 6px 4px;
  box-sizing: border-box;
}

.cell-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  border-radius: var(--radius-sm);
}

.cell-input:hover {
  border-color: #e2e8f0;
  background-color: #ffffff;
}

.cell-input:focus {
  border-color: #93c5fd;
  background-color: #ffffff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.4);
}

.cell-desc {
  font-weight: 500;
}

.cell-notes {
  font-size: 12px;
  color: #334155;
  font-style: italic;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 28px;
  line-height: 1.4;
  background-color: #fafbfc;
  transition: border-color 0.15s, background-color 0.15s;
}

.cell-notes:hover {
  background-color: #ffffff;
  border-color: #cbd5e1;
}

.cell-notes:focus {
  background-color: #ffffff;
  border-color: #93c5fd;
  font-style: normal;
  outline: none;
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.4);
}

.btn-add-note {
  background: none;
  border: none;
  padding: 0;
  font-size: 11px;
  color: #94a3b8;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 2px;
}

.btn-add-note:hover {
  color: var(--primary);
}

.unit-pill {
  display: inline-block;
  background-color: #f1f5f9;
  color: #334155;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.item-source-badge {
  font-size: 10.5px;
  color: var(--text-light);
  margin-top: 2px;
  padding-left: 8px;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; font-variant-numeric: tabular-nums; }

.qty-field-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-measure-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-light);
  padding: 3px 5px;
  border-radius: var(--radius-sm);
}

.btn-measure-toggle:hover,
.btn-measure-toggle.has-measures {
  background-color: #e0f2fe;
  color: #0284c7;
  font-weight: 700;
}

.price-input-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.price-input-wrap span {
  color: var(--text-muted);
}

.btn-row-delete {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
}

.btn-row-delete:hover {
  color: #ef4444;
  background-color: #fee2e2;
}

.chapter-footer {
  padding: 10px 16px;
  background-color: #ffffff;
  border-top: 1px dashed var(--border-light);
}

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--primary-petrol);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.btn-text-action:hover {
  background-color: var(--primary-light);
}

.btn-add-chapter-bar {
  display: flex;
  justify-content: center;
  padding: 12px;
  background-color: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-chapter-bar:hover {
  border-color: var(--primary-petrol);
  background-color: var(--primary-light);
}

/* DESKTOP TOTALS SUMMARY BAR */
.totals-summary-bar {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 24px;
  padding: 18px 24px;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.summary-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.summary-item strong {
  color: var(--text-main);
  font-weight: 700;
}

.summary-item.grand-total {
  font-size: 20px;
  color: var(--text-main);
  font-weight: 850;
  margin-left: 12px;
}

.summary-item.grand-total span {
  font-size: 22px;
  color: var(--text-main);
}

/* RIGHT COLUMN: PREZZARI PANEL */
.prezzari-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 108px);
}

.prezzari-panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
}

.prezzari-panel-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
}

.tabs-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  align-items: center;
}

.tab-chip-group {
  display: inline-flex;
  align-items: center;
  background-color: #f1f4f8;
  border-radius: var(--radius-pill);
  padding-right: 4px;
  transition: all 0.15s;
}

.tab-chip-group.active {
  background-color: var(--bg-header);
}

.tab-chip {
  background-color: transparent;
  color: var(--text-muted);
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab-chip-group.active .tab-chip {
  color: #ffffff;
}

.tab-chip-del {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tab-chip-del:hover {
  background-color: #fee2e2;
  color: #ef4444;
}

.tab-chip-group.active .tab-chip-del {
  color: #cbd5e1;
}

.tab-chip-group.active .tab-chip-del:hover {
  background-color: #dc2626;
  color: #ffffff;
}

.tab-chip.single {
  background-color: #f1f4f8;
}

.tab-chip.single.active {
  background-color: var(--bg-header);
  color: #ffffff;
}

.prezzari-search-wrap {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
}

.search-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  outline: none;
}

.search-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.4);
}

.prezzari-list {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prezzario-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.prezzario-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.pcard-body {
  min-width: 0;
  flex: 1;
}

.pcard-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.35;
}

.pcard-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.pcard-price {
  font-weight: 700;
  color: var(--text-main);
}

.pcard-source {
  color: #4b5563;
}

.btn-add-item {
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-weight: 600;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.btn-add-item:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-petrol);
  color: var(--primary-petrol);
}

.prezzari-panel-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border-light);
  text-align: center;
  background-color: #fafbfc;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.btn-link-upload {
  background: transparent;
  border: none;
  color: #0284c7;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link-upload:hover {
  color: #0369a1;
}

/* MOBILE LISTENING & CARDS */
.mobile-view-only {
  display: none;
}

.mobile-listening-card {
  background-color: var(--review-box-bg);
  border: 1px solid var(--review-box-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.listening-pulse-label {
  font-size: 12.5px;
  color: #0369a1;
  font-weight: 700;
  margin-bottom: 6px;
}

.speech-transcript {
  font-size: 15px;
  color: var(--text-main);
  font-weight: 500;
}

.mobile-chapter-card {
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.mchap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.mchap-header h4 {
  font-size: 15px;
  font-weight: 700;
}

.mchap-subtotal {
  font-size: 15px;
  font-weight: 800;
}

.mchap-count {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* MOBILE FIXED BOTTOM BAR */
.mobile-sticky-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border-top: 1px solid var(--border-light);
  padding: 12px 20px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  align-items: center;
  justify-content: space-between;
  z-index: 99;
}

.mobile-total-box {
  display: flex;
  flex-direction: column;
}

.mobile-total-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.mobile-total-val {
  font-size: 20px;
  font-weight: 850;
  color: var(--text-main);
}

.btn-mobile-dictate {
  background-color: var(--primary-petrol);
  color: #ffffff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-mobile-dictate.listening {
  background-color: #ef4444;
  animation: pulse 1.5s infinite;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 16px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 860px;
}

.modal-card.modal-auth {
  max-width: 440px;
  text-align: center;
  padding: 32px 24px;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 800;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f8fafc;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: #93c5fd;
  outline: none;
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.4);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.table-preview {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 12px;
}

.table-preview th {
  background-color: #f1f5f9;
  padding: 6px 10px;
  text-align: left;
  border: 1px solid #e2e8f0;
}

.table-preview td {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* APP TOAST */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background-color: var(--bg-header);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
}

.app-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* RESPONSIVE BREAKPOINT FOR MOBILE */
@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
    padding: 14px;
    padding-bottom: 90px;
  }

  .prezzari-panel {
    display: none;
  }

  .prezzari-panel.mobile-open {
    display: flex;
    position: fixed;
    inset: 12px;
    z-index: 500;
    max-height: calc(100vh - 24px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  }

  .mobile-sticky-bar {
    display: flex;
  }

  .mobile-view-only {
    display: block;
  }

  .header-actions .btn-header-export {
    display: none;
  }

  .totals-summary-bar {
    display: none;
  }
}

/* "a corpo" styling */
.cell-qty.qty-corpo {
  background-color: #f8fafc;
  color: #334155;
  font-weight: 600;
}
.btn-measure-toggle.measure-corpo {
  opacity: 0.7;
}
.btn-measure-toggle.measure-corpo:hover {
  opacity: 1;
}

/* ==========================================================================
   OTTIMIZZAZIONE STAMPA (Browser Ctrl+P e Stampa PDF)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .app-sidebar,
  .prezzari-sidebar,
  .top-header .header-actions,
  .floating-voice-btn,
  .btn-text-action,
  .btn-row-delete,
  .btn-add-note,
  .chapter-footer,
  .mobile-bottom-bar,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  .app-container {
    display: block !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .chapter-card {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    page-break-inside: auto;
    margin-bottom: 20px !important;
  }

  .computo-table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .computo-table tr {
    page-break-inside: avoid;
  }

  .cell-input {
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
    box-shadow: none !important;
  }

  /* Le note lunghe si espandono per intero senza barre di scorrimento */
  .cell-notes {
    border: none !important;
    background: transparent !important;
    resize: none !important;
    overflow: visible !important;
    height: auto !important;
    white-space: pre-wrap !important;
    font-size: 9.5pt !important;
    color: #475569 !important;
    padding: 2px 0 !important;
    box-shadow: none !important;
  }
}

