/* Trust Portal */

:root {
    --primary: #1a365d;
    --primary-light: #2a4a7f;
    --success: #276749;
    --warning: #c05621;
    --danger: #c53030;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --text: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
    --radius: 8px;
    /* Pages set both fonts as a style attribute on <html>; these are the defaults. */
    --heading-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --text-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--text-font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Headings and titles use the heading font; form controls and code keep their own rules. */
h1, h2, h3, h4, h5, h6,
nav .brand,
.score-card .score, .category-card .score, .stat-card .stat,
.collector-widget-stat .stat-value {
    font-family: var(--heading-font);
}

button, input, select, textarea { font: inherit; }

pre, code, kbd, samp { font-family: monospace; }

/* Navigation */
header {
    background: var(--primary);
    color: white;
    padding: 0 2rem;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

nav .brand {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
}

nav a:hover { color: white; }

/* Main content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 1rem;
}

.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.hero p { color: var(--text-muted); font-size: 1.1rem; }

/* Score cards */
.score-overview {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.score-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    min-width: 300px;
}

.score-card.primary { border-color: var(--primary); }
.score-card .score { font-size: 3rem; font-weight: 700; color: var(--primary); display: block; }
.score-card p { color: var(--text-muted); margin-top: 0.5rem; }

/* Category grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.category-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.category-card h3 { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.category-card .score { font-size: 2rem; font-weight: 700; color: var(--primary); display: block; }
.category-card p { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 1rem 0;
}

th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; color: var(--text-muted); }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge.adopted, .badge.passed, .badge.approved { background: #c6f6d5; color: var(--success); }
.badge.missing, .badge.failed { background: #fed7d7; color: var(--danger); }
.badge.outdated, .badge.due_soon { background: #feebc8; color: var(--warning); }
.badge.draft, .badge.pending { background: #e2e8f0; color: var(--text-muted); }
.key-missing { color: var(--danger); }

/* Progress bar */
.progress-bar {
    background: var(--border);
    border-radius: 4px;
    height: 8px;
    margin-top: 0.5rem;
}

.progress-fill {
    background: var(--success);
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

/* Admin grid */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-card.warning { border-color: var(--warning); }
.stat-card .stat { font-size: 2.5rem; font-weight: 700; color: var(--primary); display: block; }
.stat-card.warning .stat { color: var(--warning); }

/* Section spacing */
section { margin-bottom: 2rem; }
h1 { margin-bottom: 0.5rem; }
h2 { margin: 1.5rem 0 0.5rem; }

/* Control groups */
.control-group ul { list-style: none; }
.control-group li {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

footer a { color: var(--primary); }

/* Contact */
.contact { text-align: center; padding: 2rem; }
.contact a { color: var(--primary); }

/* Info Tooltips (#648) */
.tooltip-icon {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 4px;
}
.tooltip-trigger { font-size: 0.85em; opacity: 0.5; }
.tooltip-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: normal;
    white-space: normal;
    width: 280px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    line-height: 1.4;
}
.tooltip-icon:hover .tooltip-content,
.tooltip-icon:focus .tooltip-content { display: block; }

/* SOC 2 Journey Stepper (#650) */
.soc2-journey { text-align: center; margin: 2rem 0; }
.stepper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 120px;
    max-width: 160px;
    position: relative;
}
.step-indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
}
.step.completed .step-indicator {
    background: var(--success);
    border-color: var(--success);
    color: white;
}
.step.current .step-indicator {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.step-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}
.step.current .step-label { color: var(--primary); font-weight: 600; }
.step.completed .step-label { color: var(--success); }
.step-date { display: block; font-size: 0.75rem; color: var(--text-muted); }

/* AI Transparency Banner (#647) */
.ai-transparency-banner {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 2rem 0;
}
.ai-transparency-banner a { color: var(--primary); font-weight: 500; }

/* Content pages (legal, AI transparency) */
.content-page {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 3rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}
.content-page h1 { margin: 1.5rem 0 1rem; font-size: 1.6rem; }
.content-page h2 { margin: 1.5rem 0 0.75rem; font-size: 1.2rem; }
.content-page hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.content-page ol, .content-page ul { padding-left: 1.5rem; }
.content-page li { margin-bottom: 0.5rem; }

/* Collector admin UI */
.collector-form { margin: 1.5rem 0 2rem; }
.collector-form h2 {
    margin: 1.5rem 0 0.75rem;
    font-size: 1.2rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.collector-form h2:first-of-type { border-top: none; padding-top: 0; }
.credential-mode-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    display: none;
}
.help-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.help-text.warning-text { color: var(--warning); }
.status-banner {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.status-banner.info { border-left-color: var(--primary-light); }
.status {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-ok    { background: #c6f6d5; color: var(--success); }
.status-warn  { background: #feebc8; color: var(--warning); }
.status-err   { background: #fed7d7; color: var(--danger); }
.status-muted { background: var(--bg); color: var(--text-muted); }
.status-none  { background: var(--bg); color: var(--text-muted); }
.row-subtext {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    max-width: 38rem;
}
.lede { color: var(--text-muted); margin: 0.75rem 0 1.25rem; max-width: 48rem; }
.collector-actions,
.policy-actions {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-primary:disabled { background: var(--text-muted); cursor: not-allowed; }
.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
}
.btn-secondary:hover { background: var(--bg); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
#action-result { margin: 1rem 0; }
#action-result .result-ok { color: var(--success); }
#action-result .result-err { color: var(--danger); }
.result-body,
.policy-preview {
    background: #1a202c;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.5;
    max-height: 30rem;
    white-space: pre-wrap;
    word-break: break-word;
}
.form-actions { margin: 1.5rem 0; }
.run-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0 1.5rem;
}
.run-summary-item { display: flex; flex-direction: column; }
.run-summary-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}
.run-summary-item .value { font-size: 1rem; margin-top: 0.15rem; }
.check-message { font-size: 0.85rem; max-width: 32rem; }
.text-muted { color: var(--text-muted); }

/* Collector setup banner on the admin dashboard */
.setup-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #ebf4ff, #e0ecff);
    border: 1px solid #93c5fd;
    border-left: 5px solid var(--primary);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0 1.5rem;
}
.setup-banner-icon {
    font-size: 1.75rem;
    line-height: 1;
}
.setup-banner-content { flex: 1; }
.setup-banner-content strong { color: var(--primary); font-size: 1.05rem; }
.setup-banner-content p {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    color: var(--text);
}

/* Wizard chrome */
.wizard-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.wizard-back {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}
.wizard-back:hover { text-decoration: underline; }
.wizard-step-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}
.wizard-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}
.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 1px solid var(--border);
}
.wizard-step-num {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
}
.wizard-step-title { font-size: 0.85rem; color: var(--text); }
.wizard-step.current {
    border-color: var(--primary);
    background: #ebf4ff;
}
.wizard-step.current .wizard-step-num {
    background: var(--primary);
    color: white;
}
.wizard-step.current .wizard-step-title { font-weight: 600; color: var(--primary); }
.wizard-step.completed .wizard-step-num {
    background: var(--success);
    color: white;
}
.wizard-step-sep {
    flex: 0 0 1.5rem;
    height: 2px;
    background: var(--border);
}

/* Wizard collector list */
.wizard-collector-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}
.wizard-collector-card {
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.wizard-collector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.wizard-collector-header h3 {
    margin: 0;
    font-size: 1.05rem;
}
.wizard-collector-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.6rem;
}

/* Environment detection card */
.env-detection {
    border-left-color: var(--primary-light);
    flex-direction: column;
    align-items: flex-start;
}
.env-detection-hint {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Collector health widget on admin dashboard */
.collector-widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0 1.5rem;
}
.collector-widget.has-failing { border-left-color: var(--warning); }
.collector-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.collector-widget-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--primary);
}
.collector-widget-header a {
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
}
.collector-widget-header a:hover { text-decoration: underline; }
.collector-widget-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}
.collector-widget-stat {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}
.collector-widget-stat .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}
.collector-widget-stat .stat-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 0.15rem;
    line-height: 1.1;
}
.collector-widget-stat .stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}
.collector-widget-alert {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #feebc8;
    color: var(--warning);
    border-radius: var(--radius);
    font-size: 0.85rem;
}
.collector-widget-alert a {
    color: var(--warning);
    font-weight: 600;
    text-decoration: underline;
}

.inline-form {
    display: inline;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.narrow-page {
    max-width: 520px;
    margin: 60px auto;
}

.issued-key-value {
    display: block;
    padding: 8px;
    word-break: break-all;
    user-select: all;
}

.commit-message {
    white-space: pre-wrap;
    max-width: 480px;
    margin: 0;
    font-size: 0.85em;
}
