/**
 * Compact vertical layout for document screens (Invoice, Job Card, Quote,
 * Booking, Purchase Invoice) — matches legacy desktop density on tablet+.
 * Mobile-first: rules apply from 768px up; phones keep touch-friendly sizing.
 */

@media (min-width: 768px) {

    /* Scope: document panel wrappers */
    [ng-app="tpApp"] .mm-doc-screen.panel-primary > .panel-heading,
    [ng-app="tpApp"] .invoicechange.panel-primary > .panel-heading,
    [ng-app="tpApp"] .JobCardchange.panel-primary > .panel-heading,
    [ng-app="tpApp"] .MechQuotechange.panel-primary > .panel-heading {
        padding: 8px 12px !important;
        font-size: 15px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen.panel-primary > .panel-body,
    [ng-app="tpApp"] .invoicechange.panel-primary > .panel-body,
    [ng-app="tpApp"] .JobCardchange.panel-primary > .panel-body,
    [ng-app="tpApp"] .MechQuotechange.panel-primary > .panel-body {
        padding: 5px 15px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .panel-body.pad,
    [ng-app="tpApp"] .invoicechange .panel-body.pad,
    [ng-app="tpApp"] .JobCardchange .panel-body.pad,
    [ng-app="tpApp"] .MechQuotechange .panel-body.pad {
        padding: 0 5px 5px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .tab-content,
    [ng-app="tpApp"] .invoicechange .tab-content,
    [ng-app="tpApp"] .JobCardchange .tab-content,
    [ng-app="tpApp"] .MechQuotechange .tab-content {
        min-height: 0 !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .row.jumbotron,
    [ng-app="tpApp"] .invoicechange .row.jumbotron,
    [ng-app="tpApp"] .JobCardchange .row.jumbotron,
    [ng-app="tpApp"] .MechQuotechange .row.jumbotron {
        padding: 0 !important;
        margin-bottom: 0 !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .row,
    [ng-app="tpApp"] .invoicechange .row,
    [ng-app="tpApp"] .JobCardchange .row,
    [ng-app="tpApp"] .MechQuotechange .row {
        margin-left: 0;
        margin-right: 0;
    }

    [ng-app="tpApp"] .mm-doc-screen .row + .row,
    [ng-app="tpApp"] .invoicechange .row + .row,
    [ng-app="tpApp"] .JobCardchange .row + .row,
    [ng-app="tpApp"] .MechQuotechange .row + .row {
        margin-top: 2px;
    }

    /* Legacy 20px fields — override modern-theme min-height: 36px */
    [ng-app="tpApp"] .mm-doc-screen .txt,
    [ng-app="tpApp"] .invoicechange .txt,
    [ng-app="tpApp"] .JobCardchange .txt,
    [ng-app="tpApp"] .MechQuotechange .txt,
    [ng-app="tpApp"] .mm-doc-screen .tpControl1,
    [ng-app="tpApp"] .invoicechange .tpControl1,
    [ng-app="tpApp"] .JobCardchange .tpControl1,
    [ng-app="tpApp"] .MechQuotechange .tpControl1,
    [ng-app="tpApp"] .mm-doc-screen .tpControl2,
    [ng-app="tpApp"] .invoicechange .tpControl2,
    [ng-app="tpApp"] .JobCardchange .tpControl2,
    [ng-app="tpApp"] .MechQuotechange .tpControl2,
    [ng-app="tpApp"] .mm-doc-screen .cuform-control,
    [ng-app="tpApp"] .invoicechange .cuform-control,
    [ng-app="tpApp"] .JobCardchange .cuform-control,
    [ng-app="tpApp"] .MechQuotechange .cuform-control,
    [ng-app="tpApp"] .mm-doc-screen .Cform-control,
    [ng-app="tpApp"] .invoicechange .Cform-control,
    [ng-app="tpApp"] .JobCardchange .Cform-control,
    [ng-app="tpApp"] .MechQuotechange .Cform-control,
    [ng-app="tpApp"] .mm-doc-screen .tpControl1 select,
    [ng-app="tpApp"] .invoicechange select.tpControl1,
    [ng-app="tpApp"] .JobCardchange select.tpControl1,
    [ng-app="tpApp"] .MechQuotechange select.tpControl1 {
        min-height: 20px !important;
        height: 20px !important;
        padding: 0 5px !important;
        font-size: 14px !important;
        line-height: 18px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen label:not(.mm-doc-caption),
    [ng-app="tpApp"] .invoicechange label:not(.mm-doc-caption),
    [ng-app="tpApp"] .JobCardchange label:not(.mm-doc-caption),
    [ng-app="tpApp"] .MechQuotechange label:not(.mm-doc-caption),
    [ng-app="tpApp"] .mm-doc-screen .legendClass,
    [ng-app="tpApp"] .invoicechange .legendClass,
    [ng-app="tpApp"] .JobCardchange .legendClass,
    [ng-app="tpApp"] .MechQuotechange .legendClass {
        margin-bottom: 0 !important;
        font-size: 12px !important;
        font-weight: 600 !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .btn,
    [ng-app="tpApp"] .invoicechange .btn,
    [ng-app="tpApp"] .JobCardchange .btn,
    [ng-app="tpApp"] .MechQuotechange .btn {
        padding: 2px 8px !important;
        min-height: 0 !important;
        font-size: 13px !important;
        line-height: 1.3 !important;
        box-shadow: none !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .btn-xs,
    [ng-app="tpApp"] .invoicechange .btn-xs,
    [ng-app="tpApp"] .JobCardchange .btn-xs,
    [ng-app="tpApp"] .MechQuotechange .btn-xs {
        padding: 1px 5px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .purchaseMenu,
    [ng-app="tpApp"] .invoicechange .purchaseMenu,
    [ng-app="tpApp"] .JobCardchange .purchaseMenu,
    [ng-app="tpApp"] .MechQuotechange .purchaseMenu {
        min-height: 24px !important;
        margin-bottom: 2px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .purchaseMenu ul li a,
    [ng-app="tpApp"] .invoicechange .purchaseMenu ul li a,
    [ng-app="tpApp"] .JobCardchange .purchaseMenu ul li a,
    [ng-app="tpApp"] .MechQuotechange .purchaseMenu ul li a {
        padding: 2px 10px !important;
        font-size: 13px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .nav-tabs > li > a,
    [ng-app="tpApp"] .invoicechange .nav-tabs > li > a,
    [ng-app="tpApp"] .JobCardchange .nav-tabs > li > a,
    [ng-app="tpApp"] .MechQuotechange .nav-tabs > li > a {
        padding: 6px 10px !important;
        font-size: 13px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen fieldset,
    [ng-app="tpApp"] .invoicechange fieldset,
    [ng-app="tpApp"] .JobCardchange fieldset,
    [ng-app="tpApp"] .MechQuotechange fieldset {
        padding: 4px 6px !important;
        margin-bottom: 4px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen textarea.tpControl,
    [ng-app="tpApp"] .invoicechange textarea.tpControl,
    [ng-app="tpApp"] .JobCardchange textarea.tpControl,
    [ng-app="tpApp"] .MechQuotechange textarea.tpControl {
        min-height: 48px !important;
        height: 48px !important;
        max-height: 72px;
        padding: 4px 6px !important;
        font-size: 13px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .input-group-addon,
    [ng-app="tpApp"] .invoicechange .input-group-addon,
    [ng-app="tpApp"] .JobCardchange .input-group-addon,
    [ng-app="tpApp"] .MechQuotechange .input-group-addon {
        padding: 2px 6px !important;
        min-height: 20px !important;
        height: 20px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .ui-grid,
    [ng-app="tpApp"] .invoicechange .ui-grid,
    [ng-app="tpApp"] .JobCardchange .ui-grid,
    [ng-app="tpApp"] .MechQuotechange .ui-grid {
        min-height: 0 !important;
    }

    [ng-app="tpApp"] .mm-doc-screen .cust-margin-5px,
    [ng-app="tpApp"] .invoicechange .cust-margin-5px,
    [ng-app="tpApp"] .JobCardchange .cust-margin-5px,
    [ng-app="tpApp"] .MechQuotechange .cust-margin-5px {
        margin-top: 3px !important;
    }

    [ng-app="tpApp"] .mm-doc-screen.panel-primary,
    [ng-app="tpApp"] .invoicechange.panel-primary,
    [ng-app="tpApp"] .JobCardchange.panel-primary,
    [ng-app="tpApp"] .MechQuotechange.panel-primary {
        margin-bottom: 0 !important;
    }
}

/* Override tablet body padding bleed on document screens */
@media (min-width: 768px) {
    .mm-bp-tablet [ng-app="tpApp"] .mm-doc-screen.panel-primary > .panel-body,
    .mm-bp-tablet [ng-app="tpApp"] .invoicechange.panel-primary > .panel-body,
    .mm-bp-tablet [ng-app="tpApp"] .JobCardchange.panel-primary > .panel-body,
    .mm-bp-tablet [ng-app="tpApp"] .MechQuotechange.panel-primary > .panel-body {
        padding: 5px 15px !important;
    }
}

/* Rego, Customer, Fleet, Vin — left edge aligned with line-item grid */
[ng-app="tpApp"] .mm-doc-screen #InvoiceDetail .row,
[ng-app="tpApp"] .mm-doc-screen #JobDetail .row,
[ng-app="tpApp"] .mm-doc-screen #MechQuoteDetail .row {
    margin-left: -15px !important;
    margin-right: -15px !important;
}

[ng-app="tpApp"] .mm-doc-screen #InvoiceDetail [class*="col-"].mm-doc-grid-align,
[ng-app="tpApp"] .mm-doc-screen #JobDetail [class*="col-"].mm-doc-grid-align,
[ng-app="tpApp"] .mm-doc-screen #MechQuoteDetail [class*="col-"].mm-doc-grid-align,
[ng-app="tpApp"] .mm-doc-screen #InvoiceDetail .row.mm-doc-grid-align > .UI_Grid_SpreadSheet,
[ng-app="tpApp"] .mm-doc-screen #JobDetail .row.mm-doc-grid-align > .UI_Grid_SpreadSheet,
[ng-app="tpApp"] .mm-doc-screen #MechQuoteDetail .row.mm-doc-grid-align > .UI_Grid_SpreadSheet,
[ng-app="tpApp"] .mm-doc-screen #InvoiceDetail .row.mm-doc-grid-align > [class*="col-"],
[ng-app="tpApp"] .mm-doc-screen #JobDetail .row.mm-doc-grid-align > [class*="col-"],
[ng-app="tpApp"] .mm-doc-screen #MechQuoteDetail .row.mm-doc-grid-align > [class*="col-"] {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

[ng-app="tpApp"] .mm-doc-screen #InvoiceDetail .row.mm-doc-grid-align,
[ng-app="tpApp"] .mm-doc-screen #JobDetail .row.mm-doc-grid-align,
[ng-app="tpApp"] .mm-doc-screen #MechQuoteDetail .row.mm-doc-grid-align {
    margin-left: -15px !important;
    margin-right: -15px !important;
}

[ng-app="tpApp"] .mm-doc-screen #InvoiceDetail .mm-doc-vehicle-row my-component > div > .row,
[ng-app="tpApp"] .mm-doc-screen #JobDetail .mm-doc-vehicle-row my-component > div > .row,
[ng-app="tpApp"] .mm-doc-screen #MechQuoteDetail .mm-doc-vehicle-row my-component > div > .row {
    margin-left: -15px !important;
    margin-right: -15px !important;
}

[ng-app="tpApp"] .mm-doc-screen #InvoiceDetail .mm-doc-vehicle-row my-component > div > .row > .col-sm-2:first-child,
[ng-app="tpApp"] .mm-doc-screen #JobDetail .mm-doc-vehicle-row my-component > div > .row > .col-sm-2:first-child,
[ng-app="tpApp"] .mm-doc-screen #MechQuoteDetail .mm-doc-vehicle-row my-component > div > .row > .col-sm-2:first-child {
    margin-left: 0 !important;
    padding-left: 15px !important;
}

/* Line grid: dynamic height (5–20 rows) set from doc controllers */
[ng-app="tpApp"] .mm-doc-screen.invoicechange .UI_Grid_SpreadSheet #myGrid1,
[ng-app="tpApp"] .mm-doc-screen.MechQuotechange .UI_Grid_SpreadSheet #myGrid1,
[ng-app="tpApp"] .mm-doc-screen.JobCardchange .UI_Grid_SpreadSheet #myGrid1 {
    min-height: 190px;
    max-height: none !important;
}

/* Rego No. / Customer Name / Cust No. — identical caption styling (matches Rego No.) */
[ng-app="tpApp"] .mm-doc-screen label.mm-doc-caption,
[ng-app="tpApp"] .invoicechange label.mm-doc-caption,
[ng-app="tpApp"] .JobCardchange label.mm-doc-caption,
[ng-app="tpApp"] .MechQuotechange label.mm-doc-caption {
    color: blue;
    font-size: large;
    font-weight: normal;
    padding-top: 1px;
    margin-bottom: 0 !important;
    line-height: normal;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-custno-wrap {
    padding-left: 0;
    padding-right: 0;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-custno-spacer {
    height: 20px;
    margin-top: -4px;
    margin-bottom: 2px;
    flex-shrink: 0;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-custno-label {
    display: block;
    margin: 0 !important;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-custno-input {
    margin-left: 0 !important;
    margin-top: 0;
    width: 100%;
    max-width: 120px;
    visibility: visible !important;
}

/* Keep Customer Name + Cust No. label and input rows aligned across columns */
[ng-app="tpApp"] .mm-doc-screen .mm-doc-customer-name-label,
[ng-app="tpApp"] .mm-doc-screen .mm-doc-custno-label {
    min-height: 1.2em;
}

/* Mechanic / Job No. — label vertically centred with control; equal input widths */
[ng-app="tpApp"] .mm-doc-screen .mm-doc-inline-field {
    display: flex;
    align-items: center;
    width: 100%;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-inline-label {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
    text-align: right;
    padding-right: 4px;
    margin: 0 !important;
    line-height: 20px;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-inline-control {
    flex: 0 0 58.333333%;
    max-width: 58.333333%;
    min-width: 0;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-mechanic-row {
    margin-top: -4px;
}

[ng-app="tpApp"] .mm-doc-screen employee-drop-down34 fieldset,
[ng-app="tpApp"] .mm-doc-screen employee-drop-down2 fieldset {
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0;
}

[ng-app="tpApp"] .mm-doc-screen employee-drop-down34 .tpControl1,
[ng-app="tpApp"] .mm-doc-screen employee-drop-down2 .tpControl1,
[ng-app="tpApp"] .mm-doc-screen employee-drop-down2 select.tpControl1 {
    width: 100% !important;
    box-sizing: border-box;
}

/* Booking — Mechanic + Terms: right-aligned labels, equal-width inputs */
[ng-app="tpApp"] .mm-doc-screen .mm-doc-booking-staff-fields {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 25px;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-booking-staff-fields .mm-doc-inline-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-booking-staff-fields .mm-doc-inline-label {
    flex: 0 0 72px;
    max-width: 72px;
    text-align: right;
    padding-right: 4px;
}

[ng-app="tpApp"] .mm-doc-screen .mm-doc-booking-staff-fields .mm-doc-inline-control {
    flex: 0 0 160px;
    max-width: 160px;
    min-width: 160px;
}

/* Touch tablets: keep Part No. editor stable when the virtual keyboard opens */
@media (pointer: coarse) {
    [ng-app="tpApp"] .UI_Grid_SpreadSheet .ui-grid-cell input,
    [ng-app="tpApp"] #myGrid1 .ui-grid-cell input,
    [ng-app="tpApp"] .gridPurchaseList .ui-grid-cell input {
        font-size: 16px;
        touch-action: manipulation;
    }

    [ng-app="tpApp"] .UI_Grid_SpreadSheet .ui-grid-viewport,
    [ng-app="tpApp"] #myGrid1 .ui-grid-viewport,
    [ng-app="tpApp"] .gridPurchaseList .ui-grid-viewport {
        scroll-padding-bottom: 120px;
    }

    [ng-app="tpApp"] .mm-inventory-lookup-popup {
        position: fixed !important;
        z-index: 10050;
    }
}
