body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0.9rem;
    background: #0b1730;
    color: #ffffff;
}

main {
    max-width: 1800px;
    margin: 0 auto;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

a {
    color: inherit;
}

/* --------------------------------------------------
   Page header
-------------------------------------------------- */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-subtitle {
    margin: 0.35rem 0 0 0;
    color: rgba(255, 255, 255, 0.72);
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sort-link {
    text-decoration: none;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.sort-link.is-active {
    background: #ffffff;
    color: #0b1730;
    font-weight: 700;
}

/* --------------------------------------------------
   Grid cartes machines
-------------------------------------------------- */

.machine-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.machine-card {
    border-radius: 18px;
    padding: 0.8rem;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.machine-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

.card-free { background: #0d8b68; }
.card-running { background: #2463eb; }
.card-offline { background: #5f6775; }
.card-out-of-service { background: #6e44c7; }
.card-warning { background: #cc7a00; }

.machine-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.machine-title-block {
    min-width: 0;
}

.machine-label {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.3rem;
}

.machine-ip {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.82rem;
    word-break: break-all;
}

.machine-ip:hover {
    text-decoration: underline;
}

.machine-number {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    color: #d7ff87;
}

.machine-state {
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    margin: 0.4rem 0 0.55rem 0;
}

.machine-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.machine-meta {
    font-size: 0.88rem;
    display: flex;
    gap: 0.35rem;
}

.machine-time {
    font-size: 1rem;
    font-weight: 700;
    color: #d7ff87;
}

.machine-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.machine-action-button {
    border: none;
    border-radius: 999px;
    padding: 0.42rem 0.72rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.machine-action-button:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* --------------------------------------------------
   Modales
-------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 22, 0.78);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.modal-overlay.is-open {
    display: flex;
}

.modal-panel {
    width: min(900px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: #12203f;
    border-radius: 20px;
    padding: 1rem;
}

.confirm-panel {
    width: min(460px, 100%);
    background: #12203f;
    border-radius: 20px;
    padding: 1rem;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.modal-info-box {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.75rem;
}

.modal-panel pre {
    background: #091224;
    padding: 1rem;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 0.84rem;
}

/* --------------------------------------------------
   Navigation admin (cartes)
-------------------------------------------------- */

.admin-shell-header {
    margin-bottom: 1.2rem;
}

.admin-shell-inner {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.admin-shell-brand-title {
    font-size: 1.5rem;
    font-weight: 800;
}

.admin-shell-brand-subtitle {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.65);
}

.admin-nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.admin-nav-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    background: rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 1rem;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    transition: all 0.15s ease;
}

.admin-nav-card:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.12);
}

.admin-nav-card.is-active {
    background: linear-gradient(135deg,#2563eb,#3b82f6);
}

.admin-nav-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: rgba(255,255,255,0.12);
}

.admin-nav-label {
    font-size: 1rem;
    font-weight: 700;
}

.admin-nav-desc {
    font-size: 0.82rem;
    opacity: 0.8;
}

/* --------------------------------------------------
   Responsive
-------------------------------------------------- */

@media (max-width: 1400px) {
    .machine-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1000px) {
    .machine-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {

    body {
        padding: 0.75rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .machine-grid {
        grid-template-columns: 1fr;
    }

    .machine-number {
        font-size: 2rem;
    }

    .machine-state {
        font-size: 1rem;
    }

    .machine-time {
        font-size: 0.95rem;
    }

    .admin-nav-grid {
        grid-template-columns: 1fr;
    }
}