/* --- Reset + podstawy --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    background: #0b1020;
    color: #e5e7eb;
    min-height: 100vh;
}
a { color: #8ab4ff; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: "JetBrains Mono", "SF Mono", Consolas, monospace; font-size: 0.9em; }

/* --- Login (full-bleed + aurora) --- */
.login-page {
    overflow: hidden;
    background: #070a17;
}
.login-stage {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    isolation: isolate;
    padding: 2rem 1rem;
}
.login-stage > .grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(125,211,252,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(125,211,252,0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
    z-index: -3;
}
.aurora {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    z-index: -2;
    animation: drift 18s ease-in-out infinite alternate;
}
.aurora-1 { width: 520px; height: 520px; background: #3b82f6; top: -180px; left: -120px; }
.aurora-2 { width: 420px; height: 420px; background: #8b5cf6; bottom: -150px; right: -80px; animation-delay: -6s; }
.aurora-3 { width: 360px; height: 360px; background: #14b8a6; top: 35%; left: 55%; animation-delay: -12s; }
@keyframes drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(40px, -30px) scale(1.08); }
    100% { transform: translate(-20px, 40px) scale(0.96); }
}

.login-card {
    width: min(420px, 100%);
    padding: 2.5rem 2rem 2rem;
    background: rgba(17, 24, 39, 0.72);
    backdrop-filter: blur(18px) saturate(1.1);
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.04) inset;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.brand { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.4rem; }
.brand-mark svg { width: 44px; height: 44px; }
.brand-title { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.02em; }
.brand-sub { font-size: 0.78rem; color: #94a3b8; letter-spacing: 0.04em; text-transform: uppercase; }

/* --- Formularze --- */
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span { font-size: 0.78rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; }
.field input, .field select {
    width: 100%;
    padding: 0.65rem 0.8rem;
    background: rgba(15, 23, 42, 0.7);
    color: #e5e7eb;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.15s, background 0.15s;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: #60a5fa;
    background: rgba(30, 41, 59, 0.9);
}
.field-check { display: flex; align-items: center; gap: 0.5rem; color: #cbd5e1; font-size: 0.9rem; }
.field-check input { accent-color: #8b5cf6; width: 16px; height: 16px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; }
.field-compact { flex: 1; }

.btn-primary {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: 0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.08s, box-shadow 0.15s;
    box-shadow: 0 8px 24px rgba(59,130,246,0.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(59,130,246,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
    padding: 0.55rem 0.9rem;
    background: transparent;
    color: #cbd5e1;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); }

.alert {
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 10px;
    color: #fecaca;
    font-size: 0.9rem;
}
.alert.error { background: rgba(239, 68, 68, 0.12); }
.footnote { font-size: 0.78rem; color: #64748b; text-align: center; }

/* --- Topbar (po logowaniu) --- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 1.5rem;
    padding: 0.7rem 1.5rem;
    background: rgba(11, 16, 32, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.topbar-brand { display: flex; align-items: center; gap: 0.55rem; color: #e5e7eb; font-weight: 600; }
.topbar-brand svg { width: 22px; height: 22px; color: #60a5fa; }
.topbar-brand:hover { text-decoration: none; }
.topbar-links { display: flex; gap: 1.1rem; margin-left: 1rem; }
.topbar-links a { color: #cbd5e1; font-size: 0.92rem; }
.topbar-links a:hover { color: #fff; text-decoration: none; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; }
.topbar-user .who { color: #94a3b8; font-size: 0.88rem; }

/* --- Page --- */
.page { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page-head h1 { margin: 0 0 0.3rem; font-size: 1.8rem; font-weight: 700; letter-spacing: -0.01em; }
.page-lede { margin: 0 0 2rem; color: #94a3b8; font-size: 0.98rem; }

/* --- Kafelki --- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
}
.tile {
    display: flex;
    gap: 1rem;
    padding: 1.3rem;
    background: linear-gradient(180deg, rgba(30,41,59,0.6), rgba(15,23,42,0.7));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    color: #e5e7eb;
    text-decoration: none;
    transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}
.tile::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(59,130,246,0.08), transparent 40%);
    opacity: 0; transition: opacity 0.2s;
}
.tile:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 12px 28px rgba(0,0,0,0.35);
    text-decoration: none;
}
.tile:hover::before { opacity: 1; }
.tile-icon {
    flex: 0 0 44px; width: 44px; height: 44px;
    display: grid; place-items: center;
    background: rgba(59, 130, 246, 0.12);
    border-radius: 10px;
    color: #7dd3fc;
}
.tile-icon svg { width: 24px; height: 24px; }
.tile-arp .tile-icon { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.tile-body { flex: 1; min-width: 0; }
.tile-title { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.25rem; }
.tile-desc { color: #cbd5e1; font-size: 0.9rem; line-height: 1.4; margin-bottom: 0.5rem; }
.tile-meta { font-size: 0.78rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.tile-meta.planned {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    display: inline-block;
}

/* --- Formularz wyszukiwania --- */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.3rem;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    margin-bottom: 1.5rem;
}
.search-form.inline { flex-direction: row; align-items: flex-end; gap: 0.8rem; }
.search-form .actions { display: flex; gap: 0.6rem; }

/* --- Tabele --- */
.result-meta { color: #94a3b8; font-size: 0.9rem; margin: 0.5rem 0 1rem; }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(255,255,255,0.08); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
table.data th { background: rgba(15,23,42,0.8); font-weight: 600; color: #cbd5e1; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
table.data tbody tr:hover { background: rgba(255,255,255,0.02); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .ts { font-variant-numeric: tabular-nums; color: #cbd5e1; white-space: nowrap; }
table.data .err { color: #fca5a5; font-size: 0.82rem; }

.vendor { color: #64748b; font-size: 0.8rem; margin-left: 0.4rem; }
.state {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
}
.state-reachable { background: rgba(34,197,94,0.15); color: #86efac; }
.state-stale     { background: rgba(245,158,11,0.15); color: #fcd34d; }
.state-dynamic   { background: rgba(59,130,246,0.15); color: #93c5fd; }
.state-static    { background: rgba(139,92,246,0.15); color: #c4b5fd; }
.state-delay, .state-probe { background: rgba(236,72,153,0.15); color: #fbcfe8; }
.state-unresolved { background: rgba(239,68,68,0.15); color: #fca5a5; }

.empty {
    padding: 2rem;
    text-align: center;
    color: #94a3b8;
    background: rgba(30,41,59,0.3);
    border: 1px dashed rgba(255,255,255,0.08);
    border-radius: 12px;
}
.hint {
    margin-top: 1.5rem;
    padding: 0.8rem 1rem;
    background: rgba(30,41,59,0.3);
    border-left: 3px solid #8b5cf6;
    border-radius: 6px;
    font-size: 0.88rem;
    color: #cbd5e1;
}
.hint code { color: #7dd3fc; }

/* --- Urządzenia: dodatkowe komponenty --- */
.page-narrow { max-width: 820px; }
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 1rem; }

.alert.success {
    background: rgba(34,197,94,0.12);
    border-color: rgba(34,197,94,0.3);
    color: #86efac;
}
.alert.warn {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fde68a;
}

.btn-danger {
    padding: 0.45rem 0.75rem;
    background: transparent;
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }

.stepper {
    display: flex;
    gap: 0;
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15,23,42,0.5);
    border: 1px solid rgba(255,255,255,0.06);
}
.stepper li {
    flex: 1;
    padding: 0.9rem 1.1rem;
    display: flex; align-items: center; gap: 0.6rem;
    color: #64748b;
    font-size: 0.9rem;
    position: relative;
}
.stepper li + li::before {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0; width: 1px;
    background: rgba(255,255,255,0.08);
}
.stepper li span {
    display: inline-grid; place-items: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: #94a3b8;
    font-size: 0.8rem; font-weight: 600;
}
.stepper li.done { color: #cbd5e1; }
.stepper li.done span { background: rgba(34,197,94,0.2); color: #86efac; }
.stepper li.active { color: #e5e7eb; background: rgba(59,130,246,0.08); }
.stepper li.active span { background: linear-gradient(135deg,#3b82f6,#8b5cf6); color: white; }

.card {
    background: rgba(30,41,59,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card h2 {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
    font-weight: 600;
}
.card .muted { color: #94a3b8; font-size: 0.9rem; margin: 0 0 1rem; }

.code-block {
    position: relative;
    margin: 1rem 0;
}
.code-block pre {
    background: #020617;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    color: #e0f2fe;
    font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}
.code-block .btn-ghost {
    position: absolute;
    top: 0.6rem; right: 0.6rem;
    font-size: 0.78rem;
    padding: 0.35rem 0.7rem;
}

pre.small {
    background: rgba(2,6,23,0.6);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.78rem;
    color: #cbd5e1;
    overflow-x: auto;
    margin: 0.5rem 0;
}

details summary {
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.88rem;
    margin-top: 0.5rem;
    user-select: none;
}
details[open] summary { color: #cbd5e1; margin-bottom: 0.6rem; }
details ul.explanation {
    color: #cbd5e1;
    font-size: 0.88rem;
    line-height: 1.6;
    padding-left: 1.2rem;
}

.actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.btn-primary.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 24px rgba(34,197,94,0.3);
}

.drafts {
    margin: 2rem 0 1.5rem;
    padding: 1.2rem 1.4rem;
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 12px;
}
.drafts h2 {
    margin: 0 0 0.3rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fbbf24;
}
.drafts .muted {
    margin: 0 0 1rem;
    color: #94a3b8;
    font-size: 0.9rem;
}
.drafts table.data { background: rgba(15, 23, 42, 0.3); }
.row-actions { display: flex; gap: 0.5rem; align-items: center; }

/* --- Statystyki na /arp/polls --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}
.stat-card {
    padding: 1.1rem 1.3rem;
    background: linear-gradient(180deg, rgba(30,41,59,0.6), rgba(15,23,42,0.7));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: #475569;
}
.stat-card.stat-ok::before   { background: linear-gradient(180deg, #22c55e, #16a34a); }
.stat-card.stat-fail::before { background: linear-gradient(180deg, #ef4444, #b91c1c); }
.stat-label {
    font-size: 0.78rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #e5e7eb;
    letter-spacing: -0.02em;
    line-height: 1;
}
.stat-value .unit {
    font-size: 0.9rem;
    font-weight: 500;
    color: #94a3b8;
    margin-left: 0.2rem;
}
.stat-foot {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.section-head {
    font-size: 1.05rem;
    font-weight: 600;
    color: #cbd5e1;
    margin: 2rem 0 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.stat-card.stat-accent::before {
    background: linear-gradient(180deg, #60a5fa, #8b5cf6);
}

svg.sparkline {
    display: block;
    width: 100%;
    height: 60px;
}
.sparkline-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.projection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}
.proj {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.8rem 1rem;
    background: rgba(30,41,59,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}
.proj-period {
    font-size: 0.78rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.proj-size {
    font-size: 1.15rem;
    font-weight: 600;
    color: #e5e7eb;
    font-variant-numeric: tabular-nums;
}
.proj.proj-highlight {
    background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
    border-color: rgba(139,92,246,0.4);
}
.proj.proj-highlight .proj-size { color: #c4b5fd; }

code.small-code {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    font-size: 0.78rem;
    margin-right: 0.25rem;
    color: #7dd3fc;
}
