/* Mobile quotation editor corrections based on live Android screenshots. */

@media (max-width: 820px) {
  .quotation-edit-modal-backdrop {
    padding: 6px !important;
    align-items: stretch !important;
  }

  .quotation-edit-modal {
    width: 100% !important;
    max-width: none !important;
    height: calc(100dvh - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  .quotation-edit-modal .quotation-modal-head {
    position: relative;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "title close"
      "actions actions" !important;
    gap: 14px 12px !important;
    min-height: 0 !important;
    padding: 16px !important;
    align-items: start !important;
  }

  .quotation-edit-modal .quotation-modal-head > div:first-child {
    grid-area: title;
    min-width: 0;
  }

  .quotation-edit-modal .quotation-modal-head .eyebrow {
    margin: 0 0 8px !important;
    font-size: .78rem !important;
    line-height: 1.3 !important;
    overflow-wrap: anywhere;
  }

  .quotation-edit-modal #edit-quotation-title {
    margin: 0 !important;
    max-width: 100%;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    font-size: clamp(1.75rem, 8.8vw, 2.45rem) !important;
    line-height: 1.04 !important;
    letter-spacing: -.025em;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  .quotation-edit-modal #edit-quotation-title:focus,
  .quotation-edit-modal #edit-quotation-title:focus-visible {
    outline: 0 !important;
    box-shadow: none !important;
  }

  .quotation-edit-modal .quotation-save-status {
    display: inline-flex;
    width: fit-content;
    margin: 12px 0 0 !important;
    padding: 7px 12px !important;
    border-radius: 999px;
    font-size: .85rem !important;
  }

  .quotation-edit-modal .quotation-modal-close {
    grid-area: close;
    position: static !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    border-radius: 12px !important;
  }

  .quotation-edit-modal .live-editor-actions {
    grid-area: actions;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    width: 100%;
  }

  .quotation-edit-modal .quote-icon-action {
    flex: 1 1 92px !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
  }

  .quotation-edit-modal .quote-icon-action .action-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .quotation-edit-modal .quotation-modal-body {
    min-height: 0;
    padding: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #111114 !important;
  }

  .live-quotation-editor .quotation-preview {
    width: calc(100% - 12px) !important;
    max-width: none !important;
    margin: 6px auto 12px !important;
    border-radius: 12px !important;
    overflow: hidden !important;
  }

  .live-quotation-editor .quotation-paper {
    width: 100% !important;
    min-width: 0 !important;
    padding: 18px 14px 24px !important;
    overflow: hidden !important;
  }

  .live-quotation-editor .quotation-paper,
  .live-quotation-editor .quotation-paper * {
    box-sizing: border-box;
  }

  .live-quotation-editor .quotation-meta {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  .live-quotation-editor .quotation-meta > *,
  .live-quotation-editor .live-quote-fields > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .live-quotation-editor :is(input, select, textarea) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 16px !important;
  }

  .live-quotation-editor .quotation-table.live-items-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate !important;
  }

  .live-quotation-editor .live-items-table thead {
    display: none !important;
  }

  .live-quotation-editor .live-items-table tbody {
    display: grid !important;
    gap: 14px !important;
    width: 100%;
  }

  .live-quotation-editor .live-items-table tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
  }

  .live-quotation-editor .live-items-table td {
    display: grid !important;
    grid-template-columns: minmax(104px, 34%) minmax(0, 1fr) !important;
    align-items: start;
    gap: 12px;
    width: 100% !important;
    min-width: 0 !important;
    padding: 12px !important;
    border: 0 !important;
    border-bottom: 1px solid #eaecf0 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .live-quotation-editor .live-items-table td:last-child {
    border-bottom: 0 !important;
  }

  .live-quotation-editor .live-items-table td::before {
    color: #475467;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
  }

  .live-quotation-editor .live-items-table td:nth-child(1)::before { content: "Service"; }
  .live-quotation-editor .live-items-table td:nth-child(2)::before { content: "Description"; }
  .live-quotation-editor .live-items-table td:nth-child(3)::before { content: "Units"; }
  .live-quotation-editor .live-items-table td:nth-child(4)::before { content: "Line item cost"; }
  .live-quotation-editor .live-items-table td:nth-child(5)::before { content: "Total budget"; }
  .live-quotation-editor .live-items-table td:nth-child(6)::before { content: "Action"; }

  .live-quotation-editor .live-items-table td[colspan] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .live-quotation-editor .live-items-table td[colspan]::before {
    display: none;
  }

  .live-quotation-editor .live-items-table td.money {
    text-align: left !important;
  }

  .live-quotation-editor .live-items-table td :is(input, select, textarea, button) {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .live-quotation-editor .live-items-table td:nth-child(3) span {
    display: block;
    margin-top: 6px;
    color: #475467;
    line-height: 1.35;
  }

  .live-quotation-editor .quotation-total-row td,
  .live-quotation-editor .total-row td {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center;
    font-size: 1rem;
  }

  .live-quotation-editor .live-service-editor,
  .live-quotation-editor .acceptance-editor,
  .live-quotation-editor .pricing-adjustments {
    width: 100% !important;
    max-width: 100% !important;
    margin: 18px 0 !important;
    padding: 16px !important;
    border-radius: 12px !important;
  }

  .live-quotation-editor .pricing-adjustments {
    color: #101828 !important;
    background: #f8fafc !important;
  }

  .live-quotation-editor .pricing-adjustments h3,
  .live-quotation-editor .pricing-adjustments label,
  .live-quotation-editor .pricing-adjustments span,
  .live-quotation-editor .pricing-adjustments strong {
    color: #101828 !important;
  }

  .live-quotation-editor .pricing-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  .live-quotation-editor .pricing-grid label {
    min-width: 0;
    color: #344054 !important;
    font-size: .88rem;
    line-height: 1.35;
  }

  .live-quotation-editor .pricing-grid :is(input, select, textarea) {
    min-height: 48px;
    border: 1px solid #98a2b3 !important;
    background: #fff !important;
    color: #101828 !important;
    -webkit-text-fill-color: #101828 !important;
    color-scheme: light !important;
  }

  .live-quotation-editor .pricing-grid textarea {
    min-height: 96px !important;
  }

  .live-quotation-editor .pricing-grid :is(input, select, textarea)::placeholder {
    color: #667085 !important;
    opacity: 1;
  }

  .live-quotation-editor .pricing-summary {
    display: grid;
    gap: 4px;
    border: 1px solid #d0d5dd;
    background: #fff !important;
    color: #101828 !important;
  }

  .live-quotation-editor .pricing-summary div {
    gap: 14px;
    align-items: baseline;
  }

  .live-quotation-editor .pricing-summary strong {
    text-align: right;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 420px) {
  .quotation-edit-modal .quotation-modal-head {
    padding: 14px 12px !important;
  }

  .quotation-edit-modal #edit-quotation-title {
    font-size: clamp(1.65rem, 9vw, 2.15rem) !important;
  }

  .live-quotation-editor .quotation-paper {
    padding-inline: 12px !important;
  }

  .live-quotation-editor .live-items-table td {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 7px;
  }

  .live-quotation-editor .live-items-table td::before {
    margin-bottom: 2px;
  }

  .live-quotation-editor .pricing-summary div {
    align-items: flex-start;
    flex-direction: column;
  }

  .live-quotation-editor .pricing-summary strong {
    text-align: left;
  }
}
