/* =============================================================================
   ALLUMNOVA AUDIT & SPECIFICATION STUDIO — PRODUCTION SAAS DESIGN SYSTEM
   Linear / Notion / Stripe Dashboard Grade UI
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Color Palette - Obsidian Dark (Default) */
    --bg-app: #090d16;
    --bg-sidebar: #0d121f;
    --bg-topbar: rgba(13, 18, 31, 0.85);
    --bg-card: #121829;
    --bg-card-hover: #161e33;
    --bg-card-secondary: #0a0e1a;
    --bg-input: #080c16;
    --bg-elevated: #1a2238;
    --bg-modal: #101626;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.1);
    --border-card-hover: rgba(99, 102, 241, 0.35);
    --border-focus: #6366f1;

    /* Typography */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    /* Brand / Accent */
    --brand-primary: #6366f1;
    --brand-primary-hover: #4f46e5;
    --brand-primary-subtle: rgba(99, 102, 241, 0.15);
    --brand-cyan: #06b6d4;

    /* Status Colors */
    --status-approved: #10b981;
    --status-approved-bg: rgba(16, 185, 129, 0.12);
    --status-approved-border: rgba(16, 185, 129, 0.3);

    --status-modify: #f59e0b;
    --status-modify-bg: rgba(245, 158, 11, 0.12);
    --status-modify-border: rgba(245, 158, 11, 0.3);

    --status-discussion: #a855f7;
    --status-discussion-bg: rgba(168, 85, 247, 0.12);
    --status-discussion-border: rgba(168, 85, 247, 0.3);

    --status-defer: #64748b;
    --status-defer-bg: rgba(100, 116, 139, 0.12);
    --status-defer-border: rgba(100, 116, 139, 0.3);

    --status-remove: #ef4444;
    --status-remove-bg: rgba(239, 68, 68, 0.12);
    --status-remove-border: rgba(239, 68, 68, 0.3);

    --status-pending: #38bdf8;
    --status-pending-bg: rgba(56, 189, 248, 0.12);
    --status-pending-border: rgba(56, 189, 248, 0.3);

    /* Dimensions & Radii */
    --sidebar-width: 280px;
    --topbar-height: 64px;
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Shadows */
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.88);
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-card-secondary: #f1f5f9;
    --bg-input: #ffffff;
    --bg-elevated: #ffffff;
    --bg-modal: #ffffff;

    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-card: rgba(0, 0, 0, 0.09);
    --border-card-hover: rgba(99, 102, 241, 0.4);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-elevated: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

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

html, body {
    height: 100%;
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* SaaS App Shell */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */
.saas-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 50;
    height: 100%;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand-icon-box {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.brand-text-col {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.brand-badge-tag {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-nav-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 6px 10px;
    margin-bottom: 4px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: all var(--transition-fast);
}

.sidebar-nav-item:hover {
    background: var(--brand-primary-subtle);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: var(--brand-primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.sidebar-nav-item i {
    font-size: 0.95rem;
    margin-right: 10px;
    width: 18px;
    text-align: center;
}

.nav-count-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav-item.active .nav-count-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Parts Tree List in Sidebar */
.parts-tree-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

.part-tree-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.part-tree-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.part-tree-item.active {
    background: rgba(99, 102, 241, 0.18);
    color: var(--brand-primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-status-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--brand-primary);
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
}

.sync-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--status-approved);
    font-weight: 600;
}

.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--status-approved);
    box-shadow: 0 0 8px var(--status-approved);
}

/* =============================================================================
   MAIN CONTAINER & TOPBAR
   ============================================================================= */
.main-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

.saas-topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 40;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.breadcrumb-nav span.current {
    color: var(--text-primary);
    font-weight: 600;
}

.topbar-center {
    flex: 1;
    max-width: 480px;
}

.search-box-wrap {
    position: relative;
    width: 100%;
}

.search-icon-inside {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-input-field {
    width: 100%;
    height: 36px;
    padding: 0 34px 0 34px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.search-input-field:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px var(--brand-primary-subtle);
}

.search-kbd-hint {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
}

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

.audit-score-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-card-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
}

.score-text-group {
    display: flex;
    flex-direction: column;
}

.score-label-small {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.score-value-bold {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--status-approved);
}

.topbar-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =============================================================================
   BUTTONS & CONTROLS DESIGN SYSTEM
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-card-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* =============================================================================
   PAGE CONTENT AREA
   ============================================================================= */
.content-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px 60px;
    scroll-behavior: smooth;
}

.content-max-width {
    max-width: 1180px;
    margin: 0 auto;
}

/* KPI Metrics Bar */
.kpi-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.kpi-card:hover {
    border-color: var(--border-card-hover);
    transform: translateY(-1px);
}

.kpi-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.kpi-info-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-subtext {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Secondary Filter & Mode Toolbar */
.section-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-left-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    height: 34px;
    padding: 0 30px 0 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.filter-select:focus {
    border-color: var(--brand-primary);
}

.status-chip-group {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
}

.filter-chip {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}

/* =============================================================================
   SPECIFICATION CARDS (LINEAR-GRADE REDESIGN)
   ============================================================================= */
.spec-cards-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.spec-saas-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    overflow: hidden;
}

.spec-saas-card:hover {
    border-color: var(--border-card-hover);
    box-shadow: var(--shadow-elevated);
}

.spec-card-header {
    padding: 18px 22px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.spec-header-left {
    flex: 1;
    min-width: 0;
}

.spec-meta-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.badge-part {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--brand-primary);
    background: var(--brand-primary-subtle);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    letter-spacing: 0.03em;
}

.badge-marker {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.marker-ESTABLISHED { background: rgba(16, 185, 129, 0.14); color: #34d399; }
.marker-INFERRED { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
.marker-HYPOTHESIS { background: rgba(168, 85, 247, 0.14); color: #c084fc; }
.marker-DECISION_REQUIRED { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.marker-RECOMMENDATION { background: rgba(236, 72, 153, 0.14); color: #f472b6; }

.badge-edited {
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
}

.spec-card-title {
    font-family: var(--font-heading);
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.spec-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.status-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-APPROVED { background: var(--status-approved-bg); color: var(--status-approved); border: 1px solid var(--status-approved-border); }
.status-MODIFY { background: var(--status-modify-bg); color: var(--status-modify); border: 1px solid var(--status-modify-border); }
.status-NEEDS_DISCUSSION { background: var(--status-discussion-bg); color: var(--status-discussion); border: 1px solid var(--status-discussion-border); }
.status-DEFER { background: var(--status-defer-bg); color: var(--status-defer); border: 1px solid var(--status-defer-border); }
.status-REMOVE { background: var(--status-remove-bg); color: var(--status-remove); border: 1px solid var(--status-remove-border); }
.status-PENDING { background: var(--status-pending-bg); color: var(--status-pending); border: 1px solid var(--status-pending-border); }

/* Key Takeaway Callout */
.spec-summary-callout {
    padding: 12px 22px;
    background: var(--bg-card-secondary);
    border-left: 3px solid var(--brand-primary);
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.spec-summary-callout strong {
    color: var(--text-primary);
}

/* Card Body & Markdown Content */
.spec-card-body {
    padding: 20px 22px;
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.spec-card-body p {
    margin-bottom: 12px;
}

.spec-card-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.spec-card-body h3, .spec-card-body h4 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin: 18px 0 8px;
    font-weight: 700;
}

.spec-card-body h3 { font-size: 1.05rem; }
.spec-card-body h4 { font-size: 0.95rem; }

.spec-card-body ul, .spec-card-body ol {
    margin: 8px 0 14px 20px;
}

.spec-card-body li {
    margin-bottom: 4px;
}

.spec-card-body pre {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin: 12px 0;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #38bdf8;
    line-height: 1.45;
}

.spec-card-body code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: #e0e7ff;
}

.spec-card-body blockquote {
    border-left: 3px solid var(--brand-primary);
    padding: 8px 14px;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 12px 0;
    font-style: italic;
    color: var(--text-primary);
}

/* Beautiful Structured Tables */
.spec-card-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.84rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.spec-card-body th, .spec-card-body td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.spec-card-body th {
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
}

.spec-card-body tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Checkpoint Action Bar (Linear-style Reviewer Box) */
.spec-checkpoint-bar {
    background: var(--bg-card-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: 16px 22px;
}

.checkpoint-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.checkpoint-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.checkpoint-label i {
    color: var(--brand-primary);
}

.sync-status-text {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.checkpoint-controls-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-segmented-group {
    display: flex;
    background: var(--bg-input);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    gap: 3px;
    flex-wrap: wrap;
}

.btn-segment {
    flex: 1;
    min-width: 100px;
    padding: 7px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-segment:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-segment.selected[data-val="APPROVED"] { background: var(--status-approved); color: #fff; }
.btn-segment.selected[data-val="MODIFY"] { background: var(--status-modify); color: #000; }
.btn-segment.selected[data-val="NEEDS_DISCUSSION"] { background: var(--status-discussion); color: #fff; }
.btn-segment.selected[data-val="DEFER"] { background: var(--status-defer); color: #fff; }
.btn-segment.selected[data-val="REMOVE"] { background: var(--status-remove); color: #fff; }

.checkpoint-inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.input-saas {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    transition: border-color var(--transition-fast);
}

.input-saas:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.textarea-saas {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
    min-height: 36px;
    transition: border-color var(--transition-fast);
}

.textarea-saas:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.checkpoint-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.reviewer-tag-box {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.reviewer-tag-box strong {
    color: var(--text-secondary);
}

/* =============================================================================
   RAPID REVIEW MODE (CARD DECK)
   ============================================================================= */
.rapid-deck-wrapper {
    max-width: 740px;
    margin: 20px auto;
}

.rapid-deck-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-elevated);
}

.rapid-progress-bar-wrap {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 24px;
}

.rapid-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #10b981);
    transition: width var(--transition-normal);
}

/* =============================================================================
   AUDIT SCORECARD & ANALYTICS
   ============================================================================= */
.scorecard-saas-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.scorecard-table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.scorecard-table-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.scorecard-table-card th, .scorecard-table-card td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.scorecard-table-card th {
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: var(--radius-full);
}

/* =============================================================================
   MODAL DIALOG (LINEAR-STYLE)
   ============================================================================= */
.saas-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.saas-modal-dialog {
    background: var(--bg-modal);
    border: 1px solid var(--border-card-hover);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-elevated);
    overflow: hidden;
}

.modal-header-row {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer-row {
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-card-secondary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Toast */
.saas-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--brand-primary);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    font-weight: 600;
    box-shadow: var(--shadow-elevated);
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 2000;
    animation: slideUp 200ms ease-out;
}

@keyframes slideUp {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =============================================================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
   ============================================================================= */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
    .kpi-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .content-scroll-container {
        padding: 20px 16px 40px;
    }
}

@media (max-width: 768px) {
    .saas-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: var(--shadow-elevated);
    }
    .saas-sidebar.mobile-open {
        transform: translateX(0);
    }
    .mobile-menu-btn {
        display: block;
    }
    .kpi-metrics-grid {
        grid-template-columns: 1fr;
    }
    .topbar-center {
        display: none;
    }
    .checkpoint-inputs-row {
        grid-template-columns: 1fr;
    }
    .status-segmented-group {
        flex-direction: column;
    }
}
