/* BespokeAgile Comply — Dashboard Styles */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --border: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #58a6ff;
    --green: #3fb950;
    --yellow: #d29922;
    --red: #f85149;
    --orange: #db6d28;
    --sidebar-width: 220px;
}

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

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

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.version {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

.nav-links {
    list-style: none;
    padding: 8px 0;
    flex: 1;
}

.nav-link {
    display: block;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: rgba(88, 166, 255, 0.08);
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.tier-badge {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
}

/* Main content */
.content-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    min-height: 100vh;
}

.content-area.app-layout-with-sidebar {
    display: grid;
    grid-template-columns: 280px 1fr;
}

.content {
    flex: 1;
    padding: 24px 32px;
    min-height: 100vh;
    overflow-y: auto;
}

/* Page header */
.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}

.card-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-input, .form-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group { flex: 1; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-primary:hover { background: #4c96e8; }

.btn-accent {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}
.btn-accent:hover { background: #4cc95e; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-group { display: flex; gap: 8px; }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.data-table tr:hover td { background: var(--bg-hover); }
.data-table tr:last-child td { border-bottom: none; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-met { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.status-partial { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.status-gap { background: rgba(248, 81, 73, 0.15); color: var(--red); }

/* Layer pills */
.layer-pills {
    display: flex;
    gap: 4px;
}

.layer-pill {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.layer-pill.met { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.layer-pill.partial { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.layer-pill.gap { background: rgba(248, 81, 73, 0.15); color: var(--red); }

/* Score gauge */
.score-gauge {
    display: flex;
    align-items: center;
    gap: 16px;
}

.score-gauge svg { flex-shrink: 0; }

.score-value {
    font-size: 32px;
    font-weight: 700;
}

.score-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Progress stepper */
.progress-stepper {
    display: flex;
    gap: 0;
    margin: 24px 0;
}

.step {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 3px solid var(--border);
    transition: all 0.3s;
}

.step.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.step.done {
    color: var(--green);
    border-bottom-color: var(--green);
}

/* Tabs */
.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.tab {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Accordion */
.accordion-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
}

.accordion-header {
    padding: 12px 16px;
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}

.accordion-header:hover { background: var(--bg-hover); }

.accordion-body {
    padding: 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s, padding 0.3s;
}

.accordion-item.open .accordion-body {
    max-height: 2000px;
    padding: 12px 16px;
}

.accordion-chevron {
    transition: transform 0.2s;
    color: var(--text-muted);
}

.accordion-item.open .accordion-chevron {
    transform: rotate(90deg);
}

/* Charts */
.chart-container {
    margin: 16px 0;
    overflow-x: auto;
}

.chart-container svg {
    display: block;
}

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-info { background: rgba(88, 166, 255, 0.1); border: 1px solid rgba(88, 166, 255, 0.3); }
.alert-warn { background: rgba(210, 153, 34, 0.1); border: 1px solid rgba(210, 153, 34, 0.3); }
.alert-error { background: rgba(248, 81, 73, 0.1); border: 1px solid rgba(248, 81, 73, 0.3); }
.alert-success { background: rgba(63, 185, 80, 0.1); border: 1px solid rgba(63, 185, 80, 0.3); }

/* Loading */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
    font-size: 14px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header h1, .nav-link span, .sidebar-footer { display: none; }
    .content-area { margin-left: 60px; }
    .content-area.app-layout-with-sidebar { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* ── Predicate Audit ────────────────────────────────────────── */

.audit-hero {
    text-align: center;
    padding: 32px 16px 24px;
}
.audit-hero h1 {
    font-size: 28px;
    margin-bottom: 8px;
}
.audit-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.audit-desc {
    max-width: 600px;
    margin: 0 auto;
    color: var(--text-muted);
    line-height: 1.5;
}

.audit-result-header {
    margin-bottom: 16px;
}
.audit-scores {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 16px 0;
}
.audit-score-main {
    text-align: center;
}
.audit-score-main p {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 13px;
}
.audit-gap-highlight {
    padding: 16px 24px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    text-align: center;
    flex: 1;
}
.gap-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--yellow);
}
.gap-label {
    font-size: 14px;
    color: var(--text-secondary);
}
.gap-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}
.gap-pct {
    font-size: 13px;
    color: var(--red);
    margin-top: 4px;
    font-weight: 600;
}

.audit-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.audit-section .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.section-counts {
    display: flex;
    gap: 6px;
}
.section-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin: 8px 0;
}

.audit-section-infra .card-header { border-left: 3px solid var(--blue); }
.audit-section-pipeline .card-header { border-left: 3px solid var(--purple); }
.audit-section-model .card-header { border-left: 3px solid var(--yellow); }

.eval-method {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.eval-keyword { background: rgba(88, 166, 255, 0.15); color: var(--blue); }
.eval-graph { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }

.badge { padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-met { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.badge-partial { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.badge-gap { background: rgba(248, 81, 73, 0.15); color: var(--red); }

.audit-cta {
    text-align: center;
    padding: 32px;
}
.audit-cta h3 { margin-bottom: 8px; }
.audit-cta p { color: var(--text-muted); margin-bottom: 16px; }

.install-cmd {
    background: var(--bg-tertiary);
    padding: 8px 16px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 768px) {
    .audit-scores { flex-direction: column; }
}

/* ── Settings / License ─────────────────────────────────────── */

.settings-plan {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
}
.plan-badge {
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
}
.plan-free { background: var(--bg-tertiary); color: var(--text-muted); }
.plan-pro { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.plan-enterprise { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.plan-details p { margin: 4px 0; font-size: 13px; color: var(--text-secondary); }
.plan-licensed { color: var(--green); font-style: italic; }

.upgrade-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 8px 0;
}
.upgrade-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}
.upgrade-card h3 { margin-bottom: 8px; }
.upgrade-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
}
.upgrade-price span { font-size: 14px; color: var(--text-muted); font-weight: 400; }
.upgrade-features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    text-align: left;
}
.upgrade-features li {
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.upgrade-features li::before {
    content: "\2713 ";
    color: var(--green);
    font-weight: 700;
}

@media (max-width: 768px) {
    .upgrade-grid { grid-template-columns: 1fr; }
    .settings-plan { flex-direction: column; }
}

/* ── Enforcement Banner ─────────────────────────────────────── */

.enforcement-banner {
    background: linear-gradient(135deg, rgba(248, 81, 73, 0.12), rgba(210, 153, 34, 0.12));
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 8px;
    padding: 16px 24px;
    margin-bottom: 16px;
}
.enforcement-deadlines {
    display: flex;
    justify-content: center;
    gap: 32px;
}
.deadline-item {
    text-align: center;
}
.deadline-days {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--yellow);
}
.deadline-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.deadline-enforced .deadline-days {
    color: var(--red);
    animation: pulse-enforcement 2s ease-in-out infinite;
}
@keyframes pulse-enforcement {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@media (max-width: 768px) {
    .enforcement-deadlines { flex-direction: column; gap: 12px; }
}

/* Demo mode: hide left nav, full-width content */
.demo-mode .sidebar { display: none; }
.demo-mode .content-area { margin-left: 0; }
.demo-mode #repo-sidebar { height: 100vh; }

/* ── Home View (self-hosted) ──────────────────────────────── */

.home-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 16px;
}

.home-header {
    text-align: center;
    margin-bottom: 32px;
}
.home-header h1 {
    font-size: 28px;
    margin-bottom: 4px;
}
.home-subtitle {
    color: var(--text-muted);
    font-size: 15px;
}

.home-scan {
    margin-bottom: 24px;
}
.home-scan h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.home-welcome h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.home-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}
.home-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.home-step p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.home-tip {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.home-tip code {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 12px;
}

.home-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.home-history-header h2 {
    font-size: 18px;
    margin: 0;
}

.clickable-row {
    cursor: pointer;
}
.clickable-row:hover {
    background: var(--bg-tertiary);
}
