﻿* {
    box-sizing: border-box;
}


body {
    margin: 0;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #f3f5f8;

    color: #172033;
}


.container {
    width: 1500px;

    max-width: 96%;

    margin: 20px auto 80px;
}


/* ======================================================
   HEADER
====================================================== */

.header h1 {
    margin: 0;

    font-size: 28px;
}


.header p {
    margin: 4px 0 0;

    color: #64748b;
}


/* ======================================================
   TELEGRAM
====================================================== */

.telegram-panel {
    margin-top: 20px;

    padding: 20px;

    background: white;

    border: 1px solid #dbe3ec;

    border-radius: 12px;
}


.panel-title {
    display: flex;

    align-items: center;

    justify-content: space-between;
}


.panel-title h2 {
    margin: 3px 0 0;

    font-size: 18px;
}


.panel-small {
    color: #94a3b8;

    font-size: 9px;

    font-weight: bold;

    letter-spacing: 1px;
}


.telegram-connection {
    padding: 7px 11px;

    border-radius: 20px;

    background: #f1f5f9;

    color: #64748b;

    font-size: 10px;

    font-weight: bold;
}


.telegram-connection.connected {
    background: #dcfce7;

    color: #15803d;
}


.telegram-grid {
    display: grid;

    grid-template-columns:
        2fr
        1.2fr
        .9fr
        .9fr;

    gap: 10px;

    margin-top: 18px;
}


.field label {
    display: block;

    margin-bottom: 6px;

    color: #475569;

    font-size: 10px;

    font-weight: bold;
}


.field input {
    width: 100%;

    padding: 11px;

    border: 1px solid #cbd5e1;

    border-radius: 7px;

    outline: none;
}


.field input:focus {
    border-color: #64748b;
}


.input-unit {
    display: flex;

    align-items: center;

    gap: 5px;
}


.input-unit span {
    color: #64748b;

    font-size: 10px;
}


.telegram-explanation {
    margin-top: 12px;

    padding: 10px 12px;

    border-radius: 7px;

    background: #f8fafc;

    color: #64748b;

    font-size: 11px;

    line-height: 1.6;
}


.telegram-actions {
    display: flex;

    align-items: center;

    gap: 8px;

    margin-top: 13px;
}


.primary-button,
.secondary-button {
    padding: 10px 16px;

    border-radius: 7px;

    font-weight: bold;

    cursor: pointer;
}


.primary-button {
    border: none;

    background: #172033;

    color: white;
}


.secondary-button {
    border: 1px solid #cbd5e1;

    background: white;

    color: #334155;
}


#telegramStatus {
    margin-left: 5px;

    color: #64748b;

    font-size: 11px;
}


/* ======================================================
   PREFIX
====================================================== */

.prefix-form {
    display: flex;

    gap: 10px;

    margin-top: 20px;
}


.prefix-form input {
    flex: 1;

    padding: 14px;

    border: 1px solid #cbd5e1;

    border-radius: 8px;

    font-size: 14px;
}


.prefix-form button,
#scanButton {
    padding: 12px 20px;

    border: none;

    border-radius: 7px;

    background: #172033;

    color: white;

    font-weight: bold;

    cursor: pointer;
}


.error {
    margin-top: 15px;

    padding: 15px;

    background: #fef2f2;

    color: #991b1b;

    border-radius: 8px;
}


.prefix-info {
    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-top: 15px;

    padding: 15px;

    background: white;

    border: 1px solid #e2e8f0;

    border-radius: 10px;
}


.label {
    color: #94a3b8;

    font-size: 9px;

    font-weight: bold;
}


.prefix-info h2 {
    margin: 4px 0 0;
}


.prefix-total {
    padding: 9px 15px;

    background: #f8fafc;

    border-radius: 7px;
}


.prefix-total span {
    display: block;

    color: #64748b;

    font-size: 9px;
}


.prefix-total strong {
    font-size: 18px;
}


/* ======================================================
   SCAN
====================================================== */

.scan-panel {
    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-top: 12px;

    padding: 12px;

    background: white;

    border: 1px solid #e2e8f0;

    border-radius: 9px;
}


.scan-left {
    display: flex;

    align-items: center;

    gap: 12px;
}


#scanStatus {
    color: #64748b;

    font-size: 11px;
}


.scan-summary {
    display: flex;

    gap: 7px;
}


.summary-card {
    min-width: 90px;

    padding: 8px 12px;

    background: #f8fafc;

    border-radius: 7px;
}


.summary-card span {
    display: block;

    color: #64748b;

    font-size: 8px;

    font-weight: bold;
}


.summary-card strong {
    font-size: 17px;
}


.summary-card.reply strong {
    color: #15803d;
}


.summary-card.rto strong {
    color: #b91c1c;
}


/* ======================================================
   LEGEND
====================================================== */

.legend {
    display: flex;

    gap: 20px;

    margin: 18px 0 12px;

    font-size: 10px;
}


.legend div {
    display: flex;

    align-items: center;

    gap: 5px;
}


.legend-box {
    width: 11px;

    height: 11px;

    border-radius: 3px;
}


.legend-box.reply {
    background: #16a34a;
}


.legend-box.rto {
    background: #dc2626;
}


.legend-box.unknown {
    background: #94a3b8;
}


/* ======================================================
   IP GRID
====================================================== */

.ip-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(180px, 1fr)
        );

    gap: 7px;
}


.ip-card {
    min-height: 120px;

    padding: 10px;

    background: white;

    border: 1px solid #dbe3ec;

    border-left: 5px solid #94a3b8;

    border-radius: 7px;
}


.ip-card:hover {
    box-shadow:
        0 4px 12px
        rgba(0, 0, 0, .06);
}


.ip-address {
    font-size: 12px;

    font-weight: bold;
}


.ip-name {
    min-height: 17px;

    margin-top: 4px;

    color: #334155;

    font-size: 10px;

    font-weight: bold;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.no-name {
    color: #94a3b8;

    font-weight: normal;
}


.ip-status {
    margin-top: 5px;

    color: #64748b;

    font-size: 9px;

    font-weight: bold;
}


/* MANUAL SCAN STATUS */

.ip-card.reply {
    border-left-color: #16a34a;

    background: #f0fdf4;
}


.ip-card.reply .ip-status {
    color: #15803d;
}


.ip-card.rto {
    border-left-color: #dc2626;

    background: #fef2f2;
}


.ip-card.rto .ip-status {
    color: #b91c1c;
}


.ip-card.scanning {
    border-left-color: #f59e0b;

    background: #fffbeb;
}


/* ======================================================
   MONITOR
====================================================== */

.monitor-section {
    margin-top: 9px;

    padding-top: 7px;

    border-top: 1px solid #e2e8f0;
}


.monitor-badge {
    display: inline-block;

    padding: 4px 6px;

    border-radius: 4px;

    font-size: 8px;

    font-weight: bold;
}


.monitor-disabled,
.state-unknown {
    background: #f1f5f9;

    color: #64748b;
}


.state-up {
    background: #dcfce7;

    color: #15803d;
}


.state-down {
    background: #fee2e2;

    color: #b91c1c;
}


.state-down-ack {
    background: #e2e8f0;

    color: #475569;
}


.state-pending {
    background: #fef3c7;

    color: #b45309;
}


.card-actions {
    display: flex;

    gap: 5px;

    margin-top: 7px;
}


.edit-name-button,
.monitor-toggle-button {
    flex: 1;

    padding: 5px;

    border: 1px solid #cbd5e1;

    border-radius: 5px;

    background: white;

    color: #475569;

    font-size: 9px;

    cursor: pointer;
}


.monitor-toggle-button.enabled {
    background: #f0fdf4;

    border-color: #86efac;

    color: #15803d;
}


/* ======================================================
   MODAL
====================================================== */

.modal {
    position: fixed;

    inset: 0;

    display: none;

    align-items: center;

    justify-content: center;

    background:
        rgba(15, 23, 42, .45);

    z-index: 999;
}


.modal.show {
    display: flex;
}


.modal-box {
    width: 420px;

    max-width: 94%;

    padding: 22px;

    background: white;

    border-radius: 12px;
}

.header-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.header-actions a {
    color: #2563eb;
    font-size: 13px;
    text-decoration: none;
}

.dashboard-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.dashboard-tools input,
.dashboard-tools select,
.check-extra input,
#checkType {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 9px 11px;
    background: white;
}

.dashboard-tools input {
    min-width: 230px;
}

#latestScanInfo {
    color: #64748b;
    font-size: 13px;
}

.latency {
    display: block;
    color: #64748b;
    font-size: 11px;
    margin-top: 4px;
}

.wide-modal {
    max-width: 820px;
}

.history-summary {
    color: #475569;
    margin: 10px 0 16px;
}

.history-chart-wrap {
    overflow-x: auto;
}

.check-extra {
    margin-top: 12px;
}

.check-extra label,
.login-card label {
    display: block;
    margin-bottom: 5px;
}

.check-extra input {
    width: 100%;
    box-sizing: border-box;
}

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.login-card {
    width: min(420px, calc(100% - 32px));
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .12);
}

.login-card h1 {
    margin: 8px 0;
}

.login-help {
    color: #64748b;
    margin-bottom: 22px;
}

.login-card input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    margin: 6px 0 14px;
}

.login-card button {
    width: 100%;
    margin-top: 4px;
}

.success-message {
    margin: 14px 0;
    padding: 11px 13px;
    border-radius: 7px;
    background: #ecfdf5;
    color: #15803d;
    font-size: 13px;
}

.back-link {
    display: inline-block;
    margin-top: 18px;
    color: #2563eb;
    font-size: 13px;
    text-decoration: none;
}


.modal-title {
    display: flex;

    justify-content: space-between;

    margin-bottom: 18px;
}


.modal-title span {
    color: #94a3b8;

    font-size: 9px;
}


.modal-title h3 {
    margin: 3px 0 0;
}


.close-modal {
    border: none;

    background: none;

    font-size: 25px;

    cursor: pointer;
}


.modal-box > label {
    display: block;

    margin-bottom: 6px;

    font-size: 11px;

    font-weight: bold;
}


.modal-box > input {
    width: 100%;

    padding: 11px;

    border: 1px solid #cbd5e1;

    border-radius: 7px;
}


.modal-actions {
    display: flex;

    justify-content: flex-end;

    gap: 7px;

    margin-top: 18px;
}


.modal-actions button {
    padding: 9px 16px;

    border-radius: 6px;

    cursor: pointer;
}


.cancel-button {
    border: 1px solid #cbd5e1;

    background: white;
}


.save-button {
    border: none;

    background: #172033;

    color: white;
}


/* ======================================================
   RESPONSIVE
====================================================== */

@media (max-width: 1000px) {

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

}


@media (max-width: 650px) {

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


    .prefix-form {
        flex-direction: column;
    }


    .scan-panel {
        align-items: flex-start;

        flex-direction: column;

        gap: 10px;
    }


    .telegram-actions {
        align-items: flex-start;

        flex-direction: column;
    }

}


/* ======================================================
   POLISHED NOC DASHBOARD OVERRIDES
====================================================== */

:root {
    --ink: #172033;
    --muted: #64748b;
    --line: #dbe3ec;
    --panel: #ffffff;
    --canvas: #eef2f7;
    --blue: #2563eb;
    --green: #16a34a;
    --red: #dc2626;
}

body {
    background: var(--canvas);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.container {
    width: min(1740px, calc(100% - 48px));
    max-width: none;
    margin: 24px auto 60px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .04);
}

.header h1 {
    font-size: 24px;
    letter-spacing: -.02em;
}

.header p {
    font-size: 13px;
}

.header-actions {
    margin: 0;
    align-items: center;
    gap: 8px;
}

.header-actions a {
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #334155;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
}

.header-actions a:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.telegram-panel,
.prefix-info,
.scan-panel,
.dashboard-tools {
    border-color: var(--line);
    box-shadow: 0 4px 16px rgba(15, 23, 42, .035);
}

.telegram-panel {
    margin-top: 16px;
    padding: 20px 22px;
}

.prefix-form {
    margin-top: 16px;
}

.prefix-form input {
    background: var(--panel);
    border-color: var(--line);
}

.prefix-form button,
#scanButton,
.primary-button {
    background: var(--ink);
    transition: transform .15s ease, background .15s ease;
}

.prefix-form button:hover,
#scanButton:hover,
.primary-button:hover {
    background: #26344d;
    transform: translateY(-1px);
}

.prefix-info {
    margin-top: 14px;
    padding: 16px 18px;
}

.prefix-info h2 {
    font-size: 20px;
    letter-spacing: -.02em;
}

.prefix-help {
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
}

.prefix-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.prefix-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 9px 8px 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.prefix-chip span {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.prefix-chip strong {
    color: #334155;
    font-size: 12px;
}

.prefix-chip small {
    color: var(--muted);
    font-size: 10px;
}

.delete-prefix-button {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #94a3b8;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.delete-prefix-button:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.scan-panel {
    margin-top: 10px;
    padding: 14px 16px;
}

.scan-summary {
    gap: 8px;
}

.summary-card {
    min-width: 82px;
    padding: 8px 11px;
    border: 1px solid #e8edf3;
}

.dashboard-tools {
    margin: 12px 0 10px;
    padding: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
}

.dashboard-tools input,
.dashboard-tools select {
    height: 36px;
    border-color: var(--line);
    color: #334155;
    font-size: 12px;
}

.dashboard-tools input {
    min-width: 280px;
    flex: 1;
}

.dashboard-tools select {
    min-width: 145px;
}

#latestScanInfo {
    margin-left: auto;
    padding: 0 8px;
    font-size: 11px;
}

.legend {
    margin: 12px 2px 10px;
    color: #64748b;
}

.ip-grid {
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: 10px;
}

.ip-card {
    min-height: 154px;
    padding: 13px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 10px;
    box-shadow: 0 2px 7px rgba(15, 23, 42, .025);
    transition: transform .15s ease, box-shadow .15s ease;
}

.ip-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .09);
}

.ip-address {
    font-size: 13px;
    letter-spacing: -.01em;
}

.ip-name {
    margin-top: 5px;
    min-height: 18px;
    font-size: 11px;
}

.ip-status {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-height: 31px;
    margin-top: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(148, 163, 184, .28);
    font-size: 10px;
}

.latency {
    display: inline;
    margin: 0;
    font-size: 11px;
    font-weight: 500;
}

.monitor-section {
    margin-top: 9px;
    padding-top: 0;
    border-top: 0;
}

.monitor-badge {
    padding: 5px 7px;
    border-radius: 5px;
    font-size: 9px;
}

.card-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 9px;
}

.edit-name-button,
.history-button,
.check-config-button,
.monitor-toggle-button {
    min-width: 0;
    padding: 7px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: rgba(255, 255, 255, .78);
    color: #475569;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.edit-name-button:hover,
.history-button:hover,
.check-config-button:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.monitor-toggle-button {
    grid-column: 1 / -1;
    background: #f8fafc;
}

.monitor-toggle-button.enabled {
    background: #ecfdf5;
    border-color: #86efac;
    color: #15803d;
}

.modal-box {
    box-shadow: 0 18px 50px rgba(15, 23, 42, .2);
}

@media (max-width: 800px) {
    .container {
        width: min(100% - 24px, 680px);
        margin-top: 12px;
    }

    .header {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px;
    }

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

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

    .scan-panel {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .scan-summary {
        width: 100%;
    }

    .summary-card {
        flex: 1;
    }

    #latestScanInfo {
        width: 100%;
        margin-left: 0;
    }
}

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

    .dashboard-tools input,
    .dashboard-tools select {
        width: 100%;
        min-width: 0;
    }

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


/* Compact target bar and monitoring table */

.prefix-info,
.prefix-help {
    display: none;
}

.prefix-list {
    margin: 12px 0 0;
    padding: 0;
}

.prefix-chip {
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .04);
}

.scan-panel {
    display: block;
}

.scan-left {
    width: 100%;
    min-width: 0;
    display: block;
}

.scan-left .prefix-list {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.scan-summary {
    margin: 12px 0 0;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    justify-content: flex-start;
}

.prefix-target-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 6px 0;
    border-bottom: 1px solid #e8edf3;
}

.prefix-target-row:last-child {
    border-bottom: 0;
}

.prefix-target-row .prefix-chip {
    flex: 1 1 auto;
    min-width: 220px;
}

.prefix-target-summary {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
}

.prefix-summary-card {
    min-width: 76px;
    padding: 6px 10px;
    background: #f8fafc;
    border: 1px solid #e8edf3;
    border-radius: 7px;
}

.prefix-summary-card span {
    display: block;
    color: #64748b;
    font-size: 9px;
}

.prefix-summary-card strong {
    display: block;
    margin-top: 2px;
    font-size: 16px;
    color: #0f172a;
}

.prefix-summary-card.reply strong {
    color: #008a4b;
}

.prefix-summary-card.rto strong {
    color: #dc2626;
}

.ip-grid {
    display: block;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .035);
}

.ip-table-header,
.ip-card {
    display: grid;
    grid-template-columns: minmax(150px, 1.15fr) minmax(160px, 1.6fr) minmax(130px, 1fr) minmax(135px, 1fr) minmax(270px, 2.2fr);
    align-items: center;
    column-gap: 16px;
}

.ip-table-header {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 38px;
    padding: 0 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    color: #94a3b8;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
}

.ip-card {
    min-height: 72px;
    padding: 9px 16px;
    border: 0;
    border-left: 4px solid #94a3b8;
    border-bottom: 1px solid #edf1f5;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    transition: background .15s ease;
}

.ip-card:last-child {
    border-bottom: 0;
}

.ip-card:hover {
    transform: none;
    background: #f8fbff;
    box-shadow: none;
}

.ip-card.reply,
.ip-card.rto,
.ip-card.scanning {
    background: #fff;
}

.ip-card.reply {
    border-left-color: var(--green);
}

.ip-card.rto {
    border-left-color: var(--red);
}

.ip-card.scanning {
    border-left-color: #f59e0b;
}

.ip-address,
.ip-name,
.ip-status,
.monitor-badge,
.card-actions {
    min-width: 0;
}

.ip-address {
    grid-column: 1;
    font-size: 12px;
}

.ip-name {
    grid-column: 2;
    margin: 0;
}

.ip-status {
    grid-column: 3;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.monitor-section {
    display: contents;
}

.monitor-badge {
    grid-column: 4;
    justify-self: start;
    white-space: nowrap;
}

.card-actions {
    grid-column: 5;
    display: flex;
    gap: 6px;
    margin: 0;
}

.edit-name-button,
.history-button,
.check-config-button,
.monitor-toggle-button {
    flex: 1;
    white-space: nowrap;
}

.monitor-toggle-button {
    grid-column: auto;
}

@media (max-width: 900px) {
    .ip-table-header {
        display: none;
    }

    .ip-card {
        grid-template-columns: 1fr 1fr;
        row-gap: 6px;
        min-height: 130px;
        padding: 12px;
    }

    .ip-address,
    .ip-name,
    .ip-status,
    .monitor-badge,
    .card-actions {
        grid-column: auto;
    }

    .ip-status,
    .monitor-badge,
    .card-actions {
        grid-column: 1 / -1;
    }
}


/* Restore card/grid layout */

.ip-table-header {
    display: none !important;
}

.ip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: 10px;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.ip-card {
    display: block;
    min-height: 154px;
    padding: 13px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(15, 23, 42, .025);
}

.ip-card:hover {
    transform: translateY(-2px);
    background: #f8fbff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .09);
}

.ip-card.reply,
.ip-card.rto,
.ip-card.scanning {
    background: #fff;
}

.ip-card.reply { border-left-color: var(--green); }
.ip-card.rto { border-left-color: var(--red); }
.ip-card.scanning { border-left-color: #f59e0b; }

.ip-card.reply {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
}

.ip-card.rto {
    border: 1px solid #fecaca;
    background: #fef2f2;
}

.ip-card.unknown {
    border: 1px solid #dbe3ec;
    background: #ffffff;
}

/* ======================================================
   WMiNET MODERN UI
====================================================== */

:root {
    --navy: #12203d;
    --navy-2: #1d3158;
    --blue: #2563eb;
    --surface: #ffffff;
    --canvas: #f4f7fb;
    --line-soft: #e5ebf3;
    --muted-soft: #71809a;
}

body:not(.login-page) {
    background:
        radial-gradient(circle at 8% -10%, rgba(37, 99, 235, .08), transparent 28%),
        var(--canvas);
    color: #14213d;
}

.container {
    width: min(1500px, calc(100% - 36px));
    max-width: none;
    margin: 24px auto 72px;
}

.header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(30, 52, 88, .07);
}

.brand-lockup,
.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    background: linear-gradient(145deg, #2563eb, #14213d);
    color: white;
    font-size: 20px;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .25);
}

.header h1 {
    color: var(--navy);
    font-size: 24px;
    letter-spacing: -.03em;
}

.header p {
    margin-top: 4px;
    color: var(--muted-soft);
    font-size: 12px;
}

.header-actions {
    margin-left: auto;
    gap: 7px;
}

.header-actions a {
    padding: 9px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 9px;
    background: #fff;
    color: #42516c;
    font-size: 11px;
    font-weight: 700;
    transition: border-color .18s ease, color .18s ease, transform .18s ease;
}

.header-actions a:hover {
    border-color: #9bb8ee;
    color: var(--blue);
    transform: translateY(-1px);
}

.telegram-panel,
.scan-panel,
.dashboard-tools {
    border-color: var(--line-soft);
    border-radius: 16px;
    box-shadow: 0 10px 26px rgba(30, 52, 88, .055);
}

.telegram-panel {
    margin-top: 0;
    padding: 22px 24px;
}

.panel-small,
.eyebrow {
    color: #6c83a8;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
}

.panel-title h2 {
    color: var(--navy);
    font-size: 17px;
    letter-spacing: -.02em;
}

.telegram-connection {
    border: 1px solid #e4eaf3;
    background: #f6f8fc;
}

.telegram-connection.connected {
    border-color: #b9edcf;
    background: #ecfdf3;
    color: #07864d;
}

.telegram-grid {
    gap: 14px;
    margin-top: 20px;
}

.field label {
    color: #53627b;
    font-size: 10px;
    letter-spacing: .01em;
}

.field input,
.prefix-form input,
.dashboard-tools input,
.dashboard-tools select,
.login-card input {
    border-color: #d9e2ee;
    background: #fbfcfe;
    color: #172542;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.field input:focus,
.prefix-form input:focus,
.dashboard-tools input:focus,
.dashboard-tools select:focus,
.login-card input:focus {
    border-color: #7da3e9;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .09);
}

.telegram-actions {
    margin-top: 16px;
}

.primary-button,
.prefix-form button {
    background: linear-gradient(135deg, #17294d, #253d6a);
    box-shadow: 0 7px 14px rgba(23, 41, 77, .16);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.primary-button:hover,
.prefix-form button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(23, 41, 77, .2);
}

.secondary-button {
    border-color: #d7e0ec;
    background: #fff;
    transition: border-color .18s ease, color .18s ease, transform .18s ease;
}

.secondary-button:hover {
    border-color: #9bb8ee;
    color: var(--blue);
    transform: translateY(-1px);
}

.prefix-form {
    gap: 9px;
    margin-top: 18px;
    padding: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: rgba(255, 255, 255, .85);
    box-shadow: 0 8px 22px rgba(30, 52, 88, .045);
}

.prefix-form input {
    padding: 12px 14px;
    border: 0;
    background: transparent;
}

.prefix-form input:focus {
    box-shadow: none;
}

.prefix-form button {
    padding: 0 18px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    font-weight: 800;
}

.scan-panel {
    margin-top: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, .9);
}

.scan-left .prefix-list {
    gap: 8px;
}

.prefix-target-row {
    padding: 8px 10px;
    border: 1px solid #e4eaf3;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(30, 52, 88, .035);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.prefix-target-row:hover {
    border-color: #bfd1ee;
    box-shadow: 0 7px 16px rgba(30, 52, 88, .07);
}

.prefix-target-row .prefix-chip {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.prefix-chip strong {
    color: #1c2d4b;
    font-size: 12px;
}

.prefix-summary-card {
    min-width: 82px;
    padding: 7px 10px;
    border-color: #e4eaf3;
    background: #f8fafc;
}

.prefix-summary-card.reply {
    border-color: #c8efd8;
    background: #f0fdf5;
}

.prefix-summary-card.rto {
    border-color: #f5cccc;
    background: #fff5f5;
}

.scan-summary {
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top-color: #e8edf4;
}

.summary-card {
    min-width: 92px;
    padding: 9px 12px;
    border: 1px solid #e4eaf3;
    background: #f8fafc;
}

.summary-card.reply {
    border-color: #c8efd8;
    background: #f0fdf5;
}

.summary-card.rto {
    border-color: #f5cccc;
    background: #fff5f5;
}

.dashboard-tools {
    gap: 9px;
    margin: 14px 0 12px;
    padding: 9px;
    background: rgba(255, 255, 255, .88);
}

.dashboard-tools input,
.dashboard-tools select {
    height: 38px;
}

#latestScanInfo {
    padding: 0 6px;
    color: #8190a8;
    font-size: 10px;
}

.legend {
    gap: 16px;
    margin: 8px 2px 10px;
    color: #71809a;
    font-size: 10px;
}

.ip-grid {
    gap: 12px;
}

.ip-card {
    min-height: 164px;
    padding: 15px;
    border-radius: 14px;
    box-shadow: 0 5px 14px rgba(30, 52, 88, .045);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.ip-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(30, 52, 88, .1);
}

.ip-card.reply {
    border-color: #bceccf;
    background: linear-gradient(145deg, #f1fdf5, #ecfbf2);
}

.ip-card.rto {
    border-color: #f4c8c8;
    background: linear-gradient(145deg, #fff6f6, #fff0f0);
}

.ip-card.unknown {
    border-color: #dfe6ef;
    background: #fff;
}

.ip-address {
    color: #172b4d;
    font-size: 13px;
    font-weight: 800;
}

.ip-name {
    color: #53627b;
}

.ip-status {
    margin-top: 9px;
    color: #52627b;
}

.monitor-badge {
    border-radius: 6px;
    letter-spacing: .02em;
}

.card-actions button {
    border-color: #d1dceb;
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    color: #40516d;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.card-actions button:hover {
    border-color: #8eabe0;
    background: #fff;
    color: var(--blue);
}

.traceroute-button {
    min-width: 0;
    padding: 7px 4px;
    border: 1px solid #d1dceb;
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    color: #40516d;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.traceroute-button:hover {
    border-color: #8eabe0;
    background: #fff;
    color: var(--blue);
}

.traceroute-status {
    margin: 4px 0 12px;
    color: #64748b;
    font-size: 11px;
}

.traceroute-output {
    min-height: 210px;
    max-height: 420px;
    margin: 0;
    overflow: auto;
    padding: 15px;
    border: 1px solid #dce5f0;
    border-radius: 10px;
    background: #0d172c;
    color: #c8d7f0;
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 11px;
    line-height: 1.65;
    white-space: pre-wrap;
}

/* Login and account screens */

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(37, 99, 235, .25), transparent 28%),
        radial-gradient(circle at 90% 85%, rgba(31, 67, 126, .3), transparent 30%),
        #0e1930;
}

.login-card {
    width: min(440px, 100%);
    margin: 0;
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 22px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 28px 70px rgba(1, 9, 25, .35);
}

.login-brand {
    margin-bottom: 34px;
}

.login-brand strong,
.login-brand span {
    display: block;
}

.login-brand strong {
    color: var(--navy);
    font-size: 15px;
}

.login-brand span {
    margin-top: 3px;
    color: #8190a8;
    font-size: 10px;
}

.login-heading .eyebrow {
    color: var(--blue);
}

.login-card h1 {
    margin: 8px 0 7px;
    color: var(--navy);
    font-size: 25px;
    letter-spacing: -.035em;
}

.login-help {
    margin: 0 0 24px;
    color: #71809a;
    font-size: 12px;
    line-height: 1.6;
}

.login-card label {
    margin: 15px 0 7px;
    color: #53627b;
    font-size: 11px;
    font-weight: 800;
}

.login-card input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 10px;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 86px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--blue);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.login-card .password-toggle {
    width: auto;
    margin-top: 0;
}

.password-toggle:hover {
    background: #eff5ff;
}

.login-card form .primary-button {
    width: 100%;
    margin-top: 24px;
    padding: 13px 16px;
    border-radius: 10px;
}

.login-footer {
    margin: 25px 0 0;
    color: #9aa7ba;
    font-size: 10px;
    text-align: center;
}

.back-link {
    display: block;
    margin-top: 18px;
    color: var(--blue);
    font-size: 11px;
    text-align: center;
}

@media (max-width: 800px) {
    .container {
        width: min(100% - 22px, 680px);
        margin-top: 11px;
    }

    .header {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 16px;
    }

    .header-actions {
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
    }

    .header-actions a {
        flex: 1 1 auto;
        text-align: center;
    }

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

    .prefix-target-row {
        align-items: stretch;
        flex-direction: column;
    }

    .prefix-target-row .prefix-chip {
        min-width: 0;
    }

    .prefix-target-summary {
        width: 100%;
    }

    .prefix-summary-card {
        flex: 1;
    }
}

@media (max-width: 520px) {
    .telegram-panel,
    .scan-panel {
        padding: 14px;
    }

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

    .prefix-form {
        flex-direction: column;
    }

    .prefix-form button {
        min-height: 42px;
    }

    .login-card {
        padding: 26px 22px;
        border-radius: 18px;
    }
}

.ip-address,
.ip-name,
.ip-status,
.monitor-badge,
.card-actions {
    min-width: 0;
}

.ip-address { font-size: 13px; }

.ip-name {
    margin-top: 5px;
    min-height: 18px;
}

.ip-status {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-height: 31px;
    margin-top: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(148, 163, 184, .28);
}

.monitor-section {
    display: block;
    margin-top: 9px;
    padding-top: 0;
    border-top: 0;
}

.monitor-badge {
    display: inline-block;
}

.card-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 9px;
}

.monitor-toggle-button {
    grid-column: 1 / -1;
}

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