/* ── Variables ── */
:root {
    --bc-blue:       #0054a6;
    --bc-blue-dark:  #003d7a;
    --bc-blue-light: #e8f0fa;
    --bc-text:       #334155;
    --bc-muted:      #64748b;
    --bc-subtle:     #94a3b8;
    --bc-border:     #e2e8f0;
    --bc-bg:         #f8fafc;
    --bc-white:      #ffffff;
    --bc-success:    #16a34a;
    --bc-error:      #dc2626;
    --bc-warn:       #d97706;
    --radius:        6px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Arial, Helvetica, sans-serif;
    color: var(--bc-text);
    background: var(--bc-bg);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--bc-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
    background: var(--bc-white);
    border-bottom: 1px solid var(--bc-border);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1200px; margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex; align-items: center; justify-content: space-between;
}
.logo-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo { height: 32px; }
.logo-text { font-size: 17px; font-weight: bold; color: var(--bc-blue); }
.header-nav { display: flex; align-items: center; gap: 20px; }
.nav-link { color: var(--bc-muted); font-size: 14px; }
.nav-link:hover { color: var(--bc-blue); text-decoration: none; }
.nav-email { font-size: 13px; color: var(--bc-subtle); }
.nav-logout { color: var(--bc-blue); }

/* ── Main ── */
.main-content { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

/* ── Footer ── */
.site-footer {
    text-align: center; padding: 20px;
    font-size: 12px; color: var(--bc-subtle);
    border-top: 1px solid var(--bc-border);
    margin-top: 48px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border: none; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--bc-blue); color: var(--bc-white); }
.btn-primary:hover:not(:disabled) { background: var(--bc-blue-dark); }
.btn-secondary { background: var(--bc-white); color: var(--bc-text); border: 1px solid var(--bc-border); }
.btn-secondary:hover:not(:disabled) { background: var(--bc-bg); }
.btn-danger { background: var(--bc-error); color: var(--bc-white); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--bc-text); margin-bottom: 5px; }
.form-control {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--bc-border); border-radius: var(--radius);
    font-size: 14px; font-family: inherit; color: var(--bc-text);
    background: var(--bc-white);
    transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--bc-blue); box-shadow: 0 0 0 3px rgba(0,84,166,.12); }
.form-control.error { border-color: var(--bc-error); }
.form-hint { font-size: 12px; color: var(--bc-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--bc-error); margin-top: 4px; }
textarea.form-control { resize: vertical; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info { background: var(--bc-blue-light); color: var(--bc-blue-dark); border: 1px solid #bfdbfe; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

/* ── Cards ── */
.card { background: var(--bc-white); border: 1px solid var(--bc-border); border-radius: var(--radius); padding: 20px; }

/* ── Page headings ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; color: var(--bc-text); }
.page-header p { color: var(--bc-muted); font-size: 14px; margin-top: 4px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header-row h1 { font-size: 22px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--bc-bg); padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 700; color: var(--bc-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--bc-border); }
td { padding: 11px 14px; border-bottom: 1px solid var(--bc-border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bc-bg); }
.table-actions { display: flex; gap: 8px; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #f1f5f9; color: var(--bc-muted); }
.badge-admin { background: var(--bc-blue-light); color: var(--bc-blue); }

/* ── Login layout ── */
.login-body { background: var(--bc-bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; max-width: 420px; padding: 24px 16px; }
.login-card { background: var(--bc-white); border: 1px solid var(--bc-border); border-radius: 10px; padding: 36px 36px 28px; }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo-full { max-width: 220px; height: auto; margin-bottom: 10px; }
.login-subtitle { font-size: 13px; font-weight: 600; color: var(--bc-muted); text-transform: uppercase; letter-spacing: 2px; margin-top: 4px; }
.login-footer { text-align: center; font-size: 12px; color: var(--bc-subtle); margin-top: 16px; }
.login-submit { width: 100%; margin-top: 4px; justify-content: center; }
.login-back { display: block; text-align: center; margin-top: 14px; font-size: 13px; color: var(--bc-muted); }

/* ── OTP code input ── */
.otp-input {
    font-family: 'Courier New', Courier, monospace;
    font-size: 28px; letter-spacing: 10px; text-align: center;
    padding: 12px; font-weight: bold; color: var(--bc-blue);
}

/* ── Report list ── */
.report-list-wrap {
    background: var(--bc-white); border: 1px solid var(--bc-border);
    border-radius: var(--radius); margin-bottom: 24px; overflow: hidden;
}
/* checkbox | name 200px | description 1fr | ver 60px | options 120px | status 140px */
.report-row-grid {
    display: grid;
    grid-template-columns: 28px 200px 1fr 60px 120px 140px;
    align-items: center;
    gap: 0 12px;
}
.report-list-header {
    padding: 9px 16px; background: var(--bc-bg);
    border-bottom: 1px solid var(--bc-border);
    font-size: 11px; font-weight: 700; color: var(--bc-muted); text-transform: uppercase; letter-spacing: .5px;
}
.report-list-select-all { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--bc-muted); text-transform: uppercase; letter-spacing: .5px; }
.report-list-select-all input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--bc-blue); cursor: pointer; }
.report-card.report-row {
    padding: 9px 16px; border-bottom: 1px solid var(--bc-border);
    cursor: pointer; transition: background 0.1s;
    background: var(--bc-white);
}
.report-card.report-row:last-child { border-bottom: none; }
.report-card.report-row:hover { background: var(--bc-bg); }
.report-card.report-row.selected { background: var(--bc-blue-light); }
.report-card.report-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--bc-blue); cursor: pointer; }
.report-row-name { font-size: 14px; font-weight: 600; color: var(--bc-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-row-desc { font-size: 13px; color: var(--bc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-row-ver { font-size: 12px; color: var(--bc-subtle); white-space: nowrap; }
.report-row-options { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.report-card-status { font-size: 13px; white-space: nowrap; text-align: right; }

/* ── Chips ── */
.chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.chip-version { background: #f1f5f9; color: var(--bc-muted); }
.chip-date { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.chip-warn { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; cursor: default; }
.status-idle { color: var(--bc-subtle); }
.status-queued { color: var(--bc-muted); }
.status-generating { color: var(--bc-blue); }
.status-done { color: var(--bc-success); font-weight: 600; }
.status-error { color: var(--bc-error); }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--bc-border); border-top-color: var(--bc-blue); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; margin-right: 4px; }

/* ── Date controls ── */
.date-quick-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.date-quick-btns .btn.active { background: var(--bc-blue-light); color: var(--bc-blue); border-color: #bfdbfe; }
.date-controls { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 24px; }
.date-controls .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }
.instance-select { max-width: 280px; margin-bottom: 20px; }

/* ── Generate bar ── */
.generate-bar { display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.generate-bar .selected-count { font-size: 14px; color: var(--bc-muted); }

/* ── Admin layout ── */
.admin-nav { display: flex; gap: 4px; margin-bottom: 28px; flex-wrap: wrap; }
.admin-nav a {
    padding: 7px 14px; border-radius: var(--radius); font-size: 14px;
    color: var(--bc-muted); border: 1px solid transparent;
}
.admin-nav a:hover, .admin-nav a.active {
    background: var(--bc-blue-light); color: var(--bc-blue);
    border-color: #bfdbfe; text-decoration: none;
}

/* ── Tab editor ── */
.tab-editor { border: 1px solid var(--bc-border); border-radius: var(--radius); margin-bottom: 12px; }
.tab-editor-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--bc-bg); border-bottom: 1px solid var(--bc-border);
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 14px; font-weight: 600; color: var(--bc-muted);
}
.tab-editor-body { padding: 14px; }
.tab-editor-body .form-group:last-child { margin-bottom: 0; }
.pipeline-textarea { font-family: 'Courier New', Courier, monospace; font-size: 12px; min-height: 180px; white-space: pre; }

/* ── Utility ── */
.text-muted { color: var(--bc-muted); }
.text-sm { font-size: 13px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.d-flex { display: flex; } .gap-2 { gap: 8px; } .align-center { align-items: center; }
.w-100 { width: 100%; }
