:root {
    --bg: #0b0f19;
    --bg-card: #121826;
    --bg-card-hover: #1a2235;
    --border: #2a3548;
    --text: #e8edf5;
    --text-muted: #8b9bb4;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0,0,0,.4);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.bg-pattern {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59,130,246,.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(16,185,129,.08), transparent);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.container-narrow { max-width: 420px; padding-top: 4rem; }
.container-wide { max-width: 1100px; }

.hero { text-align: center; margin-bottom: 2rem; }
.logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    border-radius: 14px;
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(59,130,246,.35);
}
.hero h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.subtitle { color: var(--text-muted); font-size: .95rem; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.card-header h2 { font-size: 1.15rem; font-weight: 600; }

.badge {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .25rem .6rem;
    border-radius: 6px;
}
.badge-port { background: rgba(59,130,246,.2); color: #93c5fd; }
.badge-secure { background: rgba(16,185,129,.2); color: #6ee7b7; }

.detected-ip {
    background: rgba(59,130,246,.08);
    border: 1px dashed rgba(59,130,246,.3);
    border-radius: 8px;
    padding: .875rem 1rem;
    margin-bottom: 1.25rem;
}
.detected-ip .label { display: block; font-size: .75rem; color: var(--text-muted); margin-bottom: .25rem; }
.detected-ip code { font-size: 1.1rem; color: #93c5fd; }

.form .field { margin-bottom: 1rem; }
.form label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; color: var(--text-muted); }
.form input[type=text],
.form input[type=email],
.form input[type=password],
.form textarea,
.form select {
    width: 100%;
    padding: .65rem .875rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .95rem;
    transition: border-color .2s;
}
.form input:focus, .form textarea:focus, .form select:focus {
    outline: none;
    border-color: var(--primary);
}
.form small { display: block; margin-top: .25rem; font-size: .75rem; color: var(--text-muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .65rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #111; }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }

.alert {
    padding: .875rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: .9rem;
}
.alert-success { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.3); color: #6ee7b7; }
.alert-error { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 600px) { .info-grid { grid-template-columns: 1fr; } }

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.info-card h3 { font-size: .95rem; margin-bottom: .75rem; color: #93c5fd; }
.info-card ol { padding-left: 1.25rem; font-size: .85rem; color: var(--text-muted); }
.info-card ol li { margin-bottom: .35rem; }
.info-card p { font-size: .85rem; color: var(--text-muted); }

.footer { text-align: center; margin-top: 2rem; font-size: .8rem; color: var(--text-muted); }

/* Admin */
.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.admin-header h1 { font-size: 1.5rem; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.stat-num { display: block; font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: .65rem .75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; }
td code { background: rgba(59,130,246,.12); padding: .15rem .4rem; border-radius: 4px; font-size: .85rem; }

.actions { min-width: 280px; }
.inline-form { display: inline-flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .25rem; }
.input-sm, .select-sm { width: auto !important; padding: .35rem .5rem !important; font-size: .8rem !important; }

.empty { color: var(--text-muted); font-size: .9rem; padding: .5rem 0; }

.status { font-size: .75rem; font-weight: 600; padding: .2rem .5rem; border-radius: 4px; text-transform: uppercase; }
.status-pending { background: rgba(245,158,11,.2); color: #fcd34d; }
.status-approved { background: rgba(16,185,129,.2); color: #6ee7b7; }
.status-denied { background: rgba(239,68,68,.2); color: #fca5a5; }
.status-revoked { background: rgba(139,155,180,.2); color: #94a3b8; }
.status-expired { background: rgba(139,155,180,.2); color: #64748b; }

.info-card ul.port-list { list-style: none; padding: 0; font-size: .85rem; color: var(--text-muted); }
.info-card ul.port-list li { padding: .25rem 0; }
.inline-port-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
