.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #042f2e;
    box-shadow: 0 0 20px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: #fff; }

.btn-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }

.btn-danger {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 0.4rem 0.6rem;
}
.btn-ghost:hover { color: var(--primary); background: var(--primary-soft); }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-icon { padding: 0.4rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 1.25rem; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-card .label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active { background: var(--primary-soft); color: var(--primary); }
.badge-paused { background: rgba(139,149,168,0.15); color: var(--text-muted); }
.badge-admin { background: rgba(251,191,36,0.15); color: var(--warning); }
.badge-user { background: rgba(59,130,246,0.15); color: #60a5fa; }

.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input, .select, .textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.textarea { min-height: 80px; resize: vertical; }

.form-error {
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.3);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: center;
}

.toolbar .input, .toolbar .select { width: auto; min-width: 160px; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    background: var(--surface-2);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }

.url-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions { display: flex; gap: 0.25rem; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pagination-btns { display: flex; gap: 0.5rem; }

.chip {
    display: inline-flex;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.chip:hover, .chip.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state svg { opacity: 0.4; margin-bottom: 1rem; }

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    min-width: 260px;
    box-shadow: var(--shadow);
    animation: slideIn 0.25s ease;
    font-size: 0.875rem;
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
}

.panel-overlay.show { opacity: 1; visibility: visible; }

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background: var(--surface-3);
    border-left: 1px solid var(--border);
    z-index: 400;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.slide-panel.open { transform: translateX(0); }

.panel-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 { font-size: 1.1rem; }

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.panel-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: var(--radius);
    height: 1rem;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.chart-wrap { position: relative; height: 280px; }
.chart-wrap-sm { height: 200px; }

.bulk-bar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--primary-soft);
    border: 1px solid rgba(20,184,166,0.3);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.bulk-bar.show { display: flex; }

.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre;
    color: var(--text-muted);
    max-height: 300px;
}

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.error-page h1 {
    font-size: 5rem;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}
