/* ===== CSS Variables – Light Theme ===== */
:root {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --text: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-label: #555555;
    --border: #e0e0e0;
    --chip-bg: #f0f2f5;
    --section-border: #f0f2f5;
    --row-alt: #f9f9fb;
    --row-border: #efefef;
    --drop-hover-bg: #e8f0fe;
    --drop-hover-border: #0d47a1;
    --status-info-bg: #e8f0fe;
    --status-info-color: #1a73e8;
    --status-error-bg: #fdecea;
    --status-error-color: #c62828;
    --status-success-bg: #e6f4ea;
    --status-success-color: #2e7d32;
    --export-bg: #e8f0fe;
    --export-color: #1a73e8;
    --export-hover-bg: #d2e3fc;
    --export-border: #1a73e8;
    --accent: #1a73e8;
    --accent-hover: #1558b0;
    --accent-dark: #0d47a1;
    --header-gradient: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
}

/* ===== CSS Variables – Dark Theme ===== */
[data-theme="dark"] {
    --bg: #0f1117;
    --card-bg: #1e2130;
    --card-shadow: 0 2px 16px rgba(0,0,0,0.45);
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-label: #94a3b8;
    --border: #2d3748;
    --chip-bg: #252d3d;
    --section-border: #252d3d;
    --row-alt: #1a2035;
    --row-border: #2d3748;
    --drop-hover-bg: #1e2a3a;
    --drop-hover-border: #4a9eff;
    --status-info-bg: #172237;
    --status-info-color: #60a5fa;
    --status-error-bg: #2d1b1b;
    --status-error-color: #fc8181;
    --status-success-bg: #1a2e1a;
    --status-success-color: #68d391;
    --export-bg: #172237;
    --export-color: #60a5fa;
    --export-hover-bg: #1e2f4d;
    --export-border: #4a9eff;
    --accent: #4a9eff;
    --accent-hover: #2980e8;
    --accent-dark: #2563eb;
    --header-gradient: linear-gradient(135deg, #1557a8 0%, #0a2f6b 100%);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.25s, color 0.25s;
}

/* ===== Header ===== */
header {
    background: var(--header-gradient);
    color: #fff;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

header .logo { font-size: 1.8rem; }
header h1   { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.02em; }

/* ===== Theme Toggle Button ===== */
.theme-toggle {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    border: 1.5px solid rgba(255,255,255,0.35);
    border-radius: 50px;
    padding: 6px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.83rem;
    font-weight: 600;
    color: #fff;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: rgba(255,255,255,0.28);
    border-color: rgba(255,255,255,0.6);
}
.theme-toggle .toggle-icon { font-size: 1.05rem; line-height: 1; }

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    gap: 0;
    background: var(--header-gradient);
    border-bottom: none;
    padding: 0 32px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: 0;
    padding: 16px 28px;
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s, border-color 0.2s;
    letter-spacing: 0.02em;
}

.tab-btn:hover { color: #fff; }

.tab-btn.active {
    color: #fff;
    border-bottom-color: #fff;
}

/* ===== Tool Sections ===== */
#section-review,
#section-generator,
#section-summary {
    flex: none;
}

/* ===== Review iframe ===== */
#section-review iframe {
    width: 100%;
    display: block;
    border: none;
    min-height: 100vh;
}

/* ===== Generator layout ===== */
.gen-wrap {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 24px 60px;
    width: 100%;
}

/* ===== Upload Card ===== */
.upload-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 36px;
    text-align: center;
    margin-bottom: 28px;
    transition: background 0.25s, box-shadow 0.25s;
}

.upload-card h2 { font-size: 1.25rem; margin-bottom: 8px; color: var(--accent); }
.upload-card p  { color: var(--text-secondary); margin-bottom: 24px; font-size: 0.95rem; }

.drop-zone {
    border: 2px dashed var(--accent);
    border-radius: 10px;
    padding: 48px 24px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
    background: var(--drop-hover-bg);
    border-color: var(--drop-hover-border);
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.drop-zone .icon  { font-size: 3rem; display: block; margin-bottom: 12px; }
.drop-zone .label { font-size: 1rem; color: var(--text-secondary); }
.drop-zone .hint  { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }

.btn-generate {
    margin-top: 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 36px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.btn-generate:disabled           { opacity: 0.45; cursor: not-allowed; }
.btn-generate:not(:disabled):hover { background: var(--accent-hover); }

/* ===== Status Bar ===== */
#gen-status {
    display: none;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    transition: background 0.25s;
}
#gen-status.info    { background: var(--status-info-bg);    color: var(--status-info-color);    display: block; }
#gen-status.error   { background: var(--status-error-bg);   color: var(--status-error-color);   display: block; }
#gen-status.success { background: var(--status-success-bg); color: var(--status-success-color); display: block; }

/* ===== Section Cards ===== */
.section-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 28px 32px;
    margin-bottom: 28px;
    display: none;
    transition: background 0.25s, box-shadow 0.25s;
}
.section-card.visible { display: block; }

.section-card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--section-border);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== Section Label ===== */
.section-label {
    font-size: 0.9rem;
    color: var(--text-label);
    margin-bottom: 14px;
    font-weight: 600;
}

/* ===== Export Button ===== */
.btn-export {
    background: var(--export-bg);
    color: var(--export-color);
    border: 1px solid var(--export-border);
    padding: 6px 18px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.btn-export:hover { background: var(--export-hover-bg); }

/* ===== Summary chips ===== */
.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 4px;
}
.stat-chip {
    background: var(--chip-bg);
    border-radius: 8px;
    padding: 12px 20px;
    min-width: 120px;
    text-align: center;
    flex: 1;
    transition: background 0.25s;
}
.stat-chip .num { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-chip .lbl { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Test Case Table ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
    background: var(--accent);
    color: #fff;
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
}
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--row-border);
    vertical-align: top;
    line-height: 1.45;
    color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--drop-hover-bg); transition: background 0.15s; }

/* ===== Severity Badges ===== */
.badge-severity {
    display: inline-block;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.sev-showstopper { background: #3d0000; color: #fff; }
.sev-critical    { background: #b71c1c; color: #fff; }
.sev-major       { background: #e65100; color: #fff; }
.sev-minor       { background: #f9a825; color: #333; }

/* ===== Type Badges ===== */
.badge-type {
    display: inline-block;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.type-functional     { background: #e8f0fe; color: #1a73e8; }
.type-non-functional { background: #e8f5e9; color: #2e7d32; }
.type-ui             { background: #f3e5f5; color: #6a1b9a; }
.type-privacy        { background: #fff3e0; color: #e65100; }
.type-security       { background: #fce4ec; color: #c62828; }

[data-theme="dark"] .type-functional     { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .type-non-functional { background: #1a2e1a; color: #68d391; }
[data-theme="dark"] .type-ui             { background: #2d1b3d; color: #c084fc; }
[data-theme="dark"] .type-privacy        { background: #2d1e0e; color: #fb923c; }
[data-theme="dark"] .type-security       { background: #2d1b1b; color: #fc8181; }

/* ===== Structured list inside table cells ===== */
.tc-list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.6;
}
.tc-list li {
    margin-bottom: 3px;
}
.tc-list li:last-child {
    margin-bottom: 0;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    header { padding: 12px 16px; }
    header .logo { font-size: 1.4rem; }
    header h1    { font-size: 1.15rem; }
    .tab-nav     { padding: 0 12px; }
    .tab-btn     { padding: 12px 14px; font-size: 0.85rem; }
    .gen-wrap    { padding: 0 12px 40px; }
    .upload-card { padding: 24px 16px; }
    .section-card { padding: 20px 16px; }
    .theme-toggle .toggle-text { display: none; }
}

/* ===== History Tab ===== */

/* ── Styles needed from analyzer for the modal detail view ── */
:root {
    --feature-tag-bg:    #e8f0fe;
    --feature-tag-color: #1a73e8;
    --no-gaps-color:     #2e7d32;
    --gap-item-bg:       #fff8f8;
    --ok-item-bg:        #f6fef6;
}
[data-theme="dark"] {
    --feature-tag-bg:    #1e3a5f;
    --feature-tag-color: #60a5fa;
    --no-gaps-color:     #68d391;
    --gap-item-bg:       #2d1b1b;
    --ok-item-bg:        #1a2e1a;
}

.feature-tag {
    background: var(--feature-tag-bg);
    color: var(--feature-tag-color);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.82rem;
    font-weight: 500;
}

.severity-badge {
    display: inline-block;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.severity-showstopper { background: #3d0000; color: #fff; }
.severity-critical    { background: #b71c1c; color: #fff; }
.severity-major       { background: #e65100; color: #fff; }
.severity-minor       { background: #f9a825; color: #333; }

.icon-mark { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.hist-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px 60px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.hist-panel {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 24px;
}

.hist-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.hist-panel-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.hist-count-badge {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.hist-clear-btn {
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.hist-clear-btn:hover {
    background: #fdecea;
    border-color: #e53935;
    color: #c62828;
}

[data-theme="dark"] .hist-clear-btn:hover {
    background: #2d1b1b;
    border-color: #fc8181;
    color: #fc8181;
}

.hist-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hist-empty {
    color: var(--text-muted);
    font-size: 0.92rem;
    padding: 20px 0 4px;
    text-align: center;
}

/* Entry card */
.hist-entry-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--chip-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: box-shadow 0.18s;
}

.hist-entry-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

[data-theme="dark"] .hist-entry-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.hist-entry-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.hist-file-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.hist-entry-info {
    min-width: 0;
}

.hist-entry-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hist-entry-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.hist-entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.hist-meta-badge {
    background: var(--export-bg);
    color: var(--export-color);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.78rem;
    font-weight: 600;
}

.hist-badge-gap {
    background: #fdecea;
    color: #c62828;
}

[data-theme="dark"] .hist-badge-gap {
    background: #2d1b1b;
    color: #fc8181;
}

.hist-entry-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.hist-btn {
    border-radius: 8px;
    padding: 6px 13px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.hist-btn-view {
    background: var(--export-bg);
    color: var(--export-color);
    border-color: var(--export-border);
}

.hist-btn-view:hover {
    background: var(--export-hover-bg);
}

.hist-btn-export {
    background: #e6f4ea;
    color: #2e7d32;
    border-color: #2e7d32;
}

.hist-btn-export:hover {
    background: #c8e6c9;
}

[data-theme="dark"] .hist-btn-export {
    background: #1a2e1a;
    color: #68d391;
    border-color: #68d391;
}

[data-theme="dark"] .hist-btn-export:hover {
    background: #203a20;
}

.hist-btn-delete {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.hist-btn-delete:hover {
    background: #fdecea;
    color: #c62828;
    border-color: #e53935;
}

[data-theme="dark"] .hist-btn-delete:hover {
    background: #2d1b1b;
    color: #fc8181;
    border-color: #fc8181;
}

/* ===== History Pagination ===== */
.hist-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 18px 0 6px;
    flex-wrap: wrap;
}

.hist-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1;
}

.hist-page-btn:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

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

.hist-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.hist-page-arrow {
    font-size: 1.15rem;
    padding: 0 12px;
}


.hist-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

.hist-modal-overlay[hidden] {
    display: none;
}

body.hist-modal-open {
    overflow: hidden;
}

.hist-modal {
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.28);
    width: 100%;
    max-width: 1080px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

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

.hist-modal-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hist-modal-close {
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.18s;
}

.hist-modal-close:hover {
    background: var(--chip-bg);
}

.hist-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Detail view elements */
.hist-detail-summary {
    margin-bottom: 20px;
}

.hist-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hist-stat-chip {
    background: var(--chip-bg);
    border-radius: 10px;
    padding: 12px 18px;
    border-top: 3px solid var(--border);
    min-width: 90px;
    text-align: center;
}

.hist-stat-chip .num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.hist-stat-chip .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.hist-feature-summary {
    background: var(--chip-bg);
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.hist-feature-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.6;
}

.hist-features-section {
    margin-bottom: 18px;
}

.hist-feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.hist-gap-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 14px;
}

.hist-gap-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.hist-no-gaps {
    color: var(--no-gaps-color, #2e7d32);
    font-size: 0.9rem;
}

.hist-gap-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hist-gap-item,
.hist-ok-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text);
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--gap-item-bg, #fff8f8);
}

[data-theme="dark"] .hist-gap-item {
    background: #2d1b1b;
}

.hist-ok-item {
    background: var(--ok-item-bg, #f6fef6);
}

[data-theme="dark"] .hist-ok-item {
    background: #1a2e1a;
}

.hist-covered-list {
    margin-top: 8px;
}

/* Detail table */
.hist-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.hist-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: var(--text);
}

.hist-detail-table th {
    background: var(--chip-bg);
    color: var(--text-label);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.hist-detail-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--row-border);
    vertical-align: top;
    max-width: 260px;
}

.hist-detail-table tr:nth-child(even) td {
    background: var(--row-alt);
}

/* Responsive history */
@media (max-width: 640px) {
    .hist-wrap { padding: 16px 12px 40px; }
    .hist-panel { padding: 16px; }
    .hist-entry-card { flex-direction: column; align-items: flex-start; }
    .hist-entry-actions { width: 100%; justify-content: flex-end; }
    .hist-modal-overlay { padding: 16px 8px; }
    .hist-modal-body { padding: 14px 16px; }
}

/* ===== Test Case Summary Tab ===== */

.sum-wrap {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 24px 60px;
    width: 100%;
}

/* ── Status bar for summary tab ── */
#sum-status {
    display: none;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    transition: background 0.25s;
}
#sum-status.info    { background: var(--status-info-bg);    color: var(--status-info-color);    display: block; }
#sum-status.error   { background: var(--status-error-bg);   color: var(--status-error-color);   display: block; }
#sum-status.success { background: var(--status-success-bg); color: var(--status-success-color); display: block; }

/* ── AI model selector row ── */
.sum-model-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.sum-model-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sum-model-select {
    background: var(--card-bg);
    border: 1.5px solid var(--accent);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 0.95rem;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.25s;
    min-width: 280px;
    outline: none;
}

.sum-model-select:focus {
    border-color: var(--accent-hover);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

/* ── API key row ── */
.sum-apikey-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.sum-apikey-row[hidden] { display: none; }

.sum-apikey-input {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 0.9rem;
    color: var(--text);
    min-width: 320px;
    max-width: 520px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.sum-apikey-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.sum-apikey-input::placeholder {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Summarise button ── */
.btn-summarise {
    margin-top: 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 36px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.btn-summarise:disabled             { opacity: 0.45; cursor: not-allowed; }
.btn-summarise:not(:disabled):hover { background: var(--accent-hover); }

/* ── Summary content body ── */
.sum-content-body {
    color: var(--text);
    line-height: 1.7;
    font-size: 0.95rem;
}

.sum-executive {
    background: var(--chip-bg);
    border-left: 4px solid var(--accent);
    border-radius: 0 10px 10px 0;
    padding: 16px 20px;
    margin-bottom: 22px;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
}

.sum-sub-heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--section-border);
}

.sum-coverage-section,
.sum-uc-section,
.sum-obs-section {
    margin-bottom: 18px;
}

.sum-uc-list,
.sum-obs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sum-uc-list li,
.sum-obs-list li {
    padding: 8px 14px;
    background: var(--chip-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text);
}

.sum-obs-list li {
    border-left: 3px solid var(--accent);
}

/* ── Built-in narrative output ── */
.sum-narrative-intro {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.sum-capability-list {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sum-capability-list li {
    font-size: 0.93rem;
    color: var(--text);
    line-height: 1.55;
}

.sum-feature-block {
    margin-bottom: 18px;
    padding: 14px 18px;
    background: var(--chip-bg);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.sum-feature-name {
    margin: 0 0 8px;
    font-size: 0.97rem;
    color: var(--text);
}

.sum-scenario-list {
    list-style: disc;
    padding-left: 18px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sum-scenario-list li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sum-more-hint {
    font-size: 0.83rem !important;
    color: var(--text-muted) !important;
    list-style: none !important;
    margin-left: -18px;
}

.sum-ungrouped-note {
    margin-top: 18px;
    font-size: 0.88rem;
    color: var(--text-muted);
    font-style: italic;
}

/* History modal content for summary entries */
.hist-sum-content {
    background: var(--chip-bg);
    border-radius: 10px;
    padding: 16px 20px;
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.7;
    margin-bottom: 16px;
}

/* Responsive for summary tab */
@media (max-width: 640px) {
    .sum-wrap    { padding: 0 12px 40px; }
    .sum-model-row,
    .sum-apikey-row { flex-direction: column; align-items: stretch; gap: 8px; }
    .sum-model-select,
    .sum-apikey-input { min-width: unset; width: 100%; }
}

/* ===== Generator Standards Banner ===== */
.gen-standards-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: var(--chip-bg, #f0f4ff);
    border: 1px solid var(--border, #d0d8f0);
    border-radius: 8px;
    font-size: .84rem;
    color: var(--text, #333);
    line-height: 1.6;
}
.gen-standards-banner strong { color: var(--accent, #1a73e8); }
.standards-ref {
    margin-left: 6px;
    font-style: italic;
    opacity: .72;
    font-size: .8rem;
}

/* Technique badge in generator table */
.badge-technique {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--chip-bg, #eef2ff);
    color: var(--accent, #1a73e8);
    border: 1px solid var(--border, #d0d8f0);
    white-space: nowrap;
}
/* Technique badge in standards banner */
.tech-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    background: var(--accent, #1a73e8);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
}
