:root {
    --bg: #f5f6fa;
    --card: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --muted: #6b7280;
    --border: #e5e7eb;
    --text: #1f2937;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 { font-size: 1.25rem; }

nav { display: flex; align-items: center; gap: 12px; }

.user-email { font-size: 0.85rem; color: var(--muted); }

main { max-width: 960px; margin: 24px auto; padding: 0 16px; }

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

.card.centered { text-align: center; max-width: 400px; margin: 80px auto; }

h2 { font-size: 1.1rem; margin-bottom: 12px; }
h3 { font-size: 0.95rem; margin: 16px 0 8px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { position: relative; padding: 4px 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
textarea, input[type="text"], select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    margin-bottom: 12px;
}
textarea { resize: vertical; font-family: monospace; }
select { width: auto; }

.radio-group label { display: block; margin: 8px 0; cursor: pointer; }
.radio-group input[type="radio"] { margin-right: 8px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; background: var(--bg); }
tbody tr:hover { background: #f9fafb; }
tfoot td { font-weight: 600; background: var(--bg); }

/* Progress */
.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Status indicators */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.active { background: var(--success); }
.status-dot.paused { background: var(--warning); }
.status-dot.error { background: var(--danger); }
.status-dot.partial { background: var(--warning); }

/* Notifications */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.notif-dropdown {
    position: fixed;
    top: 52px;
    right: 16px;
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 200;
    padding: 8px;
}

.notif-item {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.notif-item:last-child { border-bottom: none; }
.notif-item .notif-title { font-weight: 600; }
.notif-item .notif-actions { margin-top: 6px; display: flex; gap: 8px; }

/* Alert banners at top of dashboard */
.alert-banner {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.alert-banner.warning { background: #fef3c7; border: 1px solid #f59e0b; }
.alert-banner.error { background: #fee2e2; border: 1px solid #dc2626; }
.alert-banner .alert-close { cursor: pointer; padding: 4px 8px; }

/* Utilities */
.hidden { display: none !important; }
.muted { color: var(--muted); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.status { padding: 8px 0; font-size: 0.85rem; }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }

/* Webhook settings */
.webhook-settings { margin: 16px 0; padding: 16px; background: var(--bg); border-radius: var(--radius); }
.trigger-mode-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.select-input { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.875rem; }
.webhook-info { display: flex; gap: 16px; margin: 8px 0; font-size: 0.875rem; }
.webhook-actions { display: flex; gap: 8px; margin: 8px 0; }
.webhook-status-active { color: var(--success); font-weight: 600; }
.webhook-status-partial { color: var(--warning); font-weight: 600; }
.webhook-status-pending, .webhook-status-failed { color: var(--danger); font-weight: 600; }
.deployment-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 0.85rem; }
.trigger-webhook { color: var(--primary); font-weight: 600; }
