:root {
    --bg-base: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-base);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Background gradient orb */
body::before {
    content: "";
    position: absolute;
    top: -10%; left: -10%;
    width: 40%; height: 40%;
    background: radial-gradient(circle, rgba(59,130,246,0.3) 0%, transparent 60%);
    z-index: -1;
}

body::after {
    content: "";
    position: absolute;
    bottom: -10%; right: -10%;
    width: 50%; height: 50%;
    background: radial-gradient(circle, rgba(139,92,246,0.2) 0%, transparent 60%);
    z-index: -1;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(20px);
}

.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}

.logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 8px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    font-weight: 600;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    border-left: 3px solid var(--primary);
}

.content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

header h1 {
    font-size: 28px;
    margin-bottom: 32px;
    font-weight: 700;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.panel.active {
    display: block;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.refresh-tip {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
}

.refresh-tip.error {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.18);
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: normal;
}

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

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}
.btn.outline:hover {
    background: rgba(255,255,255,0.05);
}

.btn.danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn.danger:hover {
    background: var(--danger);
    color: white;
}

.btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    font-size: 14px;
}

.table-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.table-meta.error-text {
    color: #fca5a5;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.summary-card {
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    padding: 12px 14px;
}

.summary-label {
    color: var(--text-muted);
    font-size: 12px;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 6px;
}

.summary-value.success {
    color: var(--success);
}

.summary-value.danger {
    color: var(--danger);
}

.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge.active { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge.inactive { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge.neutral { background: rgba(148, 163, 184, 0.2); color: var(--text-muted); }

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-base);
    border: 1px solid var(--border);
    padding: 32px;
    border-radius: 16px;
    width: 400px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.form-group {
    margin-top: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #fff;
    outline: none;
    font-family: inherit;
}

.form-group input:focus {
    border-color: var(--primary);
}

.modal-actions {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.copy-link {
    cursor: pointer;
    color: var(--primary);
    text-decoration: underline;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-box {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 48px;
    border-radius: 24px;
    width: 440px;
    text-align: center;
    transform: translateY(0);
    transition: transform 0.4s ease;
}

.login-overlay.hidden .login-box {
    transform: translateY(-20px);
}

@media (max-width: 960px) {
    .content {
        padding: 20px;
    }

    th, td {
        padding: 10px;
    }
}
