/* === Demo Cards (Hub Page) === */

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

.demo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.demo-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.demo-card .card-icon {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.demo-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.demo-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex: 1;
}

.demo-card .card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

.demo-card .card-link::after {
    content: "\2192";
}

/* === Upload Zone === */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-zone .upload-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.upload-zone .upload-text {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.upload-zone .upload-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.upload-zone input[type="file"] {
    display: none;
}

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

.loading-container {
    display: none;
    text-align: center;
    padding: 3rem 1.5rem;
}

.loading-container.active {
    display: block;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.25rem;
}

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

.loading-message {
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: opacity 0.3s;
}

/* === Report === */

.report {
    display: none;
}

.report.active {
    display: block;
}

.report-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.report-title h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.report-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.report-actions {
    display: flex;
    gap: 0.5rem;
}

/* === Buttons === */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.btn:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
}

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

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

/* === Accordion === */

.accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.accordion-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

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

.accordion-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.accordion-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
}

.accordion-chevron {
    color: var(--text-muted);
    transition: transform 0.25s;
    flex-shrink: 0;
}

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

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

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

.accordion-content {
    padding: 0 1.25rem 1.25rem;
}

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

.highlights {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.highlight-card {
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    border: 1px solid;
}

.highlight-card.good {
    background: var(--green-bg);
    border-color: rgba(34, 197, 94, 0.2);
}

.highlight-card.warning {
    background: var(--yellow-bg);
    border-color: rgba(234, 179, 8, 0.2);
}

.highlight-card.danger {
    background: var(--red-bg);
    border-color: rgba(239, 68, 68, 0.2);
}

.highlight-card.neutral {
    background: var(--blue-bg);
    border-color: rgba(59, 130, 246, 0.2);
}

.highlight-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.highlight-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.highlight-card.good .highlight-value { color: var(--green); }
.highlight-card.warning .highlight-value { color: var(--yellow); }
.highlight-card.danger .highlight-value { color: var(--red); }
.highlight-card.neutral .highlight-value { color: var(--blue); }

/* === Section Content (rendered markdown) === */

.section-content {
    line-height: 1.7;
    color: var(--text);
    font-size: 0.92rem;
}

.section-content p {
    margin-bottom: 0.75rem;
}

.section-content ul,
.section-content ol {
    margin: 0.5rem 0 0.75rem 1.25rem;
}

.section-content li {
    margin-bottom: 0.35rem;
}

.section-content strong {
    color: var(--text);
    font-weight: 600;
}

.section-content code {
    font-size: 0.85em;
}

/* === Error State === */

.error-container {
    display: none;
    background: var(--red-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius);
    padding: 1.25rem;
    color: var(--red);
}

.error-container.active {
    display: block;
}

/* === EAP Dashboard: Source Picker (Tabs) === */

.source-picker {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.source-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.source-tab {
    flex: 1;
    padding: 0.85rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    font-family: inherit;
}

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

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

.source-panel {
    display: none;
    padding: 1.5rem;
}

.source-panel.active {
    display: block;
}

/* === EAP Dashboard: Intacct Connect Form === */

.connect-form {
    text-align: center;
    padding: 1rem 0;
}

.connect-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.connect-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.connect-options {
    display: inline-grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    align-items: center;
    text-align: left;
    margin-bottom: 1.25rem;
}

.connect-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.connect-select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    min-width: 180px;
    outline: none;
    transition: border-color 0.2s;
}

.connect-select:focus {
    border-color: var(--accent);
}

/* === EAP Dashboard: Multi-file Upload Zone === */

.upload-zone-multi {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.file-slots {
    display: flex;
    gap: 1rem;
    margin: 1.25rem 0;
    width: 100%;
    max-width: 500px;
}

.file-slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s, background 0.2s;
}

.file-slot .slot-icon {
    font-size: 1.5rem;
}

.file-slot .slot-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.file-slot .slot-file {
    font-size: 0.8rem;
    color: var(--accent);
    word-break: break-all;
    text-align: center;
}

.file-slot.filled {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-zone-multi #upload-btn {
    margin-top: 0.5rem;
}

/* === EAP Dashboard: Workspace === */

.workspace {
    display: none;
}

.workspace.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 70vh;
}

.session-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
}

.session-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.session-sep {
    margin: 0 0.5rem;
}

/* === EAP Dashboard: Dashboard Area === */

.dashboard-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.dashboard-title {
    background: none;
    border: none;
    padding: 0;
}

.dashboard-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

/* === EAP Dashboard: Charts === */

.chart-container {
    min-height: 300px;
}

.chart-heading {
    margin-bottom: 0.75rem;
}

.chart-plot {
    min-height: 280px;
}

/* === EAP Dashboard: Data Tables === */

.table-heading {
    margin-bottom: 0.75rem;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: var(--surface-hover);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

/* === EAP Dashboard: Starter Queries === */

.starter-queries {
    text-align: center;
    padding: 2rem 1rem;
}

.starter-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.starter-btn {
    display: inline-block;
    margin: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.starter-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* === EAP Dashboard: Chat Area === */

.chat-area {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: 300px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
}

.chat-message {
    display: flex;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.user .chat-bubble {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-message.assistant .chat-bubble {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}

.chat-message.typing .chat-bubble {
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.chat-input-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
}

.chat-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--accent);
}

.chat-input::placeholder {
    color: var(--text-dim);
}

/* === Dashboard page layout === */

.dashboard-page .page-container {
    max-width: 1100px;
}

/* === Login Form === */

.login-form {
    max-width: 360px;
    margin: 2rem auto;
    text-align: center;
}

.login-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.login-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.login-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    width: 100%;
    box-sizing: border-box;
}

.login-input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-error {
    color: #ef4444;
    font-size: 0.85rem;
    min-height: 1.25rem;
    margin-bottom: 0.5rem;
}

.user-badge {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    margin-left: 0.75rem;
    color: var(--text-dim);
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    margin-left: 0.5rem;
}
