:root {
    --bg: #f5f6fa;
    --card: #fff;
    --border: #e1e4e8;
    --text: #24292e;
    --muted: #6a737d;
    --primary: #0366d6;
    --success: #28a745;
    --danger: #d73a49;
    --warning: #f9a825;
    --info: #0366d6;
}

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

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

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.header {
    background: #24292e;
    color: #fff;
    padding: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.header h1 { font-size: 18px; font-weight: 600; }
.header a { color: #ddd; text-decoration: none; font-size: 13px; }
.header a:hover { color: #fff; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 16px;
    overflow: hidden;
}
.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 16px; }

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    background: var(--card);
    padding: 0 16px;
    overflow-x: auto;
}
.tab {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; }
tr:hover { background: #f6f8fa; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #dcffe4; color: #22863a; }
.badge-failed { background: #ffdce0; color: #cb2431; }
.badge-dry-run { background: #fff3cd; color: #856404; }
.badge-pending { background: #e1e4e8; color: #586069; }
.badge-review { background: #fff3cd; color: #856404; }
.badge-processing { background: #dbedff; color: #0366d6; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
}
.btn:hover { background: #f6f8fa; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #0256b9; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b92d3a; }
.btn-sm { padding: 3px 10px; font-size: 12px; }

/* Forms */
input, select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 13px; }
.form-inline { display: flex; gap: 8px; align-items: center; }

/* Health indicators */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.health-item {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.health-dot.ok { background: var(--success); }
.health-dot.error { background: var(--danger); }
.health-dot.unknown { background: var(--muted); }

/* Stats row */
.stats { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.stat {
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    min-width: 120px;
}
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); }

/* Login */
.login-container {
    max-width: 360px;
    margin: 80px auto;
}
.login-container h2 { margin-bottom: 20px; }
.login-container input { width: 100%; }
.login-container .btn { width: 100%; text-align: center; margin-top: 8px; }

/* Misc */
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
pre { white-space: pre-wrap; word-break: break-all; }
.error-detail { background: #f6f8fa; padding: 8px 12px; border-radius: 4px; font-size: 13px; margin-top: 4px; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: var(--card);
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--card);
}
.modal-body { padding: 16px; }
.detail-row { display: flex; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.detail-label { width: 140px; font-weight: 600; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.detail-value { flex: 1; font-size: 13px; }

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    z-index: 2000;
    animation: fadeInOut 3s ease forwards;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    10% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}


/* Filter inputs */
.input-sm {
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary, #fff);
    color: var(--text);
}
.input-sm:focus {
    outline: none;
    border-color: var(--primary, #4a90d9);
}
select.input-sm {
    cursor: pointer;
}
