/* ============================================================
   Simpoli Design System — Global Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand */
    --brand: #4217F0;
    --brand-hover: #3614c0;
    --brand-light: #f0edff;
    --brand-lighter: #f8f6ff;
    --brand-gradient: linear-gradient(135deg, #4217F0 0%, #6B4AFF 100%);
    --brand-focus: rgba(66, 23, 240, 0.1);

    /* Text */
    --text-primary: #152237;
    --text-secondary: #666;
    --text-muted: #888;
    --text-on-brand: #FFFFFF;

    /* Surfaces */
    --bg: #FFFFFF;
    --surface: #FFFFFF;
    --surface-hover: #f8f6ff;
    --border: #e0e0e0;
    --border-light: #eee;

    /* Status */
    --success: #2e7d32;
    --success-bg: #e8f5e9;
    --warning: #f0a500;
    --warning-bg: #fff8e6;
    --error: #c62828;
    --error-bg: #fce4ec;
    --info: #1565c0;
    --info-bg: #e3f2fd;

    /* Font */
    --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Sizing */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --max-width: 1140px;
    --transition: all 0.2s;
}

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

html {
    scrollbar-gutter: stable;   /* prevent layout shift without forcing scrollbar */
}

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Navigation Shell (injected by shell.js)
   ============================================================ */

.shell-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shell-nav-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.shell-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    color: var(--brand);
}

.shell-logo svg {
    width: 28px;
    height: 28px;
}

.shell-nav-links {
    display: flex;
    gap: 4px;
}

.shell-nav-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.shell-nav-links a:hover {
    background: var(--brand-light);
    color: var(--brand);
}

.shell-nav-links a.active {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 600;
}

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

.shell-user-menu {
    position: relative;
}

.shell-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.shell-user-btn:hover {
    border-color: var(--brand);
    background: var(--brand-lighter);
}

.shell-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.shell-user-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    display: none;
    z-index: 1001;
}

.shell-user-dropdown.open {
    display: block;
}

.shell-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.shell-user-dropdown-item:hover {
    background: var(--brand-lighter);
}

.shell-user-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* Mobile nav */
.shell-mobile-toggle {
    display: none;
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .shell-mobile-toggle {
        display: block;
    }

    .shell-nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .shell-nav-links.open {
        display: flex;
    }

    .shell-nav-links a {
        padding: 12px 16px;
    }
}

/* ============================================================
   Page container
   ============================================================ */

.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.page-breadcrumb a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.page-breadcrumb a:hover {
    color: var(--brand-hover);
    text-decoration: underline;
}

.page-breadcrumb svg {
    width: 12px;
    height: 12px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--brand);
    color: var(--text-on-brand);
}

.btn-primary:hover {
    background: var(--brand-hover);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--brand);
    background: var(--brand-lighter);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-danger {
    color: var(--error);
}

.btn-danger:hover {
    background: var(--error-bg);
}

/* ============================================================
   Cards
   ============================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
}

.card-clickable {
    cursor: pointer;
}

.card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 23, 240, 0.15);
    border-color: var(--brand);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ============================================================
   Forms
   ============================================================ */

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

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

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition);
    background: var(--bg);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-focus);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ============================================================
   Section blocks
   ============================================================ */

.section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.card-heading i { color: var(--brand); }

.section-link {
    font-size: 13px;
    color: var(--brand);
    text-decoration: none;
    font-weight: 500;
}

.section-link:hover {
    text-decoration: underline;
}

/* ============================================================
   Badges and tags
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-critical { background: var(--error-bg); color: var(--error); }
.badge-high { background: #fff3e0; color: #e65100; }
.badge-medium { background: var(--warning-bg); color: #f57f17; }
.badge-low { background: var(--info-bg); color: var(--info); }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 500;
}

/* ============================================================
   Lists
   ============================================================ */

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--brand-lighter);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.list-item-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.list-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================================
   Tabs
   ============================================================ */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.tab:hover {
    color: var(--brand);
}

.tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

.tab-content {
    display: none;
    padding: 24px 0;
}

.tab-content.active {
    display: block;
}

/* ============================================================
   Task indicators
   ============================================================ */

.task-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-dot-open { background: var(--error); }
.task-dot-done { background: var(--success); }

/* ============================================================
   Empty states
   ============================================================ */

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

.empty-state-icon {
    margin-bottom: 12px;
}

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

.empty-state-text {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ============================================================
   Loading
   ============================================================ */

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

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

/* ============================================================
   Utilities
   ============================================================ */

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ============================================================
   Upgrade gate modal
   ============================================================ */

.upgrade-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.upgrade-modal {
    text-align: center;
    max-width: 440px;
}

.upgrade-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.upgrade-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upgrade-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.upgrade-divider {
    width: 40px;
    height: 2px;
    background: var(--brand);
    margin: 0 auto 24px;
}

.upgrade-cta-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upgrade-btn {
    display: inline-flex;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
}

.upgrade-back {
    display: block;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}

.upgrade-back:hover {
    color: var(--brand);
}

/* Locked placeholder cards for lighthouse home page */
.locked-card {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    color: var(--text-muted);
}

.locked-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

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

.locked-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Faded gate overlay — content visible but not interactive */
.faded-gate-container {
    position: relative;
}

.faded-gate-container > *:not(.faded-gate-overlay) {
    opacity: 0.25;
    pointer-events: none;
    user-select: none;
    filter: blur(1px);
}

.faded-gate-overlay {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* ============================================================
   Report View — shared component styles
   Used by workbench output, report page, and share page
   ============================================================ */
.report-view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.report-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

.report-view-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.report-view-meta-item a {
    color: var(--brand);
    text-decoration: none;
}

.report-view-meta-item a:hover {
    text-decoration: underline;
}

.report-view-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.report-view-objective {
    padding: 16px;
    background: #f8f6ff;
    border-left: 3px solid var(--brand);
    border-radius: 0 8px 8px 0;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.report-view-objective-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

/* ============================================================
   Report Content — shared markdown rendering styles
   ============================================================ */
.rendered-md {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
}

.rendered-md h1 { font-size: 20px; margin: 24px 0 10px; font-weight: 600; }
.rendered-md h2 { font-size: 17px; margin: 20px 0 8px; font-weight: 600; }
.rendered-md h3 { font-size: 15px; margin: 16px 0 6px; font-weight: 600; }
.rendered-md p { margin-bottom: 12px; }
.rendered-md ul, .rendered-md ol { padding-left: 24px; margin-bottom: 12px; }
.rendered-md li { margin-bottom: 4px; }

.rendered-md table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}

.rendered-md table th,
.rendered-md table td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.rendered-md table th {
    background: #f9f9f9;
    font-weight: 600;
}

.rendered-md tr:nth-child(even) { background: #fafafa; }
.rendered-md tr:hover { background: #f0f0f0; }

.rendered-md a {
    color: var(--brand);
    text-decoration: none;
}

.rendered-md a:hover {
    text-decoration: underline;
}

.rendered-md pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
}

.rendered-md code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 13px;
}

.rendered-md pre code {
    background: none;
    padding: 0;
}

.rendered-md blockquote {
    border-left: 3px solid var(--brand);
    margin: 12px 0;
    padding: 8px 16px;
    background: #f8f6ff;
    border-radius: 0 6px 6px 0;
}
