@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap');

:root {
    --bg: #f4f6fb;
    --card: #fff;
    --primary: #2456ff;
    --primary-dark: #1a43c9;
    --text: #1f2d3d;
    --muted: #6b7a8c;
    --border: #dfe4f2;
    --success: #4caf50;
    --danger: #e53935;
    --warning: #f9a825;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Source Sans Pro', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand { display: flex; align-items: center; gap: 1rem; }
.brand .logo {
    width: 52px; height: 52px;
    border-radius: 12px;
    background: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    font-size: 1.3rem;
}
.user-info { display: flex; align-items: center; gap: 1rem; font-weight: 600; }

.app-main { padding: 2rem; display: grid; gap: 1.5rem; }

.card {
    background: var(--card);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 8px 25px rgba(31,45,61,0.05);
    border: 1px solid rgba(222,228,243,0.8);
}
.card h2 { font-size: 1.2rem; margin-bottom: 1rem; }

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.table th, .table td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.95rem;
}
.table th { color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.8rem; }
.table tr:last-child td { border-bottom: none; }
.status-pill {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.status-up { background: rgba(76,175,80,0.15); color: var(--success); }
.status-down { background: rgba(229,57,53,0.15); color: var(--danger); }

.btn {
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
}
.btn-outline:hover { background: var(--border); }

.app-footer {
    text-align: center;
    padding: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
}
.card-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:.8rem;
}
.pill {
    display:inline-flex;
    align-items:center;
    padding:.25rem .7rem;
    border-radius:999px;
    font-size:.78rem;
    font-weight:600;
}
.pill-live { background:rgba(36,86,255,.15); color:#2456ff; }
.last-update { margin-top:.5rem; color:var(--muted); font-size:.9rem; }
.status-unknown {
    background: rgba(249,168,37,0.18);
    color: var(--warning);
}
.brand-logo {
    width: 165px;
    height: 75px;
    border-radius: 0px;
    object-fit: cover;
}
.logo-initial {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.3rem;
}
/* ----- estilos login ----- */
body.login {
    min-height: 100vh;
    background: #f4f6fb;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-family: 'Source Sans Pro', 'Segoe UI', sans-serif;
}

.login-card {
    width: 360px;
    background: #fff;
    padding: 2.2rem;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(31,45,61,.15);
    border: 1px solid rgba(222,228,243,.8);
    text-align: center;
}

.login-card img {
    width: 160px;
    margin-bottom: 1.2rem;
}

.login-card h1 {
    font-size: 1.4rem;
    margin-bottom: .2rem;
}

.login-card p {
    color: #6b7a8c;
    margin-bottom: 1.6rem;
}

.login-card .form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.login-card label {
    display:block;
    margin-bottom:.35rem;
    color:#6b7a8c;
    font-size:.9rem;
}

.login-card input {
    width: 100%;
    padding: .7rem .85rem;
    border-radius: 12px;
    border: 1px solid #dfe4f2;
    background:#fff;
}

.login-card .error-msg {
    background: rgba(229,57,53,.12);
    color: #e53935;
    padding: .5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: .9rem;
}

.login-card button {
    width: 100%;
}

.login-footer {
    margin-top: 1.5rem;
    font-size: .85rem;
    color: #9aa5b5;
}

.login-card img { max-height: 80px; object-fit: contain; }

.pill-warning {
    background: rgba(249,168,37,0.2);
    color: #b36a00;
}

.problem-list {
    list-style: none;
    margin-top: .8rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

.problem-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fafbff;
}

.problem-list li div {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.problem-list li small {
    color: var(--muted);
    font-size: .82rem;
}

.problem-list li.empty {
    justify-content: center;
    color: var(--muted);
}

.host-link {
    color: var(--primary);
    font-weight: 600;
}

.host-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.host-meta p {
    margin-top: .25rem;
}

.btn-back {
    font-weight: 600;
    padding: 0.55rem 1.1rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.metric-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 1.2rem;
    box-shadow: 0 10px 40px rgba(31,45,61,.08);
}

.metric-label {
    font-size: .9rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin: .4rem 0 0.2rem;
    color: var(--text);
}

.metric-card small {
    color: var(--muted);
}


.host-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.host-meta h2 {
    margin-bottom: .4rem;
}

.host-meta p {
    margin-top: .2rem;
}

.host-actions {
    margin-left: auto;
}

.btn-back {
    font-weight: 600;
    padding: 0.55rem 1.2rem;
}

.metrics-wrapper {
    padding: 1.2rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-card {
    background: #f9fbff;
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 1rem 1.2rem;
    box-shadow: 0 10px 30px rgba(31,45,61,.08);
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.metric-label {
    font-size: .85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

.metric-card small {
    color: var(--muted);
}

.alerts-list {
    list-style: none;
    margin-top: .8rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .8rem 1rem;
    background: #fff;
    box-shadow: 0 6px 20px rgba(31,45,61,.07);
}

.alert-title {
    font-weight: 600;
    color: var(--text);
}

.alert-host {
    color: var(--muted);
    font-size: .85rem;
}

.severity {
    padding: .35rem .9rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    color: #fff;
}

.sev-default  { background: #9aa5b5; }
.sev-info     { background: #007adf; }
.sev-warning  { background: #f9a825; }
.sev-average  { background: #f57c00; }
.sev-high     { background: #e53935; }
.sev-disaster { background: #c2185b; }

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.alert-group {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(31,45,61,.07);
}

.alert-group-header {
    width: 100%;
    background: none;
    border: none;
    padding: 0.9rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.alert-group-header .tag {
    font-size: .8rem;
    color: var(--muted);
    background: rgba(36,86,255,.1);
    padding: .2rem .6rem;
    border-radius: 999px;
    margin-left: 0.5rem;
}

.alert-group-header .chevron {
    transition: transform .2s ease;
}

.alert-group-header[data-open="true"] .chevron {
    transform: rotate(180deg);
}

.alert-group-body {
    padding: 0 1rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow: hidden;
    max-height: 0;
    transition: max-height .2s ease;
}

.alert-group-body .alert-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .75rem .9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fbff;
}

.card-footer {
    margin-top: 1rem;
    text-align: right;
}

.link-muted {
    color: var(--primary);
    font-weight: 600;
}
.refresh-indicator {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(36,86,255,.15);
    position: relative;
    font-size: .75rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    background:
        conic-gradient(var(--primary) calc(var(--progress, 0) * 1%), rgba(36,86,255,.1) 0) border-box;
    transition: background .2s linear;
}

.refresh-indicator::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #fff;
}

.refresh-label {
    position: absolute;
    top: 60px;
    width: 80px;
    text-align: center;
    font-size: .78rem;
    color: var(--muted);
}

.refresh-count {
    position: relative;
    z-index: 2;
}

.app-nav {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.app-nav__link {
    font-weight: 600;
    color: var(--muted);
    padding-bottom: 0.35rem;
    border-bottom: 3px solid transparent;
    transition: color .2s ease, border-color .2s ease;
}

.app-nav__link:hover {
    color: var(--primary);
}

.app-nav__link.is-active {
    color: var(--primary);
    border-color: var(--primary);
}

.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: flex-end;
}

.history-filters label span {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.filter-group input[type="date"] {
    padding: 0.45rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

.search-group {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-group input {
    width: 100%;
    padding: 0.55rem 2.4rem 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
    background: #fff;
}

.search-group .icon-search {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    fill: var(--muted);
    pointer-events: none;
}

#applyFilters {
    padding: 0.6rem 1.5rem;
    border-radius: 12px;
}

/* Vista NOC */
.noc-card {
    min-height: 70vh;
}
.noc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.noc-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.noc-grid {
    margin-top: 1.2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}
.noc-node {
    background: #11182a;
    border-radius: 18px;
    padding: 1.1rem;
    color: #e4eaf5;
    border: 2px solid rgba(255,255,255,0.06);
    box-shadow: 0 12px 35px rgba(12,18,32,0.35);
    transition: transform .2s, border-color .2s;
}
.noc-node:hover {
    transform: translateY(-4px);
}
.noc-node.ok {
    border-color: rgba(36,208,147,0.45);
    background: linear-gradient(145deg, #0e2218, #123426);
}
.noc-node.down {
    border-color: rgba(255,152,0,0.7);
    background: linear-gradient(145deg, #2c1510, #3b1f16);
}
.noc-node.problem {
    animation: borderPulse 1.5s infinite;
    will-change: transform, box-shadow;
}
.noc-node.card-warning  {
    border-color: rgba(255,168,37,0.75);
    background: linear-gradient(145deg, #3a1f0b, #4b2a11);
}
.noc-node.card-average  {
    border-color: rgba(255,179,0,0.75);
    background: linear-gradient(145deg, #3c250b, #4c3112);
}
.noc-node.card-high     {
    border-color: rgba(255,115,115,0.9);
    background: linear-gradient(145deg, #3a1014, #4b151b);
}
.noc-node.card-disaster {
    border-color: rgba(199,35,35,0.9);
    background: linear-gradient(145deg, #31090c, #410d12);
}
.has-detail { cursor: pointer; }
@keyframes borderPulse {
    0%   { transform: scale(1); box-shadow: 0 0 0 rgba(255,86,86,0); }
    50%  { transform: scale(1.03); box-shadow: 0 0 20px rgba(255,86,86,0.45); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(255,86,86,0); }
}
.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .6rem;
    margin-bottom: .5rem;
}
.node-header h3 { margin: 0; font-size: 1rem; }
.badge {
    padding: .25rem .75rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
}
.badge-ok {
    background: rgba(36,208,147,.2);
    color: #24d093;
}
.badge-down {
    background: rgba(255,152,0,.2);
    color: #ffb347;
}
.badge-problem {
    background: rgba(255,94,94,.24);
    color: #ff6670;
}
.node-name {
    font-size: .92rem;
    color: #c8cedd;
    margin-bottom: .45rem;
}
.node-issue {
    font-size: .85rem;
    color: #ffc1c6;
    background: rgba(255,255,255,0.08);
    padding: .5rem;
    border-radius: 10px;
    line-height: 1.35;
}

/* Modal */
.noc-modal {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 999;
}
.noc-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.noc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 11, 22, 0.55);
}
.noc-modal__content {
    position: relative;
    background: #151c2c;
    border-radius: 18px;
    padding: 1.5rem;
    width: min(420px, 90vw);
    color: #f5f7ff;
    box-shadow: 0 20px 60px rgba(7, 11, 22, 0.55);
    border: 1px solid rgba(255,255,255,0.08);
}
.noc-modal__body h3 {
    margin-bottom: .2rem;
}
.modal-subtitle {
    color: #aeb6cd;
    margin-bottom: 1rem;
}
.modal-detail {
    display: flex;
    justify-content: space-between;
    margin-bottom: .6rem;
}
.modal-detail .label {
    color: #9aa3bd;
    font-size: .9rem;
}
.modal-detail .value {
    font-weight: 600;
}
.noc-modal__close {
    position: absolute;
    top: .7rem;
    right: .9rem;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: #fff;
    cursor: pointer;
}

.noc-notify {
    position: fixed;
    top: 90px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 1000;
}

.noc-toast {
    min-width: 280px;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 10px 30px rgba(12,18,32,.35);
    opacity: 0;
    transform: translateX(20px);
    animation: toastIn .3s forwards;
}

.noc-toast--danger  { background: linear-gradient(120deg,#ff5b66,#c62828); }
.noc-toast--warning { background: linear-gradient(120deg,#ffb347,#ff9800); }
.noc-toast--success { background: linear-gradient(120deg,#30d88a,#15b36e); }
.noc-toast--info    { background: linear-gradient(120deg,#6f8cff,#4056d6); }

.noc-toast.is-hiding {
    animation: toastOut .4s forwards;
}

@keyframes toastIn {
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateX(20px); }
}

.filter-line {
    display:flex;
    flex-wrap:wrap;
    gap:1rem;
    align-items:flex-end;
}

.filter-line label span {
    display:block;
    font-size:.85rem;
    color:var(--muted);
    margin-bottom:.2rem;
}

.filter-line input[type="date"],
.filter-line select {
    padding:.55rem .9rem;
    border-radius:14px;
    border:1px solid var(--border);
    background:#fff;
}

.search-field {
    position:relative;
    flex:1;
    min-width:220px;
}
.search-field input {
    width:100%;
    padding:.55rem 2.3rem .55rem 1rem;
    border:1px solid var(--border);
    border-radius:999px;
}
.search-field svg {
    position:absolute;
    right:.8rem;
    top:50%;
    transform:translateY(-50%);
    width:1rem;
    height:1rem;
    fill:var(--muted);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .6rem;
}
.export-actions {
    display: flex;
    gap: .6rem;
}
.export-actions .btn {
    padding: .45rem 1rem;
    border-radius: 14px;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-grid label span {
    display: block;
    margin-bottom: .3rem;
    color: var(--muted);
    font-size: .9rem;
}

.form-grid input,
.form-grid select {
    width: 100%;
    padding: .55rem .85rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: .95rem;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: .8rem;
    justify-content: flex-start;
    margin-top: .5rem;
}