/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

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

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  color: #333;
}

/* ── Layout ── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1e1e2e;
  color: #cdd6f4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  display: block;
  width: 100%;
  max-width: 140px;
  height: auto;
  border-radius: 4px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
}

.sidebar-link {
  display: block;
  padding: 0.6rem 1.25rem;
  color: #a6adc8;
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #cdd6f4;
}

.sidebar-link.active {
  color: #f47b20;
  border-left-color: #f47b20;
  background: rgba(244, 123, 32, 0.1);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
}

.sidebar-user {
  display: block;
  color: #6c7086;
  margin-bottom: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-signout {
  color: #a6adc8;
  text-decoration: none;
  font-size: 0.8rem;
}

.sidebar-signout:hover {
  color: #f47b20;
}

.main-content {
  flex: 1;
  min-width: 0;
  background: #f8f9fa;
}

.container {
  margin: 2rem auto;
  padding: 0 2rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: #666;
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.back-link:hover {
  color: #333;
}

.flash {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
}

.flash-notice {
  background: #d4edda;
  color: #155724;
  border-bottom: 1px solid #c3e6cb;
}

.flash-alert {
  background: #f8d7da;
  color: #721c24;
  border-bottom: 1px solid #f5c6cb;
}

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

.section-heading {
  margin-top: 1.5rem;
}

.section-heading--lg {
  margin-top: 2rem;
}

.section-table {
  margin-top: 0.75rem;
}

.th-icon {
  width: 2rem;
}

.image-preview-label {
  margin-bottom: 0.5rem;
}

.table th,
.table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #dee2e6;
  text-align: left;
}

.table th {
  font-weight: 600;
  background: #f8f9fa;
}

.table td.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0;
}

.table-clickable-rows tbody tr {
  cursor: pointer;
}

.table-clickable-rows tbody tr:hover {
  background: #f0f4ff;
}

.row-chevron {
  width: 1rem;
  text-align: right;
  color: #aaa;
  font-size: 1.2rem;
  padding-right: 0.5rem;
}

.table-clickable-rows tbody tr:hover .row-chevron {
  color: #555;
}

.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: #f47b20;
  color: #fff;
}

.btn-primary:hover {
  background: #d4680f;
}

.btn-secondary {
  background: #e9ecef;
  color: #333;
}

.btn-secondary:hover {
  background: #dee2e6;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-danger:hover {
  background: #c82333;
}

.detail-list {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.5rem 1rem;
  max-width: 600px;
}

.detail-list dt {
  font-weight: 600;
  color: #555;
}

.detail-list dd {
  margin: 0;
}

.empty-state {
  color: #888;
  font-style: italic;
  margin-top: 0.5rem;
}

.severity-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.mapping-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.mapping-badge.disabled {
  background: #e5e5e5;
  color: #666;
}

.mapping-badge.enabled {
  background: #d4edda;
  color: #155724;
}

.mapping-badge.required {
  background: #cce5ff;
  color: #004085;
}

.severity-dot {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  cursor: default;
  flex-shrink: 0;
}

.severity-low,
.severity-dot.severity-low {
  background: #EAB308;
}

.severity-medium,
.severity-dot.severity-medium {
  background: #F47B20;
}

.severity-high,
.severity-dot.severity-high {
  background: #D32F2F;
}

.severity-remove_from_service,
.severity-dot.severity-remove_from_service {
  background: #000000;
}

.severity-low {
  color: #fff;
}

.severity-medium {
  color: #fff;
}

.severity-high {
  color: #fff;
}

.severity-remove_from_service {
  color: #fff;
}

.photo-thumbs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.damage-photo {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  cursor: pointer;
}

.damage-map-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 68px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  background: #f5f5f5;
  overflow: hidden;
  cursor: pointer;
}

.damage-map-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.damage-map-pin {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f47b20;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  display: none;
}

.photo-lightbox-trigger {
  display: inline-block;
}

.map-preview-link {
  display: block;
  margin-top: 0.5rem;
}

.map-preview-frame {
  max-width: 400px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  overflow: hidden;
  cursor: zoom-in;
}

.map-preview-pdf-img {
  max-width: 100%;
  display: block;
}

.map-preview-pdf-embed {
  width: 100%;
  height: 300px;
  display: block;
  pointer-events: none;
}

.map-preview-img {
  max-width: 400px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: zoom-in;
  display: block;
  margin-top: 0.5rem;
}

.map-edit-img {
  max-width: 300px;
  max-height: 200px;
  object-fit: contain;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: zoom-in;
}

.map-edit-embed {
  width: 300px;
  height: 200px;
  pointer-events: none;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.lightbox[aria-hidden="false"] {
  display: flex;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

.lightbox-pdf-container {
  width: 92vw;
  height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
}

.lightbox-pdf-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.35rem 0.75rem;
  background: rgba(40, 40, 40, 0.95);
  color: #fff;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.lightbox-pdf-controls button {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.lightbox-pdf-controls button:hover {
  background: rgba(255, 255, 255, 0.28);
}

.lightbox-pdf-wrap {
  flex: 1;
  overflow: auto;
  background: #525659;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.lightbox-pdf-canvas-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.lightbox-pdf-pin {
  display: none;
  position: absolute;
  width: 16px;
  height: 16px;
  background: #f47b20;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.lightbox-pdf-canvas {
  display: block;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.lightbox-img-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lightbox-pin {
  display: none;
  position: absolute;
  width: 16px;
  height: 16px;
  background: #f47b20;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 1rem;
  text-decoration: none;
  user-select: none;
  opacity: 0.8;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

.lightbox-prev {
  left: 0.5rem;
}

.lightbox-next {
  right: 0.5rem;
}

.field {
  margin-bottom: 1rem;
}

.row-archived td {
  opacity: 0.5;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-search {
  padding: 0.4rem 0.7rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 0.9rem;
  width: 220px;
}

.filter-search-wide {
  width: 380px;
}

.filter-select {
  padding: 0.4rem 0.7rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
}

.filter-tabs {
  display: flex;
  gap: 0.25rem;
}

.filter-tab {
  padding: 0.35rem 0.9rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #555;
  text-decoration: none;
  background: #fff;
}

.filter-tab.active {
  background: #f47b20;
  border-color: #f47b20;
  color: #fff;
  font-weight: 600;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: #f47b20;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link-danger {
  color: #D32F2F;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.field input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.field .hint {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.2rem;
  display: block;
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

.actions input[type=submit] {
  padding: 0.4rem 0.9rem;
  background: #f47b20;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

.error-messages {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.error-messages ul {
  margin: 0;
  padding-left: 1.25rem;
}

button {
  background: none;
  border: none;
  padding: 0;
  color: #c0392b;
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
}

/* ── Auth pages (login, password reset, etc.) ── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
}

.auth-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  display: block;
  margin: 0 auto 1rem;
  max-width: 160px;
  height: auto;
  border-radius: 4px;
}

.auth-header p {
  color: #666;
  margin: 0;
  font-size: 0.95rem;
}

.auth-card .field {
  margin-bottom: 1.1rem;
}

.auth-card .field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 0.35rem;
}

.auth-card .field input[type=email],
.auth-card .field input[type=password],
.auth-card .field input[type=text] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.15s;
  outline: none;
}

.auth-card .field input:focus {
  border-color: #f47b20;
  box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.25);
}

.auth-card .field-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-card .field-inline input[type=hidden] {
  display: none;
}

.auth-card .field-inline input[type=checkbox] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.auth-card .field-inline label {
  margin: 0;
  font-weight: 400;
  color: #555;
}

.btn-auth {
  display: block;
  width: 100%;
  padding: 0.7rem;
  margin-top: 1.5rem;
  background: #f47b20;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-auth:hover {
  background: #d4680f;
}

.auth-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
}

.auth-links a {
  color: #f47b20;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* ── Forms (shared) ── */

.form-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1.5rem;
  max-width: 640px;
}

.form-card--wide {
  max-width: none;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 1rem;
}

.import-hint {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.75rem;
}

.import-panel-fields {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Import dialog ── */
.import-dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.import-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.import-dialog-inner {
  padding: 1.75rem 2rem;
}

.import-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.import-dialog-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.import-dialog-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0 0.25rem;
  text-decoration: none;
}

.import-dialog-close:hover {
  color: #000;
}

.import-columns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.import-columns-table th,
.import-columns-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #e9ecef;
}

.import-columns-table thead th {
  font-weight: 600;
  color: #555;
  background: #f8f9fa;
}

.import-columns-table code {
  font-size: 0.8rem;
  background: #f0f0f0;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.import-dialog-download {
  margin-bottom: 1.25rem;
}

.import-dialog-fields {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
  border-top: 1px solid #e9ecef;
  margin-top: 0.5rem;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label,
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: #444;
  margin-bottom: 0.3rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
  color: #333;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #f47b20;
  box-shadow: 0 0 0 2px rgba(244, 123, 32, 0.18);
}

.form-select:disabled {
  background: #f8f9fa;
  color: #999;
}

.form-static {
  padding: 0.45rem 0;
  font-size: 0.9rem;
  color: #555;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  align-items: center;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  cursor: pointer;
}

.form-errors {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #721c24;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

/* ── Quotes ── */

.container-wide {
  margin: 2rem auto;
  padding: 0 2rem;
}

.quote-number-badge {
  font-size: 0.85rem;
  font-weight: 500;
  color: #888;
  margin-left: 0.4rem;
}

.quote-opportunity {
  font-size: 0.95rem;
  color: #555;
}

/* ── Tab navigation ── */

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #dee2e6;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 0.6rem 1.1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: #333;
}

.tab-btn.active {
  color: #f47b20;
  border-bottom-color: #f47b20;
}

.tab-btn-disabled {
  opacity: 0.35;
  cursor: default;
}

.tab-content {
  padding-top: 1.5rem;
}

.markup-fields {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 480px;
  margin-bottom: 1.5rem;
}

.markup-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.markup-hint {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 0.5rem;
}

.markup-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.markup-input {
  width: 100px;
}

.markup-input[type="number"]::-webkit-inner-spin-button,
.markup-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.markup-input[type="number"] {
  -moz-appearance: textfield;
}

/* ── Shipping ── */

.shipping-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.shipping-sections .form-actions {
  margin-top: 0;
}

.shipping-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.shipping-mode-toggle {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.shipping-mode-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.shipping-charges-table {
  margin-bottom: 0.5rem;
  max-width: 520px;
}

.shipping-charges-table tbody:first-of-type tr:last-child td {
  border-bottom: none;
}

.shipping-charges-table tbody+tbody tr:first-child td {
  border-top: none;
}

.shipping-col-cost {
  width: 120px;
  text-align: left;
}

.shipping-col-action {
  width: 40px;
  text-align: center;
}

.shipping-charges-table tfoot tr td {
  border-top: 2px solid #dee2e6;
  border-bottom: none;
  padding-top: 0.5rem;
}

.shipping-total-label {
  color: #555;
}

.shipping-total-amount {
  font-weight: 600;
  text-align: right !important;
}

/* Tax */
.tax-mode-toggle {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.tax-amount-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  max-width: 480px;
}

.tax-amount-label {
  font-weight: 500;
}

.tax-amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tax-amount-input {
  width: 140px;
}

.tax-amount-input[type="number"]::-webkit-inner-spin-button,
.tax-amount-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tax-amount-input[type="number"] {
  -moz-appearance: textfield;
}

/* Hide tax amount when "additional" radio is selected */
:has(#quote_tax_additional_true:checked) #tax-amount-section {
  display: none;
}

/* T&C */
.tc-mode-toggle {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

/* Show/hide sections based on radio */
:has(#quote_tc_custom_false:checked) .tc-custom-section {
  display: none;
}

:has(#quote_tc_custom_true:checked) .tc-default-section {
  display: none;
}

.tc-preview-table {
  max-width: 1000px;
  margin-bottom: 1.5rem;
}

.tc-preview-table tbody tr:last-child td,
.tc-terms-list tr:last-child td {
  border-bottom: none;
}

.tc-preview-title {
  white-space: nowrap;
  font-weight: 500;
  vertical-align: top;
  padding-right: 1rem;
  width: 280px;
}

.tc-customize-hint {
  color: #666;
  margin-bottom: 1.5rem;
}

.tc-terms-list {
  /* tbody — inherits table layout */
}

.tc-row td {
  vertical-align: top;
}

.tc-col-title {
  white-space: nowrap;
  font-weight: 500;
  vertical-align: top;
  width: 280px;
  padding-right: 1rem;
}

.tc-col-action {
  width: 40px;
  text-align: center;
  vertical-align: top;
}

.tc-title-input {
  width: 100%;
  font-weight: 500;
  font-size: inherit;
}

.tc-body-input {
  width: 100%;
  font-size: inherit;
  field-sizing: content;
  min-height: 4rem;
  resize: vertical;
}

.tc-remove-btn {
  flex-shrink: 0;
}

.tc-add-btn {
  margin-bottom: 1rem;
}

.tc-save-row {
  max-width: 720px;
  margin-top: 0.25rem;
}

/* Notes */
.quote-notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-width: 720px;
}

.quote-note-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.quote-note-row .field_with_errors {
  display: contents;
}

.quote-note-input {
  flex: 1;
  field-sizing: content;
  min-height: 4rem;
  resize: vertical;
}

.quote-note-remove {
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.shipping-charge-row .field_with_errors {
  display: contents;
}

:has(#quote_shipping_additional_true:checked) .shipping-charges-section {
  display: none;
}

.shipping-add-cell {
  border-top: none;
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
}

.shipping-charges-add {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.shipping-desc-input {
  width: 100%;
}

.shipping-cost-wrap {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.shipping-currency-sign {
  color: #555;
  font-size: 0.9rem;
}

.shipping-cost-input {
  width: 100px;
  text-align: right;
}

.shipping-cost-input[type="number"]::-webkit-inner-spin-button,
.shipping-cost-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.shipping-cost-input[type="number"] {
  -moz-appearance: textfield;
}

.lead-time-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lead-time-input {
  width: 220px;
}

.lead-time-hint {
  font-size: 0.8rem;
  color: #888;
}

.tab-placeholder {
  background: #fff;
  border: 1px dashed #dee2e6;
  border-radius: 6px;
  padding: 2rem;
  color: #999;
  font-style: italic;
  max-width: 520px;
}

/* ── Pagy pagination ── */

.pagy {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
}

.pagy a,
.pagy span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  text-decoration: none;
  color: #555;
  background: #fff;
  line-height: 1;
}

.pagy a:hover {
  background: #f0f4ff;
  border-color: #b0bdcc;
  color: #333;
}

.pagy span[aria-current] {
  background: #f47b20;
  border-color: #f47b20;
  color: #fff;
  font-weight: 600;
}

.pagy span.pagy-gap {
  border: none;
  background: none;
  color: #aaa;
}

/* ── Damage tab ── */

.filter-bar-wrap {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.filter-date-range {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-date {
  padding: 0.4rem 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 0.875rem;
  width: 140px;
}

.filter-date-sep {
  color: #999;
  font-size: 0.85rem;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.damage-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.damage-tab-count {
  font-size: 0.875rem;
  color: #555;
}

.damage-tab-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.damage-tab-table-wrap {
  overflow-x: auto;
}

.damage-tab-table {
  min-width: 700px;
}

.repair-kits-table-wrap {
  overflow-x: auto;
}

.repair-kits-table {
  min-width: 800px;
}

.repair-kit-actions {
  white-space: nowrap;
  vertical-align: middle;
}

.repair-kit-actions-group {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.repair-kit-actions-group [data-controller="dialog"] {
  display: inline;
}

.repair-kit-picker-dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  max-width: 960px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.repair-kit-picker-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.custom-part-dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.custom-part-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.custom-part-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.custom-part-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.custom-part-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
}

.custom-part-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.custom-part-row-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.75rem;
}

.custom-part-row-3 label,
.custom-part-row-4 label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.2rem;
}

.custom-part-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.parts-picker-table {
  font-size: 0.875rem;
  width: 100%;
  table-layout: fixed;
}

.parts-picker-table th:nth-child(1),
.parts-picker-table td:nth-child(1) {
  width: 22%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parts-picker-table th:nth-child(2),
.parts-picker-table td:nth-child(2) {
  width: 13%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parts-picker-table th:nth-child(3),
.parts-picker-table td:nth-child(3) {
  width: 14%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parts-picker-table th:nth-child(4),
.parts-picker-table td:nth-child(4) {
  width: 15%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parts-picker-table th:nth-child(5),
.parts-picker-table td:nth-child(5) {
  width: 10%;
}

.parts-picker-table th:nth-child(6),
.parts-picker-table td:nth-child(6) {
  width: 10%;
}

.parts-picker-table th:nth-child(7),
.parts-picker-table td:nth-child(7) {
  width: 10%;
}

.parts-picker-table th:nth-child(8),
.parts-picker-table td:nth-child(8) {
  width: 6%;
  text-align: right;
}

.parts-picker-added {
  font-size: 0.8rem;
  color: #28a745;
  font-weight: 600;
}

.parts-picker-loading {
  padding: 2rem;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
}

/* ── Damage groups (tbody per damage) ── */
tbody.damage-group {
  border-bottom: 1px solid #dee2e6;
}

tbody.damage-group>tr:first-child td {
  border-bottom: none;
}

.kit-parts-accent {
  padding: 0 !important;
  width: 4px;
  background: linear-gradient(to bottom, #e87722, #f0a060);
}

.repair-kit-parts-row:not(:has(tbody tr)) {
  display: none;
}

.repair-kit-parts-row>td {
  padding-top: 0;
  padding-bottom: 0.6rem;
  border-top: none;
  border-bottom: none;
  background: #f9fafc;
}

.repair-kit-parts-cell {
  padding: 0.25rem 1rem 0.6rem 0.75rem !important;
  background: #f9fafc;
}

.kit-parts-accent-plain {
  background: none !important;
  border-top: none !important;
  border-bottom: none !important;
}

.repair-kit-parts-table {
  width: 100%;
  font-size: 0.82rem;
  border-collapse: collapse;
}

.repair-kit-parts-table th {
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  color: #666;
  white-space: nowrap;
  border-bottom: 1px solid #dde1ea;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  background: #f0f2f7;
}

.repair-kit-parts-table td {
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid #eef0f4;
  color: #444;
  vertical-align: middle;
}

.repair-kit-parts-table tbody tr:last-child td {
  border-bottom: none;
}

.repair-kit-parts-table tbody tr:hover td {
  background: #f0f3fa;
}

.rkp-col-num {
  text-align: right;
  white-space: nowrap;
}

.rkp-input {
  width: 80px;
  padding: 0.2rem 0.35rem;
  font-size: 0.8rem;
  border: 1px solid #d0d4dc;
  border-radius: 4px;
  text-align: right;
  background: #fff;
}

.rkp-input[type="number"]::-webkit-inner-spin-button,
.rkp-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.rkp-input[type="number"] {
  -moz-appearance: textfield;
}

.rkp-input-sm {
  width: 52px;
}

.default-value-modified {
  border-color: #e87722;
  background: #fff8f3;
  color: #8b3e00;
  font-weight: 600;
}

.default-value-modified:focus {
  border-color: #e87722;
  box-shadow: 0 0 0 2px rgba(232, 119, 34, 0.2);
}

.default-value-tooltip-wrap {
  position: relative;
  display: inline-block;
}

/* Tooltip wrapper inserted by default_value_controller around inputs */
[data-default-value-tip] {
  position: relative;
  flex: 1;
}

.default-value-tooltip-wrap::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #2c2c2c;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
}

.default-value-tooltip-wrap::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #2c2c2c;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
}

.default-value-tooltip-wrap:hover::after,
.default-value-tooltip-wrap:hover::before {
  opacity: 1;
}

.rkp-input-text {
  width: 100%;
  text-align: left;
}

.rkp-input:focus {
  outline: none;
  border-color: #6c8ebf;
  box-shadow: 0 0 0 2px rgba(108, 142, 191, 0.2);
}

.rkp-row-custom {}

.badge-custom {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7c5a00;
  background: #fff3cd;
  border: 1px solid #f0d080;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.rkp-actions {
  white-space: nowrap;
  text-align: right;
}

.rkp-actions form {
  display: inline;
}

.btn-xs {
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
}

.btn-xs:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn-remove-rkp {
  color: #aaa;
  border-color: #ddd;
}

.btn-remove-rkp:hover {
  color: #c0392b;
  background: #fdecea;
  border-color: #f5c6c2;
}

.damage-tab-table .col-check {
  width: 2rem;
  text-align: center;
}

.select-all-none {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #999;
}

.select-all-none button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #999;
  cursor: pointer;
  text-transform: lowercase;
}

.select-all-none button:hover {
  color: #f47b20;
  text-decoration: underline;
}

.select-all-none-sep {
  opacity: 0.4;
  font-size: 0.65rem;
}

.damage-tab-table .col-severity {
  width: 2rem;
  text-align: center;
}

.damage-checkbox {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: #f47b20;
}

.damage-row-selected td {
  background: #fff8f3;
}

.damage-row-selected:hover td {
  background: #ffeedd;
}

/* ── Labor Tab ───────────────────────────────────────────────── */

.labor-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.labor-section {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 1.5rem;
}

.labor-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.labor-subsection-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #555;
  margin: 1.25rem 0 0.6rem 0;
}

.labor-subsection-title:first-of-type {
  margin-top: 0;
}

.labor-fields-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.labor-fields-row .form-group {
  flex: 1 1 200px;
}

.labor-crew-select {
  min-width: 140px;
  max-width: 160px;
}

.labor-count-input {
  max-width: 120px;
}

.labor-travel-grid {
  display: grid;
  grid-template-columns: 0.5fr 2fr 2fr 1fr 1fr 1fr;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

@media (max-width: 1100px) {
  .labor-travel-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.labor-miles-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.labor-miles-input {
  max-width: 120px;
}

.labor-rate-input {
  max-width: 120px;
}

.labor-calc-value {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  padding: 0.45rem 0;
}

.labor-rates-table {
  width: auto;
  border-collapse: collapse;
}

.labor-rates-table th,
.labor-rates-table td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #f0f0f0;
}

.labor-rates-table thead th {
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  white-space: nowrap;
}

.labor-row-header {
  font-weight: 600;
  color: #444;
  white-space: nowrap;
}

.labor-rate-cell-input {
  width: 110px;
}

.labor-na-cell {
  color: #bbb;
  text-align: center;
}

.labor-tanks-row {
  margin-top: 1rem;
}

/* Days table */
.labor-days-actions {
  margin-bottom: 0.75rem;
}

.labor-days-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.labor-days-table {
  width: auto;
  border-collapse: collapse;
}

.labor-days-table th,
.labor-days-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #f0f0f0;
  text-align: center;
  vertical-align: middle;
}

.labor-days-table thead th {
  font-size: 0.78rem;
  font-weight: 600;
  color: #666;
}

.labor-col-day {
  width: 3rem;
}

.labor-col-type {
  width: 8rem;
  text-align: left;
}

.labor-col-cb {
  width: 4.5rem;
}

.labor-col-total {
  width: 7rem;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.labor-col-action {
  width: 2.5rem;
}

.labor-type-select {
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
}

.labor-add-day-btn {
  margin-top: 0.25rem;
}

.labor-tfoot-add {
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: none;
}

.table td.labor-tfoot-add {
  text-align: left;
}

/* Summary table */
.labor-summary-table {
  width: 100%;
  border-collapse: collapse;
  max-width: 400px;
}

.labor-summary-table td,
.labor-summary-table th {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}

.labor-summary-cost-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 100px;
}

.labor-total-label {
  font-weight: 600;
  color: #444;
}

.labor-total-amount {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1a1a1a;
}

.labor-grand-summary {
  max-width: 360px;
}

.labor-type-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.labor-type-toggle input[type="radio"] {
  accent-color: #f47b20;
}

.labor-type-toggle label {
  font-weight: 500;
  cursor: pointer;
}

.labor-kit-estimate {
  font-size: 0.875rem;
  color: #666;
  margin: 0 0 0.75rem 0;
}

.labor-kit-estimate strong {
  color: #1a1a1a;
}

.labor-installers-row {
  justify-content: flex-start;
}

.labor-installers-row .form-group {
  flex: 0 0 auto;
}

/* Remove number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

.labor-days-total-label {
  text-align: right;
  font-weight: 600;
  color: #444;
}

.labor-days-total-amount {
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  border-top: 2px solid #e8e8e8;
}

.labor-equip-calc-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #444;
  font-weight: 600;
  white-space: nowrap;
  min-width: 80px;
}

/* Explicit right-align overrides (beats .table th/td { text-align: left } specificity) */
.table td.labor-col-total,
.table th.labor-col-total,
.table td.labor-summary-cost-col,
.table td.labor-equip-calc-col,
.table th.labor-equip-calc-col,
.table td.labor-days-total-amount,
.table td.labor-days-total-label {
  text-align: right;
}

.labor-mileage-error {
  font-size: 0.8rem;
  color: #c0392b;
  margin-top: 0.25rem;
}

.labor-cell-currency,
.labor-currency-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}

.labor-cell-currency .shipping-currency-sign {
  flex-shrink: 0;
}

.settings-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.settings-hint {
  color: #666;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.input--error {
  border-color: #e53e3e !important;
  background-color: #fff5f5;
}

.field-error {
  font-size: 0.78rem;
  color: #c53030;
  margin: 0;
}

.tc-form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.tc-save-actions {
  margin-top: 1.25rem;
}

.tc-destroy-cell {
  display: none;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.btn-icon:hover {
  color: #c0392b;
  background: #fdf0f0;
}

.table-actions {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}

.text-right {
  text-align: right;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ── Quote Preview ── */

.preview-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}

.qp {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 2.5rem;
  max-width: 900px;
  font-size: 0.875rem;
  color: #222;
}

/* Header */
.qp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid #e5e7eb;
}

.qp-logo-img {
  max-width: 160px;
  height: auto;
}

.qp-company-info {
  text-align: right;
  font-size: 0.8rem;
  color: #555;
  line-height: 1.6;
}

.qp-placeholder,
.qp-company-placeholder {
  color: #e06c00;
  font-style: italic;
  font-size: 0.78rem;
}

/* Meta table */
.qp-meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
}

.qp-meta-table th,
.qp-meta-table td {
  padding: 0.3rem 0.6rem;
  border: 1px solid #dee2e6;
}

.qp-meta-table th {
  background: #f3f4f6;
  font-weight: 600;
  white-space: nowrap;
  width: 1%;
}

/* Bill To / Ship To */
.qp-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.qp-party-header {
  background: #e87722;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.qp-party-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.qp-party-table th,
.qp-party-table td {
  padding: 0.25rem 0.5rem;
  border: 1px solid #dee2e6;
}

.qp-party-table th {
  background: #f3f4f6;
  font-weight: 600;
  white-space: nowrap;
  width: 1%;
}

/* Intro */
.qp-intro {
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: #444;
}

/* Line items table */
.qp-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
}

.qp-items-table thead th {
  background: #f3f4f6;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border: 1px solid #dee2e6;
  text-align: left;
}

.qp-items-table tbody td,
.qp-items-table tfoot td {
  padding: 0.35rem 0.6rem;
  border: 1px solid #dee2e6;
  vertical-align: top;
}

.qp-col-item {
  width: 4rem;
  white-space: nowrap;
  text-align: center;
}

.qp-col-qty {
  width: 3rem;
  text-align: center;
}

.qp-col-price {
  width: 7rem;
  text-align: right;
  white-space: nowrap;
}

.qp-empty {
  color: #999;
  font-style: italic;
  text-align: center;
}

.qp-note-cell {
  border-top: none;
  border-bottom: none;
  color: #333;
  font-size: 0.8rem;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.qp-note-indent {
  padding-left: 1.5rem;
}

/* Totals */
.qp-items-table tfoot .qp-total-label {
  text-align: right;
  font-weight: 500;
  background: #f9fafb;
}

.qp-items-table tfoot .qp-total-value {
  text-align: right;
  white-space: nowrap;
}

.qp-grand-total .qp-total-label,
.qp-grand-total .qp-total-value {
  font-weight: 700;
  font-size: 0.95rem;
  background: #f3f4f6;
}

/* Quote locked banner */
.quote-locked-banner {
  background: #fff8e1;
  border: 1px solid #f0c040;
  border-radius: 4px;
  color: #7a5800;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.is-locked input,
.is-locked textarea,
.is-locked select {
  background: #f3f4f6 !important;
  color: #6b7280 !important;
  border-color: #d1d5db !important;
  pointer-events: none;
  cursor: not-allowed;
}

.is-locked button,
.is-locked a.btn,
.is-locked input[type="submit"],
.is-locked input[type="checkbox"],
.is-locked input[type="radio"] {
  pointer-events: none;
  opacity: 0.45;
  cursor: not-allowed;
}

/* Finalization */
.finalize-status {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.finalize-divider {
  border: none;
  border-top: 1px solid #dee2e6;
  margin: 0.75rem 0;
}

.finalize-status--done {
  background: #f0faf0;
  border-color: #74c474;
}

.finalize-status--pending {
  background: #fafafa;
  border-color: #dee2e6;
}

.finalize-status-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.finalize-status--done .finalize-status-icon {
  color: #2d7a2d;
}

.finalize-status--pending .finalize-status-icon {
  color: #aaa;
}

.finalize-status--approved {
  background: #f0f6ff;
  border-color: #6699cc;
}

.finalize-status--approved .finalize-status-icon {
  color: #2255aa;
}

.finalize-divider {
  border: none;
  border-top: 1px solid #dee2e6;
  margin: 1.5rem 0;
}

/* Closing */
.qp-closing {
  font-size: 0.82rem;
  color: #444;
  margin-bottom: 1.5rem;
}

/* T&C */
.qp-section-heading {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.qp-terms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-bottom: 1.5rem;
}

.qp-terms-table td {
  padding: 0.35rem 0.6rem;
  border: 1px solid #dee2e6;
  vertical-align: top;
}

.qp-term-title {
  font-weight: 600;
  white-space: nowrap;
  width: 160px;
  background: #f9fafb;
}

.qp-term-body {
  color: #333;
}

/* Signature block */
.qp-signature-block {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 0.5rem;
  border-top: 1px solid #dee2e6;
}

.qp-sig-field {
  height: 2.5rem;
  border-bottom: 1px solid #222;
  margin-bottom: 0.35rem;
}

.qp-sig-label {
  font-size: 0.75rem;
  color: #666;
  text-align: center;
}

/* Print */
@media print {

  .sidebar,
  .tab-nav,
  .back-link,
  .page-header,
  .preview-actions {
    display: none !important;
  }

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

  .tab-content {
    padding: 0 !important;
  }

  .qp {
    border: none;
    padding: 0;
    max-width: none;
  }

  .qp-items-table tr,
  .qp-party-table tr,
  .qp-meta-table tr,
  .qp-terms-table tr {
    break-inside: avoid;
  }
}