/* ============================================================
   Server Monitor Dashboard — Responsive Mobile-First Stylesheet
   ============================================================ */

/* ---- Reset & Base ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #0f1117;
    --bg-card:     #1a1d27;
    --bg-input:    #22263a;
    --border:      #2c3050;
    --text:        #e2e8f0;
    --text-muted:  #64748b;
    --primary:     #4f8ef7;
    --primary-dk:  #3a73d8;
    --success:     #22c55e;
    --danger:      #ef4444;
    --warning:     #f59e0b;
    --radius:      8px;
    --shadow:      0 2px 12px rgba(0,0,0,0.4);
    --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

body.light-mode {
    --bg:          #f1f5f9;
    --bg-card:     #ffffff;
    --bg-input:    #f8fafc;
    --border:      #e2e8f0;
    --text:        #0f172a;
    --text-muted:  #4b5563;
    --primary:     #2563eb;
    --primary-dk:  #1d4ed8;
    --success:     #16a34a;
    --warning:     #b45309;
    --danger:      #dc2626;
    --shadow:      0 2px 12px rgba(0,0,0,0.08);
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ---- Navbar ---------------------------------------------- */
.navbar {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    height: 52px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 0.75rem;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}
.navbar-nav {
    display: flex;
    list-style: none;
    gap: 0.15rem;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.navbar-nav::-webkit-scrollbar { display: none; }
.navbar-nav li a {
    display: block;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.navbar-nav li a:hover,
.navbar-nav li.active a {
    background: var(--bg-input);
    color: var(--text);
    text-decoration: none;
}
.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.navbar-username {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: none; /* hidden on mobile, shown on larger screens */
}

/* ---- Theme toggle ---------------------------------------- */
.theme-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.theme-toggle:hover { color: var(--text); background: var(--border); }

/* ---- Layout ---------------------------------------------- */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.page-header h2 { font-size: 1.25rem; font-weight: 700; }

/* ---- Buttons --------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.9rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
    background: var(--bg-input);
    color: var(--text);
    line-height: 1.4;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary-dk); }
.btn-secondary { background: var(--bg-input); border-color: var(--border); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-block     { width: 100%; justify-content: center; }
.btn-sm        { padding: 0.25rem 0.65rem; font-size: 0.8rem; }
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.35rem;
    border-radius: 6px;
    color: var(--text-muted);
    line-height: 1;
    transition: background 0.13s, color 0.13s;
}
.btn-icon:hover { background: var(--bg-input); color: var(--text); opacity: 1; }
.btn-icon.btn-icon-del:hover { background: rgba(239,68,68,0.12); color: var(--danger); }

/* ---- Alerts ---------------------------------------------- */
.alert {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border-left: 4px solid transparent;
}
.alert p { margin: 0.1rem 0; }
.alert-error   { background: rgba(239,68,68,0.12);  border-color: var(--danger);  color: var(--danger); }
.alert-success { background: rgba(34,197,94,0.12);  border-color: var(--success); color: var(--success); }
.alert-warning { background: rgba(245,158,11,0.12); border-color: var(--warning); color: var(--warning); }

/* ---- Status dots ----------------------------------------- */
.status-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-up      { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot-down    { background: var(--danger);  box-shadow: 0 0 6px var(--danger); animation: pulse-down 1.5s infinite; }
.dot-unknown { background: var(--text-muted); }

@keyframes pulse-down {
    0%, 100% { box-shadow: 0 0 4px var(--danger); }
    50%       { box-shadow: 0 0 10px var(--danger); }
}

.status-text    { font-weight: 600; font-size: 0.82rem; }
.status-up      { color: var(--success); }
.status-down    { color: var(--danger); }
.status-unknown { color: var(--text-muted); }

/* ---- Filter bar ------------------------------------------ */
.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Status tabs — primary filter */
.status-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    flex: 1;
}
.status-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    user-select: none;
}
.status-tab:hover { color: var(--text); border-color: var(--text-muted); }
.status-tab .tab-count {
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-input);
    border-radius: 999px;
    padding: 0 0.4rem;
    min-width: 1.4em;
    text-align: center;
    transition: background 0.15s;
}

/* Active states per status */
.status-tab.active[data-status="all"] {
    border-color: var(--primary);
    color: var(--primary);
}
.status-tab.active[data-status="all"] .tab-count {
    background: var(--primary);
    color: #fff;
}
.status-tab.active[data-status="up"] {
    border-color: var(--success);
    color: var(--success);
}
.status-tab.active[data-status="up"] .tab-count {
    background: var(--success);
    color: #fff;
}
.status-tab.active[data-status="down"] {
    border-color: var(--danger);
    color: var(--danger);
}
.status-tab.active[data-status="down"] .tab-count {
    background: var(--danger);
    color: #fff;
}
.status-tab.active[data-status="unknown"] {
    border-color: var(--text-muted);
    color: var(--text);
}
.status-tab.active[data-status="unknown"] .tab-count {
    background: var(--text-muted);
    color: #fff;
}

/* Provider dropdown — supplementary filter */
.filter-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}
.provider-select-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.provider-select-wrap label {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.provider-select {
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.82rem;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
    max-width: 160px;
}
.provider-select:focus,
.provider-select.active { border-color: var(--primary); }

/* ---- Summary bar ----------------------------------------- */
.summary-bar {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 90px;
}
.summary-card.success { border-color: var(--success); }
.summary-card.danger  { border-color: var(--danger); }
.summary-card.muted   { border-color: var(--border); }
.summary-num   { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.summary-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- Provider groups ------------------------------------- */
.provider-section { margin-bottom: 1.75rem; }
.provider-section[data-hidden="1"] { display: none; }
.provider-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

/* ---- Server grid — mobile first -------------------------- */
.server-grid {
    display: grid;
    grid-template-columns: 1fr;               /* 1 col on phones */
    gap: 0.65rem;
}

/* ---- Server card ----------------------------------------- */
.server-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.1s;
    display: flex;
    flex-direction: column;
}
.server-card:hover {
    transform: translateY(-1px);
    background: var(--bg-input);
    border-color: var(--border);
}
.server-card.status-up      { border-left-color: var(--success); }
.server-card.status-down    { border-left-color: var(--danger); }
.server-card.status-unknown { border-left-color: var(--text-muted); }

/* Highlight down cards */
.server-card.status-down { background: rgba(239,68,68,0.04); }

.server-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.server-name {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-actions { display: flex; gap: 0.15rem; flex-shrink: 0; }

.server-card-body {
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}
.server-meta {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.83rem;
    min-width: 0;
}
.meta-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
    width: 58px;
    text-align: right;
}
.meta-value {
    flex: 1;
    min-width: 0;
    word-break: break-all;        /* long hostnames/IPs wrap instead of overflow */
    overflow-wrap: anywhere;
}
.server-notes .meta-value {
    color: var(--text-muted);
    font-size: 0.8rem;
    word-break: break-word;
}

.server-card-footer {
    padding: 0.45rem 0.75rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.08);
}
body.light-mode .server-card-footer { background: rgba(0,0,0,0.03); }

/* ---- Forms ----------------------------------------------- */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    width: 100%;
    max-width: 680px;
}
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color 0.15s;
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; }
.form-row { display: flex; flex-direction: column; gap: 0; }
.form-actions { display: flex; gap: 0.65rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }

/* ---- Tables ---------------------------------------------- */
.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; -webkit-overflow-scrolling: touch; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    min-width: 480px;
}
.data-table th, .data-table td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
.data-table th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
.data-table tr:hover td { background: rgba(255,255,255,0.055); }
body.light-mode .data-table tr:hover td { background: rgba(0,0,0,0.04); }
.row-inactive td {
    color: var(--text-muted);
}
.action-cell { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.muted-text { color: var(--text-muted); font-size: 0.82rem; }

/* ---- Badges ---------------------------------------------- */
.badge {
    display: inline-block;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-admin    { background: rgba(79,142,247,0.15);  color: var(--primary); }
.badge-operator { background: rgba(139,92,246,0.15);  color: #8b5cf6; }
.badge-user     { background: rgba(100,116,139,0.15); color: var(--text-muted); }
body.light-mode .badge-admin    { background: rgba(37,99,235,0.1);   color: var(--primary); }
body.light-mode .badge-operator { background: rgba(109,40,217,0.1);  color: #6d28d9; }
body.light-mode .badge-user     { background: rgba(75,85,99,0.12);   color: var(--text-muted); }

/* ---- Login page ------------------------------------------ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}
.login-logo h1 { font-size: 1.2rem; font-weight: 700; }

/* ---- Misc ------------------------------------------------ */
.empty-state  { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.meta-strip   { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.section-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 1.25rem 0 0.65rem; }
.pagination   { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 1rem; }
.page-btn     { padding: 0.3rem 0.7rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem; color: var(--text); }
.page-btn:hover { border-color: var(--primary); text-decoration: none; }
.page-current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Footer ---------------------------------------------- */
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
}
.footer-center {
    text-align: center;
    flex: 1;
}
.footer-center strong { color: var(--text); }

/* ---- No-results state ------------------------------------ */
.filter-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: none;
}
.filter-empty.visible { display: block; }

/* =============================================================
   MANAGE SERVERS PAGE
   ============================================================= */

.manage-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

/* Search */
.manage-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    padding: 0.28rem 0.75rem;
    flex: 1;
    min-width: 160px;
    max-width: 280px;
    transition: border-color 0.15s;
}
.manage-search-wrap:focus-within { border-color: var(--primary); }
.search-icon { font-size: 0.85rem; color: var(--text-muted); flex-shrink: 0; }
.manage-search {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 0.82rem;
    width: 100%;
    font-family: var(--font);
}
.manage-search::placeholder { color: var(--text-muted); }

/* Active state tabs */
.active-tabs {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
}
.active-tab {
    padding: 0.28rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    border-right: 1px solid var(--border);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    user-select: none;
}
.active-tab:last-child { border-right: none; }
.active-tab:hover  { color: var(--text); background: var(--bg-input); }
.active-tab.active { background: var(--primary); color: #fff; font-weight: 600; }

/* Stats row */
.manage-stats {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}
.manage-stats span { font-weight: 700; color: var(--text); }

/* Table column sizing */
.manage-table { min-width: 700px; }
.manage-table .col-status    { width: 44px; text-align: center; }
.manage-table .col-name      { min-width: 150px; max-width: 220px; }
.manage-table .col-ip        { min-width: 140px; max-width: 200px; }
.manage-table .col-provider  { min-width: 90px; }
.manage-table .col-uptime    { min-width: 110px; }
.manage-table .col-lastcheck { min-width: 110px; }
.manage-table .col-active    { width: 90px; text-align: center; }
.manage-table .col-actions   { width: 88px; text-align: center; }

/* IP / host address — truncate with ellipsis, full value on hover */
.ip-host {
    display: block;
    font-size: 0.82rem;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.ip-port {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    white-space: nowrap;
}

/* Server name cell */
.srv-name-wrap {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.srv-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-notes-tip {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
    cursor: help;
    line-height: 1;
}
.srv-region-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Inactive row dimming */
.row-inactive-server td { color: var(--text-muted); }
.row-inactive-server .status-dot { opacity: 0.45; }

/* Active toggle button */
.toggle-active-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1.5px solid transparent;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.toggle-active-btn.is-active {
    background: rgba(34,197,94,0.12);
    border-color: var(--success);
    color: var(--success);
}
.toggle-active-btn.is-active:hover {
    background: rgba(239,68,68,0.12);
    border-color: var(--danger);
    color: var(--danger);
}
.toggle-active-btn.is-inactive {
    background: rgba(100,116,139,0.1);
    border-color: var(--text-muted);
    color: var(--text-muted);
}
.toggle-active-btn.is-inactive:hover {
    background: rgba(34,197,94,0.12);
    border-color: var(--success);
    color: var(--success);
}

/* Checkbox label in form */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text);
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ---- SSL badge ------------------------------------------- */
.ssl-badge {
    display: inline-block;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: default;
}
.ssl-ok      { background: rgba(34,197,94,0.15);  color: var(--success); }
.ssl-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.ssl-expired { background: rgba(239,68,68,0.15);  color: var(--danger);  }
.ssl-unknown { background: rgba(100,116,139,0.1); color: var(--text-muted); }

/* SSL and Type columns */
.manage-table .col-ssl  { width: 68px; text-align: center; }
.manage-table .col-type { width: 60px; text-align: center; }

/* ---- Check-type badge ------------------------------------ */
/* Small pill shown on server cards and in the manage table  */
.check-type-badge {
    display: inline-block;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
    cursor: default;
}
.check-type-http { background: rgba(79,142,247,0.15); color: var(--primary); }
.check-type-tcp  { background: rgba(139,92,246,0.15);  color: #8b5cf6; }
body.light-mode .check-type-tcp { background: rgba(109,40,217,0.1); color: #6d28d9; }

/* Type column width defined with SSL above */

/* ---- Check-type filter tabs (dashboard + servers) -------- */
/* Reuses the same pill style as .active-tabs but wired to    */
/* a different data attribute.                                 */
.check-type-tabs {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
}
.check-type-tab {
    padding: 0.28rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    border-right: 1px solid var(--border);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    user-select: none;
}
.check-type-tab:last-child { border-right: none; }
.check-type-tab:hover  { color: var(--text); background: var(--bg-input); }
.check-type-tab.active { background: var(--primary); color: #fff; font-weight: 600; }

/* Manage Servers pagination */
.manage-pagination { margin-top: 1rem; }
.page-ellipsis     { padding: 0.3rem 0.25rem; color: var(--text-muted); font-size: 0.85rem; }
.manage-page-info  { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.4rem; text-align: right; }

/* =============================================================
   NOTIFICATION STYLES
   ============================================================= */

/* ---- Bell button ----------------------------------------- */
.bell-wrap     { position: relative; }
.bell-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius);
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
}
.bell-btn:hover { background: var(--bg-input); color: var(--text); }
.bell-badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(40%, -40%);
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 1.45em;
    height: 1.45em;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.3em;
    line-height: 1;
    letter-spacing: 0;
    border: 2px solid var(--bg-card);
    pointer-events: none;
}

/* ---- Dropdown panel -------------------------------------- */
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 1rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 200;
    overflow: hidden;
    flex-direction: column;
}
.notif-dropdown.is-open { display: flex; }

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.notif-dropdown-title {
    font-weight: 700;
    font-size: 0.88rem;
}
.notif-view-all {
    font-size: 0.78rem;
    color: var(--primary);
}

.notif-dropdown-body {
    overflow-y: auto;
    max-height: 320px;
    flex: 1;
}
.notif-dropdown-empty {
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Drop items */
.notif-drop-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background 0.12s;
    cursor: pointer;
}
.notif-drop-item:last-child { border-bottom: none; }
.notif-drop-item:hover      { background: var(--bg-input); text-decoration: none; }
.notif-drop-item.severity-critical { border-left: 3px solid var(--danger); }
.notif-drop-item.severity-warning  { border-left: 3px solid var(--warning); }
.notif-drop-item.severity-resolved { border-left: 3px solid var(--success); }

/* notif-drop-icon defined in icon system block below */
.notif-drop-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.notif-drop-msg  { font-size: 0.82rem; line-height: 1.4; }
.notif-drop-meta { font-size: 0.73rem; color: var(--text-muted); }

.notif-dropdown-footer {
    padding: 0.5rem 0.9rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.notif-mark-all { width: 100%; justify-content: center; }

/* ---- Notification centre page ---------------------------- */
.notif-page-badge {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.notif-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}
.notif-filter-btn {
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.notif-filter-btn:hover { color: var(--text); border-color: var(--text-muted); }
.notif-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary-dk);
    color: #fff;
    font-weight: 600;
}

/* Notification list */
.notif-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: var(--radius);
    transition: background 0.15s;
}
.notif-item.is-unread    { background: var(--bg-card); }
.notif-item.is-read      { background: transparent; color: var(--text-muted); }
.notif-item:hover        { background: var(--bg-input); }

.notif-item.severity-critical { border-left-color: var(--danger); }
.notif-item.severity-warning  { border-left-color: var(--warning); }
.notif-item.severity-resolved { border-left-color: var(--success); }
.notif-item.is-unread.severity-critical { background: rgba(239,68,68,0.07); }
.notif-item.is-unread.severity-warning  { background: rgba(245,158,11,0.07); }
.notif-item.is-unread.severity-resolved { background: rgba(34,197,94,0.07); }
body.light-mode .notif-item.is-unread.severity-critical { background: rgba(220,38,38,0.08); }
body.light-mode .notif-item.is-unread.severity-warning  { background: rgba(180,83,9,0.08); }
body.light-mode .notif-item.is-unread.severity-resolved { background: rgba(22,163,74,0.08); }

/* notif-icon defined in icon system block below */

.notif-body  { flex: 1; min-width: 0; }
.notif-message {
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 0.3rem;
    word-break: break-word;
}
.notif-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.notif-server a { color: var(--primary); }
.notif-resolved-tag {
    background: rgba(34,197,94,0.15);
    color: var(--success);
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.notif-actions { flex-shrink: 0; display: flex; align-items: center; }
/* notif-read-tick defined in icon system block below */

/* ---- Mobile adjustments ---------------------------------- */
@media (max-width: 480px) {
    .notif-dropdown {
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .notif-dropdown-body { max-height: 60vh; }
    .theme-label { display: none; }
}

   ============================================================= */

/* Small phones → 2 columns at 480px */
@media (min-width: 480px) {
    .server-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablets / large phones landscape → navbar username visible */
@media (min-width: 640px) {
    .navbar { padding: 0 1.25rem; }
    .navbar-username { display: inline; }
    .container { padding: 1.25rem; }
    .form-row { flex-direction: row; gap: 1rem; }
    .form-group-sm { max-width: 120px; flex: 0 0 120px !important; }
    .summary-card { padding: 0.75rem 1.25rem; }
    .summary-num  { font-size: 1.9rem; }
}

/* Small laptops → 3 columns */
@media (min-width: 900px) {
    .server-grid { grid-template-columns: repeat(3, 1fr); }
    .container { padding: 1.5rem 1.25rem; }
}

/* Large screens → 4 columns */
@media (min-width: 1200px) {
    .server-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Very wide → 5 columns */
@media (min-width: 1600px) {
    .server-grid { grid-template-columns: repeat(5, 1fr); }
}

/* =============================================================
   MANAGE TABLE — STICKY COLUMNS & ROW INTERACTIONS
   ============================================================= */

/* Sticky first two columns (Status + Name) and last (Actions) */
.manage-table .sticky-col {
    position: sticky;
    z-index: 2;
    background: var(--bg-card);
}
.manage-table tr:hover .sticky-col {
    background: var(--bg-input);
}
body.light-mode .manage-table tr:hover .sticky-col {
    background: rgba(0,0,0,0.04);
}
.manage-table thead .sticky-col { z-index: 3; background: var(--bg-card); }
.manage-table .sticky-col-1       { left: 0; }
.manage-table .sticky-col-2       { left: 44px; box-shadow: 2px 0 6px -2px rgba(0,0,0,0.3); }
.manage-table .sticky-col-actions { right: 0;   box-shadow: -2px 0 6px -2px rgba(0,0,0,0.3); }

body.light-mode .manage-table .sticky-col-2       { box-shadow: 2px 0 6px -2px rgba(0,0,0,0.12); }
body.light-mode .manage-table .sticky-col-actions { box-shadow: -2px 0 6px -2px rgba(0,0,0,0.12); }

/* Clickable row cursor — only on tbody rows that have an edit URL */
.manage-table tbody .srv-row[data-edit-url] { cursor: pointer; }

/* Inactive row — keep sticky cols readable */
.row-inactive-server .sticky-col { opacity: 1 !important; }
.row-inactive-server .sticky-col .status-dot { opacity: 0.45; }

/* ── Icon action buttons ─────────────────────────────────────── */
.action-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}
.btn-icon-tbl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    text-decoration: none;
    padding: 0;
    line-height: 1;
}
.btn-icon-tbl:hover {
    background: var(--bg-input);
    color: var(--text);
    text-decoration: none;
    opacity: 1;
}
.btn-icon-tbl.btn-icon-danger:hover {
    background: rgba(239,68,68,0.15);
    color: var(--danger);
}

/* =============================================================
   ICON SYSTEM — Inline SVG (no CDN)
   ============================================================= */

/* Base SVG icon — inherits color, sized like text */
.svg-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    flex-shrink: 0;
    fill: currentColor;
}

/* Severity icon colors */
.severity-icon-critical { color: var(--danger);  }
.severity-icon-warning  { color: var(--warning); }
.severity-icon-resolved { color: var(--success); }

/* Theme toggle icon */
.theme-icon { font-size: 0.95rem; }
#themeIcon { display: inline-flex; align-items: center; }
#themeIcon .svg-icon { width: 0.95rem; height: 0.95rem; }

/* Bell icon */
.bell-icon .svg-icon { width: 1.05rem; height: 1.05rem; }

/* Notification icons */
.notif-icon { display: inline-flex; flex-shrink: 0; margin-top: 3px; }
.notif-icon .svg-icon { width: 1.1rem; height: 1.1rem; }
.notif-drop-icon { display: inline-flex; flex-shrink: 0; }
.notif-drop-icon .svg-icon { width: 0.9rem; height: 0.9rem; }

/* Mark-as-read button */
.notif-mark-read-btn {
    padding: 0.2rem 0.45rem;
    font-size: 0.85rem;
    line-height: 1;
}
.notif-mark-read-btn:hover {
    background: rgba(34,197,94,0.15);
    color: var(--success);
    border-color: var(--success);
    opacity: 1;
}

/* Read tick */
.notif-read-tick {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.2rem 0.45rem;
    display: inline-flex;
    align-items: center;
}

/* Search icon */
.search-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    line-height: 1;
}
