* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

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

/* Sidebar */

.sidebar {
    width: 260px;
    background: #111827;
    color: #ffffff;
    padding: 20px 16px;
    flex-shrink: 0;
    overflow: visible;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #1f7a36;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 22px;
}

.brand-name {
    font-size: 20px;
    font-weight: bold;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 12px;
    color: #cbd5e1;
    margin-top: 3px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: block;
    color: #d1d5db;
    text-decoration: none;
    padding: 11px 13px;
    border-radius: 8px;
    font-size: 15px;
}

.nav-link:hover {
background: #1f2937;
color: #ffffff;
}

.nav-link.active {
background: #1f7a36;
color: #ffffff;
font-weight: 700;
}

.nav-flyout {
position: relative;
}

.nav-flyout-trigger {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}

.nav-flyout-arrow {
font-size: 20px;
line-height: 1;
transition: transform 0.15s ease;
}

.nav-flyout-menu {
position: absolute;
top: 0;
left: calc(100% + 8px);
z-index: 1000;
display: none;
min-width: 210px;
padding: 6px;
background: #111827;
border: 1px solid #374151;
border-radius: 8px;
box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.nav-flyout:hover .nav-flyout-menu,
.nav-flyout:focus-within .nav-flyout-menu {
display: block;
}

.nav-flyout:hover .nav-flyout-arrow,
.nav-flyout:focus-within .nav-flyout-arrow {
transform: translateX(2px);
}

.nav-flyout-link {
display: block;
padding: 10px 12px;
color: #d1d5db;
text-decoration: none;
white-space: nowrap;
border-radius: 6px;
font-size: 14px;
}

.nav-flyout-link:hover {
background: #1f2937;
color: #ffffff;
}

.nav-flyout-link.active {
background: #1f7a36;
color: #ffffff;
font-weight: 700;
}

/* Main Content */

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

.page-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 22px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .page-header h1 {
        margin: 0;
        font-size: 30px;
        color: #111827;
    }

    .page-header p {
        margin: 6px 0 0 0;
        color: #6b7280;
    }

.content-area {
    padding: 28px 30px;
}

/* Cards */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card,
.section-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card {
    padding: 20px;
}

.stat-label {
    display: block;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 34px;
    color: #111827;
    margin-bottom: 8px;
}

.stat-note {
    display: block;
    color: #6b7280;
    font-size: 13px;
}

.section-card {
    padding: 22px;
}

.section-card-header h2 {
    margin: 0;
    font-size: 22px;
}

.section-card-header p {
    margin: 8px 0 0 0;
    color: #6b7280;
}

/* Buttons */

.btn {
    display: inline-block;
    text-decoration: none;
    border: none;
    border-radius: 7px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.btn-primary {
    background: #1f7a36;
    color: #ffffff;
}

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

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

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

/* Forms */

.form-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.form-row {
    display: flex;
    gap: 14px;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-grow {
    flex: 1;
}

.form-group-button {
    flex: 0 0 auto;
}

.form-group-wide {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 14px;
    font-weight: bold;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 10px 11px;
    font-size: 15px;
    font-family: inherit;
}

    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: #1f7a36;
        box-shadow: 0 0 0 3px rgba(31, 122, 54, 0.15);
    }

.form-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 26px 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 26px;
}

/* Tables */

.toolbar-form {
    margin: 20px 0;
}

.table-wrapper {
    overflow-x: auto;
}

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

    .data-table th,
    .data-table td {
        border-bottom: 1px solid #e5e7eb;
        padding: 12px 10px;
        text-align: left;
        font-size: 14px;
    }

    .data-table th {
        color: #374151;
        background: #f9fafb;
        font-weight: bold;
    }

.empty-table {
    text-align: center;
    color: #6b7280;
    padding: 24px;
}

.table-link {
    color: #1f7a36;
    font-weight: bold;
    text-decoration: none;
}

    .table-link:hover {
        text-decoration: underline;
    }

/* Customer expand/collapse rows */

.hidden-row {
    display: none;
}

.expand-button {
    width: 28px;
    height: 28px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 6px;
    margin-right: 8px;
    font-weight: bold;
    cursor: pointer;
}

    .expand-button:hover {
        background: #f3f4f6;
    }

.customer-detail-row td {
    background: #f9fafb;
    padding: 0;
}

.customer-detail-container {
    padding: 18px;
    border-left: 4px solid #1f7a36;
}

.detail-section-header h3 {
    margin: 0;
    font-size: 18px;
}

.detail-section-header p {
    margin: 5px 0 16px 0;
    color: #6b7280;
}

.address-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.address-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
}

.address-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.address-card p {
    margin: 0;
    color: #374151;
    line-height: 1.5;
}

.empty-subtext {
    color: #6b7280;
    margin: 0;
}

/* Status pills */

.status-pill {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Add customer address form */

.address-form-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 24px;
}

.address-entry-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
    background: #f9fafb;
}

.address-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

    .address-entry-header h3 {
        margin: 0;
        font-size: 18px;
    }

    .address-entry-header p {
        margin: 5px 0 0 0;
        color: #6b7280;
    }

.address-action-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
    width: 100%;
}

.address-action-left {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.address-action-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* Active/inactive customer toggle */

.active-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 18px;
}

.toggle-prefix {
    font-weight: 700;
    color: #374151;
}

.toggle-label-left,
.toggle-label-right {
    font-weight: 700;
    color: #374151;
    font-size: 14px;
    white-space: nowrap;
}

.active-switch {
    position: relative;
    display: inline-block;
    width: 55px;
    height: 20px;
}

    .active-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.active-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #9ca3af;
    border-radius: 999px;
    transition: 0.2s;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

    .active-slider::before {
        content: "";
        position: absolute;
        height: 15px;
        width: 15px;
        left: 3px;
        top: 3px;
        background-color: white;
        border-radius: 50%;
        transition: 0.2s;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    }

.active-switch input:checked + .active-slider {
    background-color: #3b95d9;
}

    .active-switch input:checked + .active-slider::before {
        transform: translateX(34px);
    }

.active-slider-text {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.active-switch input:checked + .active-slider .active-slider-text {
    left: 10px;
}

.customer-profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

.customer-action-card {
    align-self: start;
}

.customer-action-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

    .customer-action-list .btn {
        text-align: center;
    }

.customer-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.customer-edit-form {
    margin-top: 18px;
}
.quote-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

    .quote-toolbar .form-group-grow {
        min-width: 320px;
    }

    .quote-toolbar select {
        min-width: 210px;
    }

.quote-workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.workflow-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.workflow-item {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    padding: 14px;
}

    .workflow-item strong {
        display: block;
        color: #111827;
        margin-bottom: 5px;
    }

    .workflow-item span {
        display: block;
        color: #6b7280;
        line-height: 1.4;
    }

.quote-status-pill {
    background: #e0f2fe;
    color: #075985;
}

/* Create quote page */

.quote-create-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
    gap: 18px;
}

.quote-section-spacing {
    margin-top: 18px;
}

.quote-customer-summary {
    margin-top: 18px;
}

    .quote-customer-summary h3 {
        margin: 0 0 12px 0;
        font-size: 22px;
    }

    .quote-customer-summary p {
        margin: 6px 0;
        color: #374151;
    }

.quote-address-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.quote-address-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    padding: 14px;
    cursor: pointer;
}

    .quote-address-option:hover {
        border-color: #1f7a36;
        background: #ffffff;
    }

    .quote-address-option input {
        margin-top: 4px;
    }

    .quote-address-option p {
        margin: 8px 0 0 0;
        color: #374151;
        line-height: 1.5;
    }

.quote-line-items {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.quote-line-item {
    display: flex;
    gap: 14px;
    align-items: flex-end;
}

.quote-money-field {
    width: 180px;
}

.quote-temporary-note {
    margin-top: 12px;
}

.quote-task-field {
    min-width: 240px;
}

.quote-small-field {
    width: 120px;
}

.quote-money-field {
    width: 160px;
}

.quote-line-item {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.quote-item-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-start;
}

.quote-total-summary {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.quote-total-summary p,
.quote-total-summary h3 {
    margin: 0;
}

.quote-action-footer {
    margin-top: 22px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.inline-action-form {
    margin: 0;
}

/* Printable estimate page */
.estimate-print-body {
    background: #f3f4f6;
    color: #111827;
    font-family: Georgia, "Times New Roman", serif;
}

.estimate-page {
    max-width: 900px;
    min-height: 11in;
    margin: 24px auto;
    padding: 26px;
    background: #ffffff;
    border: 1px solid #d1d5db;
}

.estimate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    padding: 24px 28px 0;
    background: #f5f8f3;
    border-top: 6px solid #174d2c;
}

.estimate-logo-box {
    width: 260px;
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f8f3;
}

.estimate-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.estimate-company-info {
    position: relative;
    top: -25px;
    text-align: right;
    font-size: 15px;
    line-height: 1.15;
    top: -15px;
}

.estimate-title-row {
    margin: 0px 0 46px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.estimate-line {
    flex: 1;
    border-top: 5px double #444;
}

.estimate-title {
    padding: 10px 28px;
    border: 4px double #555;
    font-size: 30px;
    color: #444;
    line-height: 1;
}

.estimate-info-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 40px;
    margin-bottom: 28px;
}

.estimate-bill-to h3 {
    margin: 0 0 4px 0;
    color: #9ca3af;
    font-size: 15px;
    letter-spacing: 0.04em;
}

.estimate-bill-to p {
    margin: 0;
    font-size: 15px;
    line-height: 1.2;
}

.estimate-summary-box {
    font-size: 15px;
}

    .estimate-summary-box div {
        display: grid;
        grid-template-columns: 170px 1fr;
        gap: 12px;
        margin-bottom: 3px;
    }

    .estimate-summary-box strong {
        text-align: right;
    }

.estimate-grand-total {
    background: #f1f1f1;
    padding: 3px 0;
}

.estimate-items-section {
    margin-top: 34px;
}

.estimate-items-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 15px;
}

.estimate-col-description {
    width: 68%;
}

.estimate-col-qty {
    width: 10%;
}

.estimate-col-price {
    width: 11%;
}

.estimate-col-amount {
    width: 11%;
}

.estimate-items-table th {
    text-align: left;
    padding: 8px 8px;
    border-bottom: 1px dotted #111827;
    white-space: nowrap;
}

.estimate-items-table td {
    vertical-align: top;
    padding: 10px 8px 14px 8px;
    border-bottom: 1px dotted #111827;
}

.estimate-description-cell {
    overflow-wrap: anywhere;
}

.estimate-number-cell,
.estimate-money-cell {
    white-space: nowrap;
}

.estimate-money-cell {
    font-variant-numeric: tabular-nums;
}

.estimate-items-table th {
    text-align: left;
    padding: 8px 0;
    border-bottom: 1px dotted #111827;
}

.estimate-items-table td {
    vertical-align: top;
    padding: 10px 0 14px 0;
    border-bottom: 1px dotted #111827;
}

.estimate-item-notes {
    margin-top: 3px;
    color: #6b7280;
    white-space: pre-line;
}

.text-center {
    text-align: center !important;
}

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

.estimate-total-row {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    margin-top: 16px;
}

.estimate-total-box {
    border-bottom: 3px solid #ddd;
    padding-bottom: 10px;
}

    .estimate-total-box div {
        display: flex;
        justify-content: space-between;
        gap: 20px;
    }

.estimate-notes-section {
    margin-top: 56px;
}

    .estimate-notes-section h3 {
        margin-bottom: 4px;
        color: #4b5563;
    }

    .estimate-notes-section p {
        margin-top: 0;
        color: #4b5563;
    }

.estimate-print-actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@media print {
    body.estimate-print-body {
        background: #ffffff;
    }

    .estimate-page {
        max-width: none;
        min-height: auto;
        margin: 0;
        padding: 0.25in;
        border: none;
    }

    .no-print {
        display: none !important;
    }
}

.address-autocomplete-results {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.address-autocomplete-option {
    text-align: left;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
}

    .address-autocomplete-option:hover {
        background: #f3f4f6;
    }

.address-autocomplete-empty {
    margin-top: 8px;
    color: #6b7280;
    font-size: 0.9rem;
}

.address-gps-info {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #4b5563;
    font-size: 0.9rem;
}

    .address-gps-info p {
        margin: 3px 0;
    }

.address-card-actions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-action-form {
    margin: 0;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.payment-history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.payment-history-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
}

.payment-history-summary {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    padding: 1rem;
    list-style: none;
}

    .payment-history-summary::-webkit-details-marker {
        display: none;
    }

.payment-history-card[open] .payment-history-summary {
    border-bottom: 1px solid #e5e7eb;
}

.payment-history-main,
.payment-history-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.payment-history-meta {
    align-items: flex-end;
    text-align: right;
}

.payment-history-body {
    padding: 1rem;
}

.payment-history-totals {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

    .payment-history-totals > div {
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 0.75rem;
        background: #f9fafb;
    }

.compact-data-table {
    margin-bottom: 1rem;
}

.payment-history-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .payment-history-summary {
        flex-direction: column;
    }

    .payment-history-meta {
        align-items: flex-start;
        text-align: left;
    }

    .payment-history-totals {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 600px) {
    .payment-history-totals {
        grid-template-columns: 1fr;
    }
}

.work-order-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 1rem;
}

.action-panel {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1rem;
    background: #ffffff;
}

    .action-panel h3 {
        margin-top: 0;
    }

.event-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.event-card {
    border: 1px solid #e5e7eb;
    border-left: 4px solid #94a3b8;
    border-radius: 12px;
    padding: 1rem;
    background: #ffffff;
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.btn-danger {
    background: #b91c1c;
    color: #ffffff;
}

    .btn-danger:hover {
        background: #991b1b;
    }

@media (max-width: 900px) {
    .work-order-action-grid {
        grid-template-columns: 1fr;
    }

    .event-card-header {
        flex-direction: column;
    }
}

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

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

    .auth-brand h1 {
        margin: 0;
        font-size: 1.4rem;
    }

    .auth-brand p {
        margin: 0;
        color: #6b7280;
    }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.notice-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.warning-card {
    border-color: #facc15;
    background: #fefce8;
}

.temp-password-box {
    background: #ffffff;
    border: 1px dashed #ca8a04;
    border-radius: 10px;
    padding: 0.75rem;
    margin: 0.75rem 0;
}

    .temp-password-box code {
        font-size: 1.05rem;
        font-weight: 700;
    }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.page-content {
    padding: 1.5rem 2rem 3rem;
}

.content-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.employee-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

    .employee-form-grid .full-width {
        grid-column: 1 / -1;
    }

    .employee-form-grid input,
    .employee-form-grid select,
    .employee-form-grid textarea {
        width: 100%;
    }

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.5rem;
}

.notice-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.warning-card {
    border-color: #facc15;
    background: #fefce8;
}

.temp-password-box {
    background: #ffffff;
    border: 1px dashed #ca8a04;
    border-radius: 10px;
    padding: 0.75rem;
    margin: 0.75rem 0;
}

    .temp-password-box code {
        font-size: 1.05rem;
        font-weight: 700;
    }

.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: #ffffff;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

    .sidebar-user span {
        color: #cbd5e1;
        font-size: 0.75rem;
    }

.sidebar-logout-button {
    width: 100%;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    background: #ef4444;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

    .sidebar-logout-button:hover {
        background: #dc2626;
    }

.employee-detail-card,
.employee-actions-card {
    margin-bottom: 1rem;
}

.employee-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

    .employee-detail-header h2 {
        margin: 0;
    }

    .employee-detail-header p {
        margin: 0.25rem 0 0;
        color: #6b7280;
    }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.detail-item {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.85rem;
    background: #f9fafb;
}

    .detail-item span {
        display: block;
        font-size: 0.78rem;
        color: #6b7280;
        margin-bottom: 0.25rem;
    }

    .detail-item strong {
        display: block;
        color: #111827;
    }

.employee-notes {
    margin-top: 1rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.employee-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 0;
}

    .employee-action-row:first-of-type {
        border-top: none;
    }

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.table-link {
    color: #2563eb;
    text-decoration: none;
}

    .table-link:hover {
        text-decoration: underline;
    }

.btn-warning {
    background: #f59e0b;
    color: #111827;
}

.btn-warning:hover {
    background: #d97706;
    color: #111827;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

    .checkbox-group label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-weight: 600;
    }

    .checkbox-group input[type="checkbox"] {
        width: auto;
    }

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

.daily-plan-date-form {
    display: flex;
    align-items: end;
    gap: 0.75rem;
}

    .daily-plan-date-form label {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        font-weight: 700;
    }

.daily-plan-summary {
    text-align: right;
}

    .daily-plan-summary strong {
        display: block;
        font-size: 1.5rem;
    }

    .daily-plan-summary span {
        color: #6b7280;
        font-size: 0.85rem;
    }

.daily-plan-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 1rem;
    align-items: start;
}

.daily-plan-column {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1rem;
    min-height: 220px;
}

.unassigned-column {
    border-color: #f59e0b;
    background: #fffbeb;
}

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

    .daily-plan-column-header h3 {
        margin: 0;
    }

    .daily-plan-column-header span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 1.75rem;
        height: 1.75rem;
        border-radius: 999px;
        background: #e5e7eb;
        font-weight: 700;
    }

.daily-job-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.daily-job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

    .daily-job-card-header p {
        margin: 0.25rem 0 0;
        color: #374151;
        font-size: 0.85rem;
    }

.daily-job-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

    .daily-job-meta strong {
        color: #111827;
    }

.daily-job-notes {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 0.85rem;
    color: #374151;
}

.daily-job-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.daily-job-actions > a {
    align-self: flex-start;
}

.assign-crew-form {
    display: flex;
    gap: 0.5rem;
}

    .assign-crew-form select {
        flex: 1;
    }

.status-scheduled {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-in-progress {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-skipped {
    background: #fee2e2;
    color: #991b1b;
}

.stop-order-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stop-order-actions form {
    margin: 0;
}

.daily-job-actions > a {
    align-self: flex-start;
}

.crew-mobile-card {
    max-width: 900px;
}

.crew-stop-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.crew-stop-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.crew-stop-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

    .crew-stop-header p {
        margin: 0.25rem 0 0;
        color: #6b7280;
    }

.crew-stop-address {
    margin-top: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.crew-stop-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    color: #4b5563;
}

.crew-stop-phone,
.crew-stop-notes {
    margin: 0.75rem 0 0;
    color: #4b5563;
}

.crew-stop-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

@media (max-width: 700px) {
    .crew-stop-header {
        flex-direction: column;
    }

    .crew-stop-meta {
        flex-direction: column;
        gap: 0.35rem;
    }

    .crew-stop-actions .btn {
        width: 100%;
    }
}

.crew-stop-actions form {
    margin: 0;
}

.crew-stop-timestamp {
    display: inline-flex;
    align-items: center;
    color: #4b5563;
    font-size: 0.9rem;
    font-weight: 600;
}

/* =========================
   Reports
========================= */

.report-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.report-filter {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
}

.report-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.report-kpi {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.report-kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    font-weight: 700;
}

.report-kpi-value {
    margin-top: 0.35rem;
    font-size: 1.6rem;
    font-weight: 800;
    color: #111827;
}

.report-kpi-hint {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: #4b5563;
}

.report-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

    .report-section h2 {
        margin: 0 0 0.35rem;
        font-size: 1.05rem;
        color: #111827;
    }

.report-section-subtitle {
    margin: 0 0 1rem;
    color: #6b7280;
    font-size: 0.9rem;
}

@media (max-width: 1100px) {
    .report-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .report-kpis {
        grid-template-columns: 1fr;
    }
}

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

    .report-table th,
    .report-table td {
        padding: 0.85rem;
        border-bottom: 1px solid #e5e7eb;
        text-align: left;
        vertical-align: top;
    }

    .report-table th {
        background: #f9fafb;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #6b7280;
    }

    .report-table tr:hover td {
        background: #f9fafb;
    }

.empty-state {
    color: #6b7280;
    text-align: center;
    padding: 1.25rem;
}

.report-subheading {
    margin: 1.25rem 0 0.6rem;
    font-size: 1rem;
    color: #111827;
}

.empty-subtext {
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.crew-photo-summary {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    color: #4b5563;
    font-size: 0.85rem;
    font-weight: 600;
}

    .crew-photo-summary span {
        background: #f9fafb;
        border: 1px solid #e5e7eb;
        border-radius: 999px;
        padding: 0.25rem 0.6rem;
    }

.crew-photo-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

    .crew-photo-actions form {
        margin: 0;
    }

@media (max-width: 700px) {
    .crew-photo-actions .btn {
        width: 100%;
    }

    .crew-photo-actions form {
        width: 100%;
    }
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.photo-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.photo-card img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.photo-meta {
    padding: 0.75rem;
    font-size: 0.85rem;
    color: #4b5563;
    line-height: 1.5;
}

.photo-replace-form {
    padding: 0 0.75rem 0.75rem;
}

.photo-replace-form .btn {
    width: 100%;
}

.page-action-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0 1.25rem;
    padding: 1rem 2rem 0;
}

    .page-action-row .btn {
        margin: 0;
    }
/* Generic hidden safety */
[hidden] {
    display: none !important;
}

/* Modal overlay */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Modal box */
.modal-card {
    width: min(720px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
    padding: 1.25rem;
}

/* Modal header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

    .modal-header h2 {
        margin: 0;
    }

    .modal-header p {
        margin: 0.25rem 0 0 0;
        color: #6b7280;
    }

/* X close button */
.modal-close {
    border: none;
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
}

    .modal-close:hover {
        color: #111827;
    }

/* Modal form */
.modal-card .form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.modal-card .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modal-card .form-group-full {
    grid-column: 1 / -1;
}

.modal-card .form-control {
    padding: 0.55rem 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    width: 100%;
}

/* Modal buttons */
.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.modal-actions-right {
    display: flex;
    gap: 0.75rem;
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
}

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

@media (max-width: 800px) {
    .modal-card .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .modal-actions-right {
        justify-content: flex-end;
    }
}

.modal-card-wide {
    width: min(980px, 100%);
}

.modal-card .work-order-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 900px) {
    .modal-card .work-order-action-grid {
        grid-template-columns: 1fr;
    }
}

/* Expenses */

.expense-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}

.expense-detail-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
}

    .expense-detail-card .data-table {
        margin-top: 12px;
    }

        .expense-detail-card .data-table th,
        .expense-detail-card .data-table td {
            font-size: 13px;
            padding: 10px 8px;
        }

@media (max-width: 900px) {
    .expense-detail-card {
        overflow-x: auto;
    }
}
.active-slider-text::after {
    content: "OFF";
}

.active-switch input:checked + .active-slider
.active-slider-text::after {
    content: "ON";
}
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
}

.pagination-button {
    min-width: 36px;
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #ffffff;
    color: #344054;
    font-weight: 600;
    cursor: pointer;
}

    .pagination-button:hover:not(:disabled) {
        background: #f2f4f7;
    }

.pagination-current {
    background: #166534;
    border-color: #166534;
    color: #ffffff;
}

.pagination-button:disabled {
    background: #f2f4f7;
    color: #98a2b3;
    cursor: not-allowed;
}

/* =========================================================
   SITE MANAGEMENT
   ========================================================= */
.site-management-page {
    display: grid;
    gap: 1.25rem;
}

    .site-management-page input,
    .site-management-page textarea,
    .site-management-page select {
        width: 100%;
        min-height: 44px;
        padding: 0.7rem 0.8rem;
        border: 1px solid #c8d3cc;
        border-radius: 9px;
        background: #ffffff;
        color: #17211b;
        font: inherit;
    }

    .site-management-page textarea {
        min-height: 110px;
        resize: vertical;
    }

        .site-management-page input:focus,
        .site-management-page textarea:focus,
        .site-management-page select:focus {
            border-color: #216c49;
            outline: 3px solid rgba(33, 108, 73, 0.13);
        }

    .site-management-page .form-group {
        display: grid;
        gap: 0.4rem;
    }

        .site-management-page .form-group label {
            color: #31443a;
            font-size: 0.9rem;
            font-weight: 750;
        }

.site-notice {
    padding: 0.9rem 1rem;
    border: 1px solid;
    border-radius: 10px;
    font-weight: 700;
}

.site-notice-success {
    border-color: #9cc9af;
    background: #edf8f1;
    color: #185338;
}

.site-notice-error {
    border-color: #e2aaaa;
    background: #fff1f1;
    color: #8a2424;
}

.site-slot-grid,
.site-management-grid,
.site-featured-grid,
.site-library-grid {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.site-slot-grid,
.site-management-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-featured-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-library-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.site-editor-card,
.site-featured-card,
.site-library-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dce5df;
    border-radius: 14px;
    background: #ffffff;
}

.site-editor-card,
.site-featured-card {
    padding: 1rem;
}

.site-editor-heading,
.site-form-button-row,
.site-library-meta,
.site-filter-actions,
.site-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.site-editor-heading {
    margin-bottom: 0.85rem;
}

    .site-editor-heading h3 {
        margin: 0.15rem 0 0;
    }

.site-kicker {
    color: #216c49;
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.site-image-preview {
    position: relative;
    overflow: hidden;
    min-height: 260px;
    border-radius: 11px;
    background: #f3f6f4;
}

.site-image-preview-compact {
    min-height: 230px;
}

.site-image-preview img,
.site-library-card > img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.site-image-empty {
    display: grid;
    min-height: inherit;
    place-items: center;
    padding: 1rem;
    border: 1px dashed #b7c5bc;
    color: #5e6b63;
    text-align: center;
}

.site-editor-form,
.site-settings-form {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

.site-editor-form-selecting {
    outline: 3px solid rgba(33, 108, 73, 0.18);
    outline-offset: 5px;
}

.site-editor-form-selected {
    animation: siteFormSelected 2.2s ease;
}

@keyframes siteFormSelected {
    0%, 100% {
        outline-color: transparent;
    }

    20%, 70% {
        outline: 4px solid rgba(33, 108, 73, 0.25);
        outline-offset: 5px;
    }
}

.site-selected-source {
    margin: 0;
    color: #5e6b63;
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.site-form-two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 1rem;
}

.site-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #31443a;
    font-weight: 700;
}

    .site-checkbox-row input {
        width: 18px;
        min-height: 18px;
        margin: 0;
    }

.site-checkbox-row-bottom {
    min-height: 44px;
}

.site-new-featured-layout {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
    gap: 1rem;
    padding: 1rem;
}

.site-count-badge,
.site-photo-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

.site-count-badge {
    background: #e8f2ec;
    color: #185338;
}

.site-photo-type {
    text-transform: capitalize;
}

.site-photo-type-before {
    background: #f4ede3;
    color: #6c4e2f;
}

.site-photo-type-after {
    background: #e8f2ec;
    color: #185338;
}

.site-delete-form {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e2e9e4;
}

.btn-danger {
    border-color: #a43434;
    background: #ffffff;
    color: #8a2424;
}

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

.site-picker-status {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #85b89b;
    border-radius: 10px;
    background: #edf8f1;
    color: #185338;
    box-shadow: 0 10px 25px rgba(18, 63, 42, 0.12);
}

.site-library-filter {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 1rem;
    padding: 1rem;
    border-top: 1px solid #e2e9e4;
    border-bottom: 1px solid #e2e9e4;
    background: #fafcfb;
}

.site-library-card img {
    min-height: 180px;
    background: #f3f6f4;
}

.site-library-card-body {
    display: grid;
    gap: 0.65rem;
    padding: 0.8rem;
}

    .site-library-card-body p,
    .site-library-card-body small {
        margin: 0;
        overflow: hidden;
        color: #5e6b63;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .site-library-card-body small {
        font-size: 0.75rem;
    }

.site-library-card .btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.site-pagination {
    justify-content: center;
    padding: 1rem;
    border-top: 1px solid #e2e9e4;
}

.site-empty-state {
    margin: 1rem;
    padding: 2rem 1rem;
    border: 1px dashed #b7c5bc;
    border-radius: 10px;
    color: #5e6b63;
    text-align: center;
}

@media (max-width: 1200px) {
    .site-library-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .site-slot-grid,
    .site-management-grid,
    .site-featured-grid,
    .site-new-featured-layout {
        grid-template-columns: 1fr;
    }

    .site-library-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .site-library-filter {
        grid-template-columns: 1fr 1fr;
    }

    .site-filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .site-library-grid,
    .site-library-filter,
    .site-form-two-column {
        grid-template-columns: 1fr;
    }

    .site-editor-heading,
    .site-form-button-row,
    .site-library-meta,
    .site-picker-status,
    .site-pagination {
        align-items: stretch;
        flex-direction: column;
    }

        .site-editor-heading .btn,
        .site-form-button-row .btn,
        .site-filter-actions,
        .site-filter-actions .btn,
        .site-picker-status .btn {
            width: 100%;
        }
}



/* =========================================================
   MOBILE DASHBOARD
   ========================================================= */

@media (max-width: 768px) {
    .dashboard-page {
        overflow-x: hidden;
    }

        .dashboard-page .app-shell {
            width: 100%;
            min-width: 0;
        }

        .dashboard-page .main-content {
            width: 100%;
            min-width: 0;
        }

        .dashboard-page .content-area {
            width: 100%;
            min-width: 0;
            padding: 1rem;
            box-sizing: border-box;
        }

        /* Page heading */

        .dashboard-page .page-header {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 0.75rem;
            padding: 1rem;
        }

            .dashboard-page .page-header h1 {
                margin: 0;
                font-size: 1.5rem;
                line-height: 1.2;
            }

            .dashboard-page .page-header p {
                margin: 0.35rem 0 0;
                font-size: 0.9rem;
                line-height: 1.4;
            }

            .dashboard-page .page-header .btn {
                width: 100%;
                min-height: 44px;
            }

        /* Dashboard statistics */

        .dashboard-page .stat-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 0.75rem;
            width: 100%;
        }

        .dashboard-page .stat-card {
            min-width: 0;
            padding: 1rem;
            box-sizing: border-box;
        }

        .dashboard-page .stat-label,
        .dashboard-page .stat-note {
            display: block;
            overflow-wrap: anywhere;
        }

        .dashboard-page .stat-value {
            display: block;
            margin: 0.3rem 0;
            font-size: 1.75rem;
            line-height: 1.1;
        }

        .dashboard-page .stat-note {
            font-size: 0.8rem;
            line-height: 1.35;
        }

        /* Stack dashboard sections */

        .dashboard-page .quote-create-grid {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            gap: 1rem;
            width: 100%;
            min-width: 0;
        }

        .dashboard-page .quote-section-spacing {
            margin-top: 1rem;
        }

        .dashboard-page .section-card {
            width: 100%;
            min-width: 0;
            overflow: hidden;
            box-sizing: border-box;
        }

        .dashboard-page .section-card-header {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 0.75rem;
            padding: 1rem;
        }

            .dashboard-page .section-card-header h2 {
                margin: 0;
                font-size: 1.15rem;
                line-height: 1.25;
            }

            .dashboard-page .section-card-header p {
                margin: 0.25rem 0 0;
                font-size: 0.85rem;
                line-height: 1.4;
            }

            .dashboard-page .section-card-header .btn {
                display: flex;
                align-items: center;
                justify-content: center;
                width: 100%;
                min-height: 44px;
                box-sizing: border-box;
            }

        /* Convert desktop tables into mobile cards */

        .dashboard-page .data-table {
            display: block;
            width: 100%;
            border: 0;
        }

            .dashboard-page .data-table thead {
                display: none;
            }

            .dashboard-page .data-table tbody {
                display: block;
                width: 100%;
            }

                .dashboard-page .data-table tbody tr {
                    display: block;
                    width: 100%;
                    padding: 0.85rem 1rem;
                    border-top: 1px solid rgba(127, 127, 127, 0.22);
                    box-sizing: border-box;
                }

                    .dashboard-page .data-table tbody tr:first-child {
                        border-top: 0;
                    }

            .dashboard-page .data-table td {
                display: grid;
                grid-template-columns: 105px minmax(0, 1fr);
                gap: 0.75rem;
                width: 100%;
                padding: 0.35rem 0;
                border: 0;
                text-align: left;
                box-sizing: border-box;
                overflow-wrap: anywhere;
            }

                .dashboard-page .data-table td::before {
                    align-self: start;
                    font-size: 0.78rem;
                    font-weight: 700;
                    line-height: 1.4;
                    text-transform: uppercase;
                    letter-spacing: 0.025em;
                    opacity: 0.7;
                }

            .dashboard-page .data-table .table-link {
                display: inline-block;
                max-width: 100%;
                overflow-wrap: anywhere;
            }

            .dashboard-page .data-table .empty-subtext {
                display: inline-block;
                margin-top: 0.15rem;
                font-size: 0.8rem;
                line-height: 1.35;
            }

            .dashboard-page .data-table .status-pill {
                justify-self: start;
                max-width: 100%;
                white-space: normal;
                text-align: center;
            }

            /* Empty table messages */

            .dashboard-page .data-table td.empty-table-cell {
                display: block;
                width: 100%;
                padding: 1rem 0;
                text-align: center;
            }

                .dashboard-page .data-table td.empty-table-cell::before {
                    content: none;
                }

        /* Today's Work Orders labels */

        .dashboard-page
        .quote-create-grid:not(.quote-section-spacing) > .section-card:nth-child(1)
        .data-table td:nth-child(1)::before {
            content: "WO #";
        }

        .dashboard-page
        .quote-create-grid:not(.quote-section-spacing) > .section-card:nth-child(1)
        .data-table td:nth-child(2)::before {
            content: "Customer";
        }

        .dashboard-page
        .quote-create-grid:not(.quote-section-spacing) > .section-card:nth-child(1)
        .data-table td:nth-child(3)::before {
            content: "Time";
        }

        .dashboard-page
        .quote-create-grid:not(.quote-section-spacing) > .section-card:nth-child(1)
        .data-table td:nth-child(4)::before {
            content: "Status";
        }

        /* Upcoming Scheduled Work labels */

        .dashboard-page
        .quote-create-grid:not(.quote-section-spacing) > .section-card:nth-child(2)
        .data-table td:nth-child(1)::before {
            content: "Date";
        }

        .dashboard-page
        .quote-create-grid:not(.quote-section-spacing) > .section-card:nth-child(2)
        .data-table td:nth-child(2)::before {
            content: "Customer";
        }

        .dashboard-page
        .quote-create-grid:not(.quote-section-spacing) > .section-card:nth-child(2)
        .data-table td:nth-child(3)::before {
            content: "Work";
        }

        .dashboard-page
        .quote-create-grid:not(.quote-section-spacing) > .section-card:nth-child(2)
        .data-table td:nth-child(4)::before {
            content: "View";
        }

        /* Recent Quotes labels */

        .dashboard-page
        .section-card:has(a[href="/quotes"])
        .data-table td:nth-child(1)::before {
            content: "Quote";
        }

        .dashboard-page
        .section-card:has(a[href="/quotes"])
        .data-table td:nth-child(2)::before {
            content: "Customer";
        }

        .dashboard-page
        .section-card:has(a[href="/quotes"])
        .data-table td:nth-child(3)::before {
            content: "Status";
        }

        .dashboard-page
        .section-card:has(a[href="/quotes"])
        .data-table td:nth-child(4)::before {
            content: "Total";
        }

        /* Open Invoices labels */

        .dashboard-page
        .section-card:has(a[href="/invoices"])
        .data-table td:nth-child(1)::before {
            content: "Invoice";
        }

        .dashboard-page
        .section-card:has(a[href="/invoices"])
        .data-table td:nth-child(2)::before {
            content: "Invoice Date";
        }

        .dashboard-page
        .section-card:has(a[href="/invoices"])
        .data-table td:nth-child(3)::before {
            content: "Due Date";
        }

        .dashboard-page
        .section-card:has(a[href="/invoices"])
        .data-table td:nth-child(4)::before {
            content: "Total";
        }
}


/* Smaller phones */

@media (max-width: 480px) {
    .dashboard-page .content-area {
        padding: 0.75rem;
    }

    .dashboard-page .stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-page .stat-card {
        padding: 0.9rem;
    }

    .dashboard-page .section-card-header {
        padding: 0.9rem;
    }

    .dashboard-page .data-table tbody tr {
        padding: 0.8rem 0.9rem;
    }

    .dashboard-page .data-table td {
        grid-template-columns: 90px minmax(0, 1fr);
        gap: 0.6rem;
    }
}

/* Financial Reports Tab*/
.report-tabs {
    display: flex;
    align-items: flex-end;
    gap: 0;
    margin: 0;
    padding: 0 1rem;
    background: #ffffff;
    border-bottom: 1px solid #d9dee7;
}

.report-tab {
    appearance: none;
    position: relative;
    margin: 0;
    padding: 0.9rem 1.25rem 0.8rem;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #5f6b7a;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

    .report-tab:hover {
        color: #111827;
        background: #f7f8fa;
    }

    .report-tab.active {
        color: #111827;
        border-bottom-color: #2563eb;
        background: #ffffff;
    }

    .report-tab:focus-visible {
        outline: 2px solid #2563eb;
        outline-offset: -2px;
    }

.report-tab-content {
    padding-top: 1.25rem;
}

.report-tab-panel[hidden] {
    display: none;
}

@media (max-width: 700px) {
    .report-tabs {
        overflow-x: auto;
        padding: 0 0.5rem;
    }

    .report-tab {
        flex: 0 0 auto;
        padding: 0.8rem 0.9rem 0.7rem;
        white-space: nowrap;
    }
}
.financial-hierarchy-toggle {
    width: 1.75rem;
    padding: 0;
    margin: 0 0.35rem 0 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    text-align: center;
}

.financial-hierarchy-spacer {
    display: inline-block;
    width: 1.75rem;
    margin-right: 0.35rem;
}

.financial-month-row {
    background: #eef2f7;
}

.financial-week-row {
    background: #f7f8fa;
}

.financial-day-row {
    background: #ffffff;
}

.financial-work-order-row {
    background: #fbfcfd;
}

.financial-period-week {
    padding-left: 1.5rem !important;
}

.financial-period-day {
    padding-left: 3rem !important;
}

.financial-period-work-order {
    padding-left: 4.5rem !important;
}

.financial-month-row td {
    border-top: 2px solid #d7dde5;
}

.financial-week-row td {
    border-top: 1px solid #e1e5ea;
}

.financial-work-order-row td {
    font-size: 0.95rem;
}
/* Contract Print Settings*/
.contract-print-page {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid #d8dee6;
}

.contract-print-header {
    margin-bottom: 28px;
    text-align: center;
}

.contract-print-label {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.contract-print-title {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1.2;
}

.contract-print-reference {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    font-size: 0.9rem;
}

@media print {
    .contract-print-page {
        break-before: page;
        page-break-before: always;
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }
}
.contract-acceptance-section {
    margin-top: 34px;
}

.contract-acceptance-statement {
    padding: 14px 16px;
    border: 1px solid #cfd5dd;
    background: #f7f8fa;
}

    .contract-acceptance-statement p:first-child {
        margin-top: 0;
    }

    .contract-acceptance-statement p:last-child {
        margin-bottom: 0;
    }

.contract-signature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-top: 26px;
}

.contract-signature-card {
    padding: 16px;
    border: 1px solid #cfd5dd;
    border-radius: 4px;
}

    .contract-signature-card h3 {
        margin: 0 0 18px;
        padding-bottom: 8px;
        border-bottom: 1px solid #d8dee6;
        font-size: 1rem;
    }

.contract-prefilled-name {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 32px;
}

    .contract-prefilled-name span {
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
    }

.contract-signature-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 105px;
    gap: 18px;
    align-items: end;
}

.contract-signature-entry,
.contract-date-entry {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.contract-signature-blank {
    min-height: 30px;
    border-bottom: 1px solid #111;
}

.contract-signature-entry span,
.contract-date-entry span {
    font-size: 0.78rem;
}

.contract-electronic-acceptance {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 22px;
    padding: 12px 14px;
    border: 1px solid #cfd5dd;
    line-height: 1.4;
}

.contract-checkbox-box {
    display: inline-block;
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border: 1.5px solid #111;
    background: #fff;
}

@media print {
    .contract-acceptance-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .contract-acceptance-statement {
        background: transparent;
    }

    .contract-signature-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
