/* ═══════════════════════════════════════════════════════════════════
   MailMonitor — Design System & Component Styles
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
    /* Palette */
    --bg-body:        #0b0e14;
    --bg-surface:     #111520;
    --bg-card:        rgba(17, 21, 32, 0.85);
    --bg-card-hover:  rgba(22, 28, 42, 0.95);
    --bg-input:       #151926;
    --bg-modal:       #141825;

    --accent:         #00d4ff;
    --accent-dim:     rgba(0, 212, 255, 0.12);
    --accent-purple:  #7c5cff;
    --accent-gradient: linear-gradient(135deg, #00d4ff, #7c5cff);

    --text-primary:   #e2e6f0;
    --text-secondary: #6b7394;
    --text-muted:     #3d4463;

    --success:        #00e676;
    --success-dim:    rgba(0, 230, 118, 0.12);
    --warning:        #ffab00;
    --warning-dim:    rgba(255, 171, 0, 0.12);
    --danger:         #ff5252;
    --danger-dim:     rgba(255, 82, 82, 0.12);

    --border:         rgba(255, 255, 255, 0.06);
    --border-hover:   rgba(255, 255, 255, 0.1);
    --border-accent:  rgba(0, 212, 255, 0.3);

    --shadow-card:    0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-modal:   0 16px 64px rgba(0, 0, 0, 0.5);
    --shadow-glow:    0 0 20px rgba(0, 212, 255, 0.15);

    /* Typography */
    --font:           'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Sizing */
    --radius:         10px;
    --radius-lg:      14px;
    --radius-full:    9999px;
    --nav-height:     64px;
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* subtle grid noise background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.06), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(124, 92, 255, 0.04), transparent);
    pointer-events: none;
    z-index: 0;
}

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

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(11, 14, 20, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    z-index: 1000;
    gap: 2rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.nav-logo {
    width: 28px;
    height: 28px;
    color: var(--accent);
    filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.4));
}

.nav-title {
    font-weight: 700;
    font-size: 1.15rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-dim);
}

.nav-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-glow 2s infinite;
}

.status-dot.disconnected {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

.status-dot.waiting {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
    animation: pulse-glow 1.5s infinite;
}

.status-dot.error {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    animation: pulse-glow 1s infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.85); }
}

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
    position: relative;
    z-index: 1;
    padding: calc(var(--nav-height) + 2rem) 2rem 2rem;
    max-width: 1440px;
    margin: 0 auto;
}

/* ── Page Header ───────────────────────────────────────────────── */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* ── Server Card Grid ──────────────────────────────────────────── */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

.server-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.server-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-hostname {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Fira Code', monospace;
    margin-top: 0.15rem;
    display: block;
}

.card-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.status-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── SVG Gauges ────────────────────────────────────────────────── */
.card-gauges {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.gauge {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
}

.gauge-svg {
    width: 90px;
    height: 90px;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 7;
}

.gauge-fill {
    fill: none;
    stroke: var(--success);
    stroke-width: 7;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                stroke 0.4s ease;
    filter: drop-shadow(0 0 4px currentColor);
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% - 6px));
    text-align: center;
    pointer-events: none;
}

.gauge-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.gauge-unit {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.gauge-label {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

/* ── Card Details ──────────────────────────────────────────────── */
.card-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 1px solid var(--border);
    padding-top: 0.9rem;
    margin-bottom: 0.75rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
}

/* ── Mount Points ──────────────────────────────────────────────── */
.card-mounts {
    border-top: 1px solid var(--border);
    padding-top: 0.9rem;
    margin-top: 0.5rem;
}

.mounts-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.mount-item {
    margin-bottom: 0.6rem;
}

.mount-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.mount-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
}

.mount-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--success);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.4s ease;
    box-shadow: 0 0 6px currentColor;
}

.mount-detail {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 0.2rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Card Footer ───────────────────────────────────────────────── */
.card-footer {
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
    margin-top: 0.75rem;
}

.card-timestamp {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.empty-state h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.95rem;
}

/* ── Dashboard Section Title ───────────────────────────────────── */
.dash-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ── Mount Point standalone card ───────────────────────────────── */
.mp-server-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--accent);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}



/* ── DB Card extras ────────────────────────────────────────────── */
.db-card-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Hero storage metric */
.db-hero {
    display: flex;
    justify-content: center;
    padding: 0.75rem 0 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}

.db-hero-metric {
    text-align: center;
}

.db-metric-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.db-metric-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Connection row */
.db-section {
    margin-bottom: 0.85rem;
}

.db-conn-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.db-conn-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.db-conn-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Top tables */
.db-tables-section {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.db-table-item {
    margin-bottom: 0.55rem;
}

.db-table-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.1rem;
}

.db-table-name {
    font-size: 0.78rem;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Fira Code', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.db-table-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}



/* ── Tabs ──────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-badge {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Section Actions ───────────────────────────────────────────── */
.section-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* ── Data Table ────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table thead th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.cell-name {
    font-weight: 600;
}

.cell-mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
}

.cell-empty {
    padding: 2rem 1rem !important;
    text-align: center;
    color: var(--text-secondary);
}

.cell-actions {
    white-space: nowrap;
    display: flex;
    gap: 0.3rem;
}

.cell-monitors {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.monitor-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--accent);
}

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    text-transform: capitalize;
}

.badge-active   { background: var(--success-dim); color: var(--success); }
.badge-inactive { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
.badge-key      { background: rgba(124, 92, 255, 0.12); color: var(--accent-purple); }
.badge-password { background: var(--accent-dim); color: var(--accent); }

/* DB type badges */
.badge-dbtype { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.68rem; }
.badge-dbtype-postgresql { background: rgba(51, 153, 255, 0.15); color: #3399ff; }
.badge-dbtype-mysql      { background: rgba(255, 149, 0,  0.15); color: #ff9500; }
.badge-dbtype-mariadb    { background: rgba(198, 70,  53,  0.15); color: #e05c47; }

/* Live stat cells in DB table */
.stat-placeholder { color: var(--text-muted); font-size: 0.82rem; }
.stat-value       { font-size: 0.86rem; font-weight: 600; color: var(--text-primary); }
.stat-value small { font-weight: 400; color: var(--text-secondary); font-size: 0.78rem; }


/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #000;
    box-shadow: 0 2px 12px rgba(0, 212, 255, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #ff6b6b;
    box-shadow: 0 4px 16px rgba(255, 82, 82, 0.3);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.btn-edit:hover  { color: var(--accent); }
.btn-delete:hover { color: var(--danger); }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    padding: 1.75rem;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-sm {
    max-width: 420px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close:hover {
    color: var(--danger);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.modal-footer-right {
    display: flex;
    gap: 0.5rem;
}

.confirm-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ── Forms ──────────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-full {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7394' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 2rem;
}

.form-group select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.form-field-hint {
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.form-section-title {

    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.form-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-primary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ── Toast Notifications ───────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + 1rem);
    right: 1.5rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1),
               toastOut 0.3s ease 3s forwards;
    max-width: 360px;
}

.toast-success {
    background: rgba(0, 230, 118, 0.15);
    border: 1px solid rgba(0, 230, 118, 0.3);
    color: var(--success);
}

.toast-error {
    background: rgba(255, 82, 82, 0.15);
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: var(--danger);
}

.toast-info {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--accent);
}

.toast-warning {
    background: rgba(255, 171, 0, 0.15);
    border: 1px solid rgba(255, 171, 0, 0.3);
    color: var(--warning);
}

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

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

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════
   Responsive Breakpoints
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tablet and below (≤ 1024px) ───────────────────────────────── */
@media (max-width: 1024px) {
    .navbar { gap: 1.25rem; }
    .servers-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

/* ── Phone landscape / small tablet (≤ 768px) ──────────────────── */
@media (max-width: 768px) {
    /* Navbar: compact */
    .navbar {
        padding: 0 0.75rem;
        gap: 0.6rem;
        height: 56px;
        --nav-height: 56px;
    }
    .nav-title { display: none; }
    .nav-username { display: none; }
    .nav-link {
        padding: 0.45rem 0.65rem;
        font-size: 0.82rem;
    }
    .status-text { display: none; }

    /* Main layout */
    .main-content {
        padding: calc(var(--nav-height, 56px) + 1rem) 0.75rem 1rem;
    }

    /* Page header */
    .page-title { font-size: 1.4rem; }
    .page-subtitle { font-size: 0.85rem; }

    /* Cards grid */
    .servers-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .server-card { padding: 1.15rem; }
    .card-gauges { gap: 0.75rem; }

    /* Forms */
    .form-grid { grid-template-columns: 1fr; }

    /* Modals: nearly full-screen */
    .modal {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
        padding: 1.25rem;
        border-radius: var(--radius);
    }
    .modal-sm { max-width: 100%; }
    .modal-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
    .modal-footer-right {
        width: 100%;
        justify-content: flex-end;
    }
    .modal-footer > .btn {
        width: 100%;
        justify-content: center;
    }

    /* Tables */
    .data-table { font-size: 0.8rem; }
    .data-table thead th { padding: 0.65rem 0.6rem; font-size: 0.68rem; }
    .data-table tbody td { padding: 0.6rem 0.6rem; }
    .col-hide-tablet { display: none; }

    /* Tabs */
    .tabs { gap: 0; }
    .tab { padding: 0.65rem 0.75rem; font-size: 0.82rem; }
    .tab svg { width: 16px; height: 16px; }

    /* Toasts */
    .toast-container {
        right: 0.5rem;
        left: 0.5rem;
        top: calc(var(--nav-height, 56px) + 0.5rem);
    }
    .toast { max-width: 100%; }

    /* Login */
    .login-card { margin: 0.75rem; padding: 2rem 1.5rem; }
    .login-wrapper { padding: 1rem; }
}

/* ── Phone portrait (≤ 480px) ──────────────────────────────────── */
@media (max-width: 480px) {
    /* Navbar: icon-only nav links */
    .nav-link span,
    .nav-link-text { display: none; }
    .nav-link {
        padding: 0.4rem;
        font-size: 0;   /* hide remaining text nodes */
    }
    .nav-link svg { width: 20px; height: 20px; }
    .nav-user { margin-left: 0.4rem; padding-left: 0.4rem; }

    /* Page header */
    .page-title { font-size: 1.2rem; }

    /* Gauges: scale down */
    .gauge { width: 80px; }
    .gauge-svg { width: 72px; height: 72px; }
    .gauge-value { font-size: 1.1rem; }
    .gauge-unit { font-size: 0.55rem; }
    .gauge-label { font-size: 0.65rem; }
    .card-gauges { gap: 0.5rem; }

    /* Cards */
    .server-card { padding: 1rem; }
    .card-title { font-size: 1rem; }
    .card-hostname { font-size: 0.72rem; }
    .detail-value { font-size: 0.72rem; }
    .mount-detail { font-size: 0.65rem; }

    /* Modal: full-width */
    .modal {
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        min-height: 100vh;
    }

    /* Section actions */
    .section-actions { margin-bottom: 0.75rem; }
    .btn { padding: 0.5rem 0.9rem; font-size: 0.82rem; }

    /* Table: tighter + hide columns */
    .data-table thead th { padding: 0.5rem 0.4rem; }
    .data-table tbody td { padding: 0.5rem 0.4rem; }
    .cell-monitors { gap: 0.2rem; }
    .monitor-tag { font-size: 0.62rem; padding: 0.1rem 0.3rem; }
    .col-hide-phone { display: none; }

    /* Login */
    .login-card { padding: 1.75rem 1.25rem; }
    .login-logo { width: 40px; height: 40px; }
    .login-title { font-size: 1.3rem; }
}

/* ── Touch-friendly overrides ──────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets */
    .btn-icon { width: 40px; height: 40px; }
    .checkbox-label { padding: 0.25rem 0; }
    .checkbox-label input[type="checkbox"] { width: 20px; height: 20px; }
    .tab { min-height: 44px; }
    .nav-link { min-height: 40px; }
}

/* ── Nav User / Logout ─────────────────────────────────────────── */
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border);
}

.nav-username {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-logout {
    padding: 0.4rem !important;
}

.nav-logout:hover {
    color: var(--danger) !important;
    background: var(--danger-dim) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   Login Page
   ═══════════════════════════════════════════════════════════════════ */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-card {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-modal);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Brand ──────────────────────────────────────────────────────── */
.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 48px;
    height: 48px;
    color: var(--accent);
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.5));
    margin-bottom: 0.75rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* ── Error Alert ────────────────────────────────────────────────── */
.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius);
    background: var(--danger-dim);
    border: 1px solid rgba(255, 82, 82, 0.25);
    color: var(--danger);
    font-size: 0.88rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

/* ── Form ───────────────────────────────────────────────────────── */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.login-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.input-icon-wrapper input {
    width: 100%;
    padding: 0.7rem 0.8rem 0.7rem 2.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.input-icon-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.input-icon-wrapper input:focus ~ .input-icon,
.input-icon-wrapper:focus-within .input-icon {
    color: var(--accent);
}

.input-icon-wrapper input::placeholder {
    color: var(--text-muted);
}

/* ── Submit Button ──────────────────────────────────────────────── */
.login-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.2rem;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.login-footer {
    margin-top: 1.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

