:root {
    --brand: #1f3a5f;
    --brand-light: #e8eef6;
    --rule: #c9d2dc;
    --muted: #5f6b7a;
    --nav-width: 230px;
}

html, body {
    height: 100%;
}

body {
    background: #f5f7fa;
    color: #1d2530;
    font-size: 14px;
}

/* ---------- Shell ---------- */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 1.25rem;
    background: var(--brand);
    color: #fff;
}

.app-brand {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
    text-decoration: none;
}

.app-brand:hover {
    color: #fff;
}

.app-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.app-shell {
    display: flex;
    min-height: calc(100% - 52px);
}

.app-nav {
    flex: 0 0 var(--nav-width);
    padding: 1rem 0.75rem;
    background: #fff;
    border-right: 1px solid var(--rule);
}

.app-nav-section + .app-nav-section {
    margin-top: 1.25rem;
}

.app-nav-heading {
    padding: 0 0.5rem 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.app-nav-link {
    display: block;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    color: #1d2530;
    text-decoration: none;
}

.app-nav-link:hover {
    background: var(--brand-light);
}

.app-nav-link.active {
    background: var(--brand);
    color: #fff;
}

.app-nav-link.disabled {
    color: #9aa4b0;
    cursor: default;
}

.app-nav-link.disabled:hover {
    background: none;
}

.app-nav-empty {
    color: var(--muted);
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.25rem 1.5rem 3rem;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ---------- Menu & login ---------- */

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.menu-card {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 1rem 1.25rem;
}

.menu-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.menu-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-card li {
    padding: 0.2rem 0;
}

.login-card {
    max-width: 340px;
    margin: 3rem auto;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 1.5rem;
}

/* ---------- Report parameters ---------- */

.report-params {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.params-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.params-form .form-control,
.params-form .form-select {
    min-width: 160px;
}

.params-actions {
    display: flex;
    gap: 0.5rem;
}


/* ---------- Maintenance pages ---------- */

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-heading .page-title {
    margin-bottom: 0;
}

.table-card,
.edit-card {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 6px;
    overflow-x: auto;
}

.table-card .table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.edit-card {
    max-width: 760px;
    padding: 1.25rem 1.5rem;
}

.edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem 1.25rem;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.35rem 1.25rem;
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
}

/* ---------- Quotations ---------- */

.search-bar {
    display: flex;
    gap: 0.5rem;
    max-width: 640px;
    margin-bottom: 1rem;
}

.quote-form fieldset {
    min-width: 0;
}

.quote-form .edit-card {
    max-width: none;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.quote-header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.25rem 2rem;
}

.field-row {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}

.field-row .form-label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
}

.city-state-zip .state { max-width: 5rem; }
.city-state-zip .zip { max-width: 7rem; }

.autocomplete {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 10.25rem;
    right: 0;
    z-index: 20;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.autocomplete-item {
    display: block;
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 0;
    background: none;
    text-align: left;
}

.autocomplete-item small {
    display: block;
    color: var(--muted);
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--brand-light);
}

.quote-lines th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.quote-lines .col-qty { width: 5rem; }
.quote-lines .col-unit { width: 5rem; }
.quote-lines .col-part { width: 9rem; }
.quote-lines .col-num { width: 6rem; }
.quote-lines .col-money { width: 8.5rem; }
.quote-lines .col-sort { width: 5rem; }
.quote-lines .col-remove { width: 2.5rem; }

.quote-lines textarea {
    resize: vertical;
    overflow: hidden;
    min-height: calc(1.5em + 0.5rem + 2px);
}

.totals-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.labor-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-start;
}

.labor-line .form-label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
}

.labor-line input[type=number] { width: 7rem; }

.labor-muted {
    background-color: #9a9a9a !important;
    color: #fff;
}

.money-list {
    display: grid;
    grid-template-columns: auto 10rem;
    align-items: center;
    gap: 0.4rem 0.75rem;
    margin: 0;
    min-width: 320px;
}

.money-list dt {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    text-align: right;
}

.money-list dd {
    margin: 0;
}

.money-list .tax-rate {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.money-list .tax-rate input { width: 4.5rem; }

.money-list dt input { text-align: right; }

.money-list .total {
    padding-top: 0.4rem;
    border-top: 1px solid var(--rule);
    color: #1d2530;
}

.quote-actions {
    flex-wrap: wrap;
}

/* ---------- Buyer's orders ---------- */

.bo-buyer-line {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 2rem;
}

.bo-buyer {
    flex: 1 1 420px;
    max-width: 640px;
}

.bo-ids {
    display: grid;
    grid-template-columns: auto auto;
    gap: 0.1rem 0.75rem;
    margin: 0;
    font-size: 0.9rem;
}

.bo-ids dt {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    align-self: center;
}

.bo-ids dd {
    margin: 0;
    font-weight: 600;
}

.bo-lienholder-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.bo-lienholder-line .form-label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
}

.bo-lienholder-line .form-select {
    width: auto;
    min-width: 320px;
    max-width: 100%;
}

.bo-form .field-row {
    grid-template-columns: 5.5rem 1fr;
}

.bo-form .bo-buyer {
    grid-template-columns: 5.5rem 1fr;
}

.bo-form .bo-buyer .autocomplete-list {
    left: 6.25rem;
}

.bo-details .field-row {
    grid-template-columns: 13rem 1fr;
}

.bo-quick-add {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--brand-light);
    border-radius: 4px;
}

.bo-quick-add label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 8.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
}

.bo-quick-add label.narrow { width: 4.5rem; }
.bo-quick-add label.wide { width: 12rem; }

.bo-lines .col-newused { width: 6.5rem; }
.bo-lines .col-year { width: 5rem; }

.bo-description {
    grid-template-columns: 9.5rem 1fr;
    align-items: start;
}

.bo-totals .money-list {
    grid-template-columns: auto 11rem;
}

.bo-totals output.form-control {
    background: var(--bs-secondary-bg, #e9ecef);
}

.bo-terms {
    display: grid;
    gap: 0.35rem;
}

.bo-brakes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bo-brakes input[type=number] {
    width: 5rem;
}

.bo-dialog {
    width: min(560px, 95vw);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 1.25rem;
}

.bo-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}
