:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --ink: #1c1f26;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-ink: #ffffff;
    --ok: #16a34a;
    --warn: #d97706;
    --danger: #dc2626;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    padding-bottom: 76px; /* lë vend për bottom-nav fiks në mobile */
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    padding-top: calc(14px + env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
}

.topbar-logo { font-size: 20px; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.topbar-user { color: var(--muted); display: none; }
@media (min-width: 560px) { .topbar-user { display: inline; } }

.btn-ghost {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
}
.btn-ghost:active { background: var(--bg); }

.refresh-icon { display: inline-block; transition: transform .4s; }
.refresh-icon.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.main-content {
    max-width: 920px;
    margin: 0 auto;
    padding: 16px;
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
@media (min-width: 640px) { .summary-row { grid-template-columns: repeat(4, 1fr); } }

.summary-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}
.summary-tile .num { font-size: 22px; font-weight: 700; }
.summary-tile .label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.site-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.site-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.site-name { font-weight: 700; font-size: 16px; }

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}
.status-online { background: #dcfce7; color: #166534; }
.status-offline { background: #fee2e2; color: #991b1b; }
.status-unknown { background: #f3f4f6; color: var(--muted); }

.site-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 480px) { .site-stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-box { padding: 8px 0; }
.stat-box .num { font-size: 19px; font-weight: 700; }
.stat-box.alert .num { color: var(--danger); }
.stat-box .label { color: var(--muted); font-size: 12px; }

.site-card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--muted);
    align-items: center;
    justify-content: space-between;
}

.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.ssl-warn { color: var(--warn); font-weight: 600; }
.ssl-danger { color: var(--danger); font-weight: 700; }

.sparkline { display: block; margin-top: 10px; }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 0 8px;
    color: var(--muted);
    font-size: 11.5px;
}
.bottom-nav a.active { color: var(--accent); }
.bn-icon { font-size: 20px; }

/* --- Login --- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    width: 100%;
    max-width: 360px;
}
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card p.hint { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-full {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
}
.alert {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 14px;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-ok { background: #dcfce7; color: #166534; }

.qr-box { text-align: center; margin: 14px 0; }
.qr-box img { max-width: 220px; width: 100%; border: 1px solid var(--border); border-radius: 12px; }
.secret-text {
    font-family: ui-monospace, monospace;
    background: var(--bg);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    word-break: break-all;
    text-align: center;
}

form.inline-form { margin: 0; }

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--muted);
}

.code-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 260px;
    overflow: auto;
}
