:root {
    --bg-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --sidebar-bg: rgba(15, 12, 41, 0.85);
    --card-bg: rgba(255, 255, 255, 0.06);
    --text-color: #eef0f5;
    --muted-color: #a9adc1;
    --accent: #7f5af0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    backdrop-filter: blur(6px);
    padding: 24px 16px;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 32px;
    padding-left: 8px;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--muted-color);
    text-decoration: none;
    margin-bottom: 4px;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: var(--accent);
    color: white;
}

.content {
    flex: 1;
    padding: 32px;
    max-width: 900px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.card h2 { margin-top: 0; }

.muted { color: var(--muted-color); font-size: 0.9rem; }

form { display: flex; gap: 8px; flex-wrap: wrap; }

input[type="url"] {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: var(--text-color);
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    cursor: pointer;
}

.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
}

.logout-form { margin: 0; }

.logout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--muted-color);
}

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

.login-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    padding: 32px;
    width: 320px;
    max-width: 90vw;
}

.login-card h1 { margin-top: 0; font-size: 1.4rem; }

.login-card form { flex-direction: column; }

.login-card label { font-size: 0.85rem; color: var(--muted-color); margin-top: 12px; }

.login-card input {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: var(--text-color);
    width: 100%;
}

.login-card button { margin-top: 20px; width: 100%; }

.error { color: #ff6b6b; font-size: 0.9rem; }

.btn-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    margin-left: 8px;
}
.btn-link:hover { text-decoration: underline; }

.logo-preview-bg {
    background: radial-gradient(ellipse at center, #1c2530 0%, #0a0d12 70%);
    border-radius: 12px;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

.logo-preview-img {
    max-width: 220px;
    max-height: 100px;
}

.tile-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.tile-table td, .tile-table th { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); }

.tile-row {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tile-row-summary { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.tile-row select, .tile-row input, .tile-row textarea {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: var(--text-color);
    font-family: inherit;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-tile {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-label { font-size: 0.75rem; color: var(--muted-color); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.5rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat-sub { font-size: 0.8rem; color: var(--muted-color); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-dot.ok { background: #2ecc71; }
.status-dot.warn { background: #f5a623; }
.status-dot.bad { background: #e74c3c; }

.badge-current {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    background: rgba(127, 90, 240, 0.2);
    color: var(--accent);
}

@media (max-width: 700px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.status-grid > div { display: flex; flex-direction: column; gap: 6px; }
.status-grid label { font-size: 0.85rem; color: var(--muted-color); }
.status-grid select, .status-grid input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: var(--text-color);
}

@media (max-width: 700px) {
    .status-grid { grid-template-columns: 1fr; }
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.2s;
}
.switch .slider::before {
    content: ""; position: absolute;
    width: 18px; height: 18px; left: 3px; top: 3px;
    background: white; border-radius: 50%;
    transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Mobile: collapse sidebar to a top bar */
@media (max-width: 700px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; padding: 12px 16px; }
    .sidebar-nav { display: flex; overflow-x: auto; gap: 8px; }
    .sidebar-nav li a { white-space: nowrap; margin-bottom: 0; }
    .content { padding: 20px; max-width: 100%; }
}
