* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f4f7fb;
    color: #17202a;
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.container {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 22px;
    background: linear-gradient(180deg, #101827, #172033);
    color: #ffffff;
    overflow-y: auto;
}

.sidebar h2 {
    margin: 0 0 28px;
    font-size: 24px;
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-bottom: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 14px;
    color: #d9e2ec;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.main-content {
    padding: 34px;
    overflow-x: hidden;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.header-top h2 {
    margin: 0;
    font-size: 30px;
    color: #17202a;
    letter-spacing: -0.8px;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-progress,
.link-history,
.btn-blue,
.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #6f42c1, #0099cc);
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(111, 66, 193, 0.18);
}

.btn-small {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 11px;
    font-size: 12px;
}

.alert {
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 800;
}

.alert.success {
    background: #e8f8ef;
    color: #16803a;
    border: 1px solid #bdeccf;
}

.alert.error {
    background: #fff0f0;
    color: #b42318;
    border: 1px solid #ffd0d0;
}

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

.card {
    padding: 26px;
    border-radius: 26px;
    background: #ffffff;
    border: 1px solid #e7edf3;
    box-shadow: 0 22px 55px rgba(31, 45, 61, 0.08);
}

.card h3 {
    margin: 0 0 18px;
    font-size: 20px;
    color: #17202a;
}

.card h4 {
    margin: 24px 0 12px;
    font-size: 16px;
    color: #17202a;
}

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

.result-box {
    padding: 18px;
    border-radius: 18px;
    background: #f8fbfd;
    border: 1px solid #edf2f7;
}

.result-box strong {
    display: block;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.result-box p {
    margin: 8px 0 0;
    font-size: 28px;
    font-weight: 900;
}

.result-box.found p {
    color: #16803a;
}

.result-box.not-found p {
    color: #b42318;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 900;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: #f8fbfd;
    color: #17202a;
    font-size: 14px;
}

.form-group textarea {
    min-height: 130px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6f42c1;
    background: #ffffff;
    box-shadow: 0 0 0 5px rgba(111, 66, 193, 0.12);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid #e7edf3;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.data-table th {
    padding: 14px;
    background: #f8fbfd;
    color: #475569;
    text-align: left;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

.data-table td {
    padding: 14px;
    border-top: 1px solid #edf2f7;
    color: #334155;
    font-size: 13px;
    vertical-align: top;
    word-break: break-word;
}

.data-table tbody tr:hover {
    background: #fbf8ff;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: #f4efff !important;
}

.terminal-container {
    max-height: 560px;
    overflow: auto;
    padding: 18px;
    border-radius: 20px;
    background: #0b1220;
    border: 1px solid #263447;
    color: #8df7a8;
}

.terminal-container pre {
    margin: 0 0 18px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    color: #8df7a8;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.progress-bar {
    width: 100%;
    height: 16px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7edf3;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(135deg, #6f42c1, #0099cc);
}

.step-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.step-card {
    padding: 16px;
    border-radius: 18px;
    background: #f8fbfd;
    border: 1px solid #edf2f7;
}

.step-card strong {
    display: block;
    margin-bottom: 8px;
    color: #17202a;
    font-size: 13px;
}

.step-card span {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    background: #edf2f7;
    color: #475569;
    font-size: 12px;
    font-weight: 900;
}

.step-card.status-concluído span,
.step-card.status-concluido span {
    background: #e8f8ef;
    color: #16803a;
}

.step-card.status-erro span {
    background: #fff0f0;
    color: #b42318;
}

.step-card.status-processando span {
    background: #e0f2f7;
    color: #007da8;
}

.step-card.status-aguardando span,
.step-card.status-pendente span {
    background: #fff7e6;
    color: #b7791f;
}

.log-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    padding: 32px;
    background: rgba(15, 23, 42, 0.72);
    overflow: auto;
}

.log-modal-content {
    width: min(1180px, 96vw);
    margin: 0 auto;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid #e7edf3;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.log-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 24px;
    background: #101827;
    color: #ffffff;
}

.log-modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.log-modal-header button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 26px;
    cursor: pointer;
}

.log-modal-body {
    padding: 24px;
    max-height: 78vh;
    overflow: auto;
}

.log-modal-body pre {
    padding: 16px;
    border-radius: 16px;
    background: #0b1220;
    color: #8df7a8;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.detail-grid,
.detail-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.detail-grid div,
.detail-status-item {
    padding: 14px;
    border-radius: 16px;
    background: #f8fbfd;
    border: 1px solid #edf2f7;
    color: #334155;
    font-size: 13px;
    word-break: break-word;
}

.detail-status-item strong {
    display: block;
    margin-bottom: 6px;
    color: #17202a;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-status-item span {
    color: #334155;
    font-weight: 800;
}

.status-pill,
.identifier-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.identifier-pill {
    max-width: 100%;
    border-radius: 12px;
    background: #f8fbfd;
    color: #17202a;
    font-family: Consolas, Monaco, monospace;
}

.status-pendente {
    background: #fff7e6;
    color: #b7791f;
}

.status-processando {
    background: #e0f2f7;
    color: #007da8;
}

.status-concluido,
.status-concluído {
    background: #e8f8ef;
    color: #16803a;
}

.status-erro {
    background: #fff0f0;
    color: #b42318;
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 8px;
    color: #6f42c1;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

@media (max-width: 1100px) {
    .dashboard-grid,
    .step-grid {
        grid-template-columns: 1fr;
    }

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

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

    .sidebar {
        position: static;
        height: auto;
    }

    .main-content {
        padding: 22px;
    }

    .header-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-grid,
    .detail-status-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 16px;
    }

    .card {
        padding: 20px;
        border-radius: 20px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .log-modal {
        padding: 12px;
    }

    .log-modal-content {
        width: 100%;
        border-radius: 18px;
    }

    .log-modal-body {
        padding: 16px;
    }

    .data-table th,
    .data-table td {
        padding: 11px;
        font-size: 12px;
    }
}

.diagnostic-page {
    background: #eef3f8;
}

.diagnostic-page .container {
    grid-template-columns: 270px minmax(0, 1fr);
}

.diagnostic-page .main-content {
    width: 100%;
    max-width: none;
    padding: 32px 34px;
}

.diagnostic-page .dashboard-grid {
    grid-template-columns: 1fr;
}

.diagnostic-page .card {
    width: 100%;
    overflow: hidden;
}

.diagnostic-page .table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.diagnostic-page .data-table {
    min-width: 980px;
    table-layout: auto;
}

.diagnostic-page .data-table th,
.diagnostic-page .data-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.diagnostic-page .data-table td:nth-child(3),
.diagnostic-page .data-table td:nth-child(5),
.diagnostic-page .data-table td:nth-child(10) {
    white-space: normal;
    min-width: 180px;
}

.diagnostic-page .terminal-container {
    max-height: 420px;
}

.diagnostic-page .log-modal-content {
    width: min(1280px, 94vw);
}

.diagnostic-page .log-modal-body .data-table {
    min-width: 1100px;
}

.schedule-progress-page .data-table {
    min-width: 1180px;
}

.schedule-progress-page .data-table td:first-child {
    min-width: 150px;
    white-space: normal;
    word-break: break-word;
}

.schedule-progress-page .data-table td:nth-child(10) {
    min-width: 240px;
}

@media (min-width: 1300px) {
    .diagnostic-page .dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .diagnostic-page .main-content {
        padding-left: 36px;
        padding-right: 36px;
    }
}

.diagnostic-page {
    background: radial-gradient(circle at top left, rgba(33, 193, 102, 0.08), transparent 32%), #eef3f8;
}

.diagnostic-page .container {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 28px;
    width: min(1440px, calc(100% - 80px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 28px 0;
}

.diagnostic-page .sidebar {
    position: sticky;
    top: 28px;
    height: calc(100vh - 56px);
    padding: 24px 22px;
    border-radius: 28px;
    background: linear-gradient(180deg, #0b1f17, #101827);
    box-shadow: 0 26px 60px rgba(15, 23, 42, 0.18);
}

.diagnostic-page .sidebar h2 {
    margin: 0 0 30px;
    font-size: 0;
}

.diagnostic-page .sidebar h2::before {
    content: "ONT";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 48px;
    margin-right: 14px;
    border-radius: 15px;
    background: linear-gradient(135deg, #20a34a, #0099cc);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1px;
    vertical-align: middle;
}

.diagnostic-page .sidebar h2::after {
    content: "Suporte ACS\a Diagnóstico";
    white-space: pre;
    display: inline-block;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.35;
    vertical-align: middle;
}

.diagnostic-page .nav-link {
    min-height: 46px;
    padding: 13px 16px;
    border-radius: 16px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 900;
}

.diagnostic-page .nav-link:hover,
.diagnostic-page .nav-link.active {
    background: linear-gradient(135deg, #1fa64a, #0099cc);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(0, 153, 204, 0.22);
}

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

.diagnostic-page .header-top {
    min-height: 150px;
    margin-bottom: 24px;
    padding: 34px 36px;
    border-radius: 28px;
    background: #ffffff;
    box-shadow: 0 22px 55px rgba(31, 45, 61, 0.08);
}

.diagnostic-page .header-top h2 {
    font-size: 40px;
    line-height: 1.1;
    letter-spacing: -1.2px;
}

.diagnostic-page .card {
    border-radius: 26px;
    background: #ffffff;
    border: 1px solid #e7edf3;
    box-shadow: 0 22px 55px rgba(31, 45, 61, 0.08);
}

.diagnostic-page .dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.diagnostic-page .results-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.diagnostic-page .result-box {
    min-height: 98px;
    border-radius: 20px;
    background: #f8fbfd;
}

.diagnostic-page .table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 18px;
}

.diagnostic-page .data-table {
    width: 100%;
    min-width: 1080px;
    table-layout: fixed;
}

.diagnostic-page .data-table th,
.diagnostic-page .data-table td {
    white-space: normal;
    word-break: break-word;
}

.diagnostic-page .data-table th {
    padding: 14px 16px;
    font-size: 12px;
}

.diagnostic-page .data-table td {
    padding: 16px;
    font-size: 13px;
    line-height: 1.35;
}

.diagnostic-page .data-table td:first-child {
    min-width: 170px;
}

.diagnostic-page .data-table td:last-child {
    min-width: 220px;
}

.diagnostic-page .btn-blue,
.diagnostic-page .btn-small,
.diagnostic-page .link-progress,
.diagnostic-page .link-history {
    border-radius: 14px;
    background: linear-gradient(135deg, #6f42c1, #0099cc);
}

.diagnostic-page .terminal-container {
    max-height: 430px;
    border-radius: 20px;
}

.schedule-progress-page .data-table {
    min-width: 1200px;
}

.schedule-progress-page .step-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.schedule-progress-page .card + .card {
    margin-top: 24px;
}

@media (max-width: 1200px) {
    .diagnostic-page .container {
        width: calc(100% - 40px);
        grid-template-columns: 250px minmax(0, 1fr);
    }

    .diagnostic-page .results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .schedule-progress-page .step-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .diagnostic-page .container {
        width: calc(100% - 24px);
        grid-template-columns: 1fr;
        padding: 12px 0;
    }

    .diagnostic-page .sidebar {
        position: static;
        height: auto;
    }

    .diagnostic-page .header-top {
        min-height: auto;
        padding: 26px;
    }

    .diagnostic-page .header-top h2 {
        font-size: 30px;
    }
}

@media (max-width: 900px) {
    .diagnostic-page .container {
        width: calc(100% - 24px);
        grid-template-columns: 1fr;
        padding: 12px 0;
    }

    .diagnostic-page .sidebar {
        position: static;
        height: auto;
    }

    .diagnostic-page .header-top {
        min-height: auto;
        padding: 26px;
    }

    .diagnostic-page .header-top h2 {
        font-size: 30px;
    }
}

.diagnostic-page .compact-log-header {
    min-height: auto;
    align-items: center;
}

.diagnostic-page .compact-log-header h2 {
    margin-bottom: 8px;
    font-size: 34px;
}

.diagnostic-page .page-subtitle {
    max-width: 760px;
    margin: 0;
    color: #64748b;
    font-size: 15px;
    line-height: 1.5;
}

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

.diagnostic-page .card {
    padding: 26px;
}

.diagnostic-page .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.diagnostic-page .data-table {
    min-width: 760px;
}

.diagnostic-page .data-table th,
.diagnostic-page .data-table td {
    white-space: normal;
}

.diagnostic-page .data-table td {
    line-height: 1.35;
}

.diagnostic-page .lightweight-log-card {
    margin-top: 24px;
}

.diagnostic-page .compact-terminal {
    max-height: 320px;
}

@media (max-width: 1200px) {
    .diagnostic-page .dashboard-grid {
        grid-template-columns: 1fr;
    }
}