* {
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    width: 100%;
    min-width: 0;
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
    overflow-x: hidden;
}

.container {
    width: min(1200px, 94%);
    margin: 30px auto;
}

.card {
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

h1,
h2,
h3 {
    margin-top: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 21px;
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 11px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    margin-top: 6px;
    margin-bottom: 15px;
    font-family: inherit;
    font-size: 15px;
    background: #ffffff;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 15px;
    border: 0;
    border-radius: 7px;
    background: #111827;
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.2;
}

button:hover,
.btn:hover {
    opacity: .9;
}

button:disabled,
.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-danger {
    background: #b91c1c;
}

.btn-success {
    background: #047857;
}

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

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
}

th {
    font-size: 13px;
    background: #f9fafb;
}

td {
    font-size: 14px;
}

.status-online {
    color: #047857;
    font-weight: bold;
}

.status-offline {
    color: #b91c1c;
    font-weight: bold;
}

.status-error {
    color: #b45309;
    font-weight: bold;
}

.status-unknown {
    color: #6b7280;
}

.alert {
    padding: 12px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 7px;
    margin-bottom: 15px;
}

.expiration-warning {
    color: #c2410c;
    font-weight: bold;
}

.expiration-danger {
    color: #b91c1c;
    font-weight: bold;
}


/* ==============================
   BUTTON / ACTION AREAS
   ============================== */

.actions,
.button-row,
.action-buttons,
.mode-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #f9fafb;
    color: #111827;
    cursor: pointer;
}

.filter-btn.active {
    background: #111827;
    color: #ffffff;
}

.server-hidden {
    display: none;
}


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

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 5px;
}

.dashboard-header h1 {
    margin: 0;
}


/* ==============================
   DASHBOARD BUTTONS
   ============================== */

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
}


/* ==============================
   DASHBOARD STATISTICS
   ============================== */

.dashboard-stats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 22px 0 0 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}

.dashboard-stat {
    position: relative;
    min-height: 95px;
    padding: 16px 18px;
    text-align: center;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    transition:
        background .2s ease,
        transform .2s ease;
}

.dashboard-stat:last-child {
    border-right: none;
}

.dashboard-stat:hover {
    background: #f9fafb;
}

.dashboard-stat-label {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: .4px;
    margin-bottom: 9px;
    white-space: nowrap;
}

.dashboard-stat-number {
    font-size: 30px;
    line-height: 1;
    font-weight: 800;
    color: #111827;
}

.dashboard-stat.online .dashboard-stat-number {
    color: #047857;
}

.dashboard-stat.error .dashboard-stat-number {
    color: #b91c1c;
}

.dashboard-stat.expiring .dashboard-stat-number {
    color: #c2410c;
}

.dashboard-stat.expired .dashboard-stat-number {
    color: #b91c1c;
}


/* ==============================
   STAT ANIMATION
   ============================== */

@keyframes statAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-stat {
    animation: statAppear .45s ease both;
}

.dashboard-stat:nth-child(1) {
    animation-delay: .05s;
}

.dashboard-stat:nth-child(2) {
    animation-delay: .10s;
}

.dashboard-stat:nth-child(3) {
    animation-delay: .15s;
}

.dashboard-stat:nth-child(4) {
    animation-delay: .20s;
}

.dashboard-stat:nth-child(5) {
    animation-delay: .25s;
}


/* ==============================
   TABLET
   ============================== */

@media (max-width: 1000px) {

    .container {
        width: 96%;
        margin: 20px auto;
    }

    .dashboard-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-stat:nth-child(3) {
        border-right: none;
    }

    .dashboard-stat:nth-child(4),
    .dashboard-stat:nth-child(5) {
        border-top: 1px solid #e5e7eb;
    }

}


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

@media (max-width: 700px) {

    body {
        font-size: 14px;
    }

    .container {
        width: 100%;
        margin: 0;
        padding: 10px;
    }

    .card {
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 12px;
    }

    h1 {
        font-size: 23px;
        line-height: 1.25;
    }

    h2 {
        font-size: 19px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
        padding: 12px;
    }

    button,
    .btn {
        min-height: 44px;
        padding: 11px 13px;
        font-size: 14px;
    }

    .dashboard-header {
        align-items: center;
        gap: 10px;
    }

    .dashboard-header h1 {
        font-size: 22px;
    }

    .dashboard-header .btn {
        flex-shrink: 0;
    }

    .dashboard-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .dashboard-actions .btn {
        width: 100%;
    }

    .filter-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 7px;
    }

    .filter-btn {
        width: 100%;
        min-height: 42px;
        padding: 9px 5px;
        font-size: 13px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 15px;
    }

    .dashboard-stat {
        min-height: 85px;
        padding: 13px 7px;
        border-bottom: 1px solid #e5e7eb;
    }

    .dashboard-stat:nth-child(1),
    .dashboard-stat:nth-child(3) {
        border-right: 1px solid #e5e7eb;
    }

    .dashboard-stat:nth-child(2),
    .dashboard-stat:nth-child(4) {
        border-right: none;
    }

    .dashboard-stat:nth-child(5) {
        grid-column: 1 / -1;
        border-right: none;
        border-bottom: none;
    }

    .dashboard-stat-label {
        font-size: 9px;
        letter-spacing: .2px;
        margin-bottom: 7px;
    }

    .dashboard-stat-number {
        font-size: 26px;
    }

    .table-wrapper {
        margin-left: -2px;
        width: calc(100% + 4px);
    }

    table {
        min-width: 760px;
    }

    th,
    td {
        padding: 10px 8px;
        font-size: 12px;
    }

    .actions,
    .button-row,
    .action-buttons,
    .mode-buttons {
        width: 100%;
    }

    .actions .btn,
    .button-row .btn,
    .action-buttons .btn,
    .mode-buttons .btn {
        flex: 1 1 auto;
    }

}


/* ==============================
   SMALL PHONES
   ============================== */

@media (max-width: 450px) {

    .container {
        padding: 7px;
    }

    .card {
        padding: 12px;
    }

    h1 {
        font-size: 21px;
    }

    h2 {
        font-size: 18px;
    }

    .dashboard-header {
        gap: 7px;
    }

    .dashboard-header h1 {
        font-size: 20px;
    }

    .dashboard-header .btn {
        min-height: 40px;
        padding: 9px 10px;
        font-size: 13px;
    }

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

    .dashboard-stat {
        min-height: 80px;
        padding: 12px 5px;
    }

    .dashboard-stat-label {
        font-size: 8px;
    }

    .dashboard-stat-number {
        font-size: 24px;
    }

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

    .filter-btn {
        font-size: 14px;
    }

}


/* ==============================
   VERY SMALL PHONES
   ============================== */

@media (max-width: 360px) {

    .container {
        padding: 5px;
    }

    .card {
        padding: 10px;
    }

    .dashboard-header h1 {
        font-size: 18px;
    }

    .dashboard-stat-number {
        font-size: 22px;
    }

}
