* {
    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;
}

.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;
    }

/* 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: flex-start;
    gap: 30px;
}

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

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

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

.estimate-title-row {
    margin: 20px 0 46px 0;
    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;
    }
}