.maintenance-page {
    padding: 2rem;
    max-width: 1480px;
    margin: 0 auto;
    display: grid;
    gap: 1.25rem;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.75rem;
    border-radius: 20px;
    background: linear-gradient(135deg, #312e81, #4f46e5, #7c3aed);
    color: white;
    box-shadow: 0 18px 45px rgba(49, 46, 129, 0.25);
}

.eyebrow {
    margin: 0 0 .35rem 0;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    opacity: .9;
}

.hero h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
}

.subtext {
    margin: .5rem 0 0 0;
    max-width: 760px;
    opacity: .95;
}

.hero-actions {
    display: flex;
    gap: .75rem;
}

.refresh-btn,
.complete-btn,
.secondary-btn,
.link-btn {
    border: none;
    border-radius: 12px;
    padding: .8rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: .15s ease;
}

.refresh-btn {
    background: rgba(255,255,255,.15);
    color: white;
    backdrop-filter: blur(8px);
}

.complete-btn {
    background: #4f46e5;
    color: white;
}

.secondary-btn {
    background: #eef2ff;
    color: #4338ca;
}

.secondary-btn-alt {
    background: #ede9fe;
    color: #6d28d9;
}

.secondary-btn-warn {
    background: #fff7ed;
    color: #92400e;
    border: 1px solid #fdba74;
}

.link-btn {
    border: 1px solid #dbe4f0;
    background: white;
    color: #334155;
}

.amazon-btn {
    background: #f3a847;
    color: #0f1111;
    border: none;
}

    .amazon-btn:hover {
        background: #e47911;
        color: #0f1111;
        transform: translateY(-1px);
    }

    .refresh-btn:hover,
    .complete-btn:hover,
    .secondary-btn:hover,
    .link-btn:hover {
        transform: translateY(-1px);
    }

    .refresh-btn:disabled,
    .complete-btn:disabled,
    .secondary-btn:disabled,
    .link-btn:disabled {
        opacity: .6;
        cursor: not-allowed;
        transform: none;
    }

.message-box {
    margin-bottom: 1rem;
    padding: .9rem 1rem;
    border-radius: 14px;
    background: #eef2ff;
    color: #312e81;
    border: 1px solid #c7d2fe;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card,
.panel {
    background: white;
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
    border: 1px solid #eef2f7;
}

.stat-label {
    display: block;
    color: #64748b;
    font-size: .9rem;
    margin-bottom: .35rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
}

.grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
    align-items: start;
}

.filter-panel {
    position: sticky;
    top: 1rem;
}

.panel h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #0f172a;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-subtext {
    margin: .35rem 0 0 0;
    color: #64748b;
}

.results-count {
    color: #64748b;
    font-size: .9rem;
    white-space: nowrap;
}

.form-row {
    margin-bottom: 1rem;
}

    .form-row label {
        display: block;
        margin-bottom: .4rem;
        font-weight: 700;
        color: #334155;
    }

    .form-row input,
    .form-row select,
    .form-row textarea {
        width: 100%;
        box-sizing: border-box;
        padding: .85rem .95rem;
        border-radius: 12px;
        border: 1px solid #dbe4f0;
        background: #f8fafc;
        font: inherit;
    }

.group-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.group-card {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    overflow: hidden;
    background: #fcfdff;
}

.group-header {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    cursor: pointer;
    text-align: left;
    touch-action: pan-y;
}

.group-header-left {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
}

    .group-header-left h3 {
        margin: 0;
        color: #0f172a;
        font-size: 1.05rem;
    }

    .group-header-left p {
        margin: .25rem 0 0 0;
        color: #64748b;
        font-size: .92rem;
    }

.group-header-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.group-chevron,
.row-chevron {
    width: 1.5rem;
    flex: 0 0 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #4f46e5;
}

.mini-pill,
.status-badge,
.priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: .35rem .7rem;
    font-size: .75rem;
    font-weight: 800;
    white-space: nowrap;
}

    .mini-pill.overdue,
    .status-badge.overdue {
        background: #fee2e2;
        color: #b91c1c;
    }

    .mini-pill.duesoon,
    .status-badge.duesoon {
        background: #fef3c7;
        color: #92400e;
    }

    .mini-pill.upcoming,
    .status-badge.upcoming {
        background: #dbeafe;
        color: #1d4ed8;
    }

    .mini-pill.neutral,
    .status-badge.snoozed {
        background: #eef2ff;
        color: #4338ca;
    }

    .status-badge.skipped {
        background: #e5e7eb;
        color: #374151;
    }

    .priority-badge.high {
        background: #ede9fe;
        color: #6d28d9;
    }

    .priority-badge.medium {
        background: #e0f2fe;
        color: #0369a1;
    }

    .priority-badge.low {
        background: #ecfccb;
        color: #4d7c0f;
    }

.group-body {
    padding: 0 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.maintenance-row {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: white;
    overflow: hidden;
}

    .maintenance-row.overdue {
        border-color: #fecaca;
        background: #fff7f7;
    }

    .maintenance-row.duesoon {
        border-color: #fde68a;
        background: #fffbeb;
    }

    .maintenance-row.upcoming {
        border-color: #dbeafe;
        background: #f8faff;
    }

    .maintenance-row.snoozed {
        border-color: #c7d2fe;
        background: #f8faff;
    }

    .maintenance-row.skipped {
        border-color: #e5e7eb;
        background: #fafafa;
        opacity: .95;
    }

.maintenance-row-main {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    text-align: left;
    touch-action: pan-y;
}

.row-title-block {
    min-width: 0;
}

.row-title-line {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .2rem;
}

.row-title {
    color: #0f172a;
    font-weight: 800;
}

.row-subtitle {
    color: #64748b;
    font-size: .92rem;
    padding-left: 1.85rem;
}

.row-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.row-summary-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .15rem;
}

.summary-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
}

.summary-value {
    font-weight: 700;
    color: #0f172a;
}

.badge-group {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.maintenance-row-details {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid rgba(226, 232, 240, .9);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-top: .9rem;
    margin-bottom: .85rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.meta-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
}

.meta-value {
    color: #0f172a;
    font-weight: 600;
}

.status-detail {
    margin-bottom: .9rem;
    padding: .75rem .9rem;
    border-radius: 12px;
    font-weight: 600;
}

.status-detail-neutral {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.status-detail-warn {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fdba74;
}

.maintenance-description {
    margin-bottom: .9rem;
    color: #475569;
    line-height: 1.45;
}

.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}

.secondary-actions,
.maintenance-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.history-panel {
    margin-top: 1rem;
    border: 1px solid #e2e8f0;
    background: #fafbff;
    border-radius: 16px;
    padding: 1rem;
}

.history-header h4 {
    margin: 0 0 .75rem 0;
    color: #0f172a;
    font-size: 1rem;
}

.history-list {
    display: grid;
    gap: .75rem;
}

.history-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: white;
    padding: .9rem;
}

.history-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .35rem;
}

.history-meta {
    color: #64748b;
    margin-bottom: .5rem;
    line-height: 1.45;
}

.history-notes {
    white-space: pre-wrap;
    color: #334155;
    line-height: 1.45;
    margin-bottom: .5rem;
}

.history-links {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.guidance-panel {
    margin-top: 1rem;
    border: 1px solid #dbe4f0;
    background: #fafbff;
    border-radius: 16px;
    padding: 1rem;
}

.guidance-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

    .guidance-header h4 {
        margin: 0;
        color: #0f172a;
        font-size: 1rem;
    }

    .guidance-header p {
        margin: .35rem 0 0 0;
        color: #475569;
        line-height: 1.45;
    }

.guidance-badges {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.guidance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}

.guidance-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: white;
    padding: .9rem;
}

.warning-card {
    background: #fffaf0;
    border-color: #fde68a;
}

.guidance-text {
    white-space: pre-wrap;
    line-height: 1.45;
}

.steps-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: white;
    padding: .9rem;
    margin-bottom: 1rem;
}

.steps-list {
    margin: .6rem 0 0 1.1rem;
    padding: 0;
    color: #334155;
    line-height: 1.55;
}

    .steps-list li + li {
        margin-top: .45rem;
    }

.guidance-footer {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-top: 1rem;
    margin-bottom: 1.25rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid #e2e8f0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.yt-search-btn {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.yt-search-btn:hover {
    background: #fee2e2;
    color: #9b2c2c;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    overflow-y: auto;
}

.completion-modal {
    width: min(640px, 100%);
    max-height: min(650px, 90dvh);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
    padding: 1.5rem;
    outline: none;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.completion-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}

.modal-close-btn {
    border: none;
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.completion-form {
    display: grid;
    gap: 1rem;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 0.5rem;
    margin-bottom: 0.5rem;
}

    .completion-form .form-row {
        display: grid;
        gap: 0.4rem;
    }

    .completion-form input,
    .completion-form textarea,
    .completion-form select {
        width: 100%;
        border: 1px solid #d0d7e2;
        border-radius: 12px;
        padding: 0.8rem 0.9rem;
        font: inherit;
        background: #fff;
        box-sizing: border-box;
    }

.completion-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-shrink: 0;
}

.upload-help {
    color: #475569;
    font-size: .92rem;
    margin-top: .35rem;
}

.upload-error {
    color: #b91c1c;
    font-size: .92rem;
    margin-top: .35rem;
}

@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .filter-panel {
        position: static;
    }

    .detail-grid,
    .guidance-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .maintenance-page {
        padding: 0.75rem;
        gap: 0.85rem;
    }

    .hero {
        padding: 1rem;
        border-radius: 16px;
        margin-bottom: 1rem;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .panel, .stat-card {
        padding: 1rem;
        border-radius: 14px;
    }

    .hero,
    .panel-header,
    .maintenance-row-main,
    .group-header,
    .guidance-header,
    .completion-modal-header,
    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

    .group-header {
        padding: 0.85rem 1rem;
    }

    .maintenance-row-main {
        padding: 0.85rem 1rem;
    }

    .row-subtitle {
        padding-left: 0;
        margin-top: 0.2rem;
    }

    .row-chevron {
        margin-right: 0.25rem;
    }

    .maintenance-row-details {
        padding: 0 0.85rem 0.85rem 0.85rem;
    }

    .stats-grid,
    .detail-grid,
    .guidance-grid {
        grid-template-columns: 1fr;
    }

    .row-summary,
    .group-header-right,
    .completion-modal-actions {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .row-summary-item {
        align-items: flex-start;
    }

    .results-count {
        white-space: normal;
    }
}

.asset-subgroup-header {
    font-size: 0.85rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.75rem 0.5rem 0.35rem 0.5rem;
    margin-top: 0.5rem;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.group-body > .asset-subgroup-header:first-of-type {
    margin-top: 0;
}

.asset-subgroup-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0.35rem;
    margin-bottom: 0.5rem;
}
