﻿body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #050816;
    color: #f9fafb;
}

.dashboard {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.card {
    background: #0b1020;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
}

.status-left {
    flex: 2;
}

.status-right {
    flex: 1;
    text-align: right;
}

.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    margin: 2px;
}

.pill-warn {
    background: rgba(245, 158, 11, 0.13);
    color: #fcd34d;
}

.pill-bad {
    background: rgba(248, 113, 113, 0.13);
    color: #fca5a5;
}

.pill-info {
    background: rgba(59, 130, 246, 0.13);
    color: #93c5fd;
}

.select-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
    margin-bottom: 6px;
}

.muted {
    color: #9ca3af;
    font-size: 12px;
}

.small {
    font-size: 12px;
}

.kpi-main {
    flex: 2;
    min-width: 320px;
}

.kpi-right-column {
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kpi-amount {
    font-size: 40px;
    font-weight: 700;
    margin: 8px 0;
}

.kpi-row {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.kpi-block {
    flex: 1;
    min-width: 130px;
    background: rgba(17, 24, 39, 0.72);
    border-radius: 10px;
    padding: 12px;
}

.kpi-label {
    font-size: 12px;
    color: #9ca3af;
}

.kpi-value {
    font-size: 18px;
    font-weight: 600;
    margin-top: 4px;
}

.tag-row {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
}

.tag {
    padding: 4px 8px;
    border-radius: 999px;
    background: #111827;
    color: #d1d5db;
}

.section-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.estate-movement {
    margin-top: 16px;
}

.estate-movement-main {
    font-size: 22px;
    font-weight: 600;
}

.fix-card {
    padding: 12px 14px;
    border-radius: 10px;
    background: #111827;
    margin-bottom: 8px;
    font-size: 13px;
}

.fix-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.fix-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 8px;
}

.btn-small {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    color: #fff;
    cursor: pointer;
}

.briefing-card {
    flex: 1;
}

.briefing-header {
    font-weight: 600;
    margin-bottom: 8px;
}

.chat-bubble {
    background: #111827;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12px;
    margin-bottom: 6px;
    line-height: 1.45;
}

.debug {
    margin-top: 16px;
    color: #fca5a5;
    font-size: 12px;
    white-space: pre-wrap;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 768px) {
    .status-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .status-right {
        text-align: left;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.period-nav {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.period-nav-title {
    text-align: center;
}

.period-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #111827;
    color: #f9fafb;
    cursor: pointer;
    font-size: 20px;
    line-height: 28px;
}

    .period-arrow:hover {
        background: #1f2937;
    }

.period-arrow-left {
    left: 0;
}

.period-arrow-right {
    right: 0;
}

.security-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 8, 22, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.security-modal {
    width: 100%;
    max-width: 420px;
    background: #0b1020;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

.security-modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.security-modal-text {
    color: #9ca3af;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.security-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #111827;
    color: #f9fafb;
    font-size: 18px;
    letter-spacing: 3px;
    text-transform: uppercase;
    outline: none;
}

    .security-input:focus {
        border-color: #6366f1;
    }

.security-button {
    width: 100%;
    margin-top: 14px;
    padding: 11px 14px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    color: #ffffff;
    cursor: pointer;
    font-weight: 600;
}

.security-error {
    display: block;
    margin-top: 10px;
    color: #fca5a5;
    font-size: 12px;
}

.baseline-card {
    margin-bottom: 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(245, 158, 11, 0.12));
    border: 1px solid rgba(147, 197, 253, 0.22);
}

.baseline-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.baseline-title {
    font-size: 15px;
    font-weight: 700;
}

.baseline-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.baseline-box {
    background: rgba(17, 24, 39, 0.65);
    border-radius: 10px;
    padding: 10px 12px;
}

.baseline-label {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.baseline-value {
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .baseline-grid {
        grid-template-columns: 1fr;
    }
}

.cg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .cg-table th,
    .cg-table td {
        padding: 8px 10px;
        border-bottom: 1px solid rgba(148, 163, 184, 0.25);
        text-align: left;
    }

    .cg-table th {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #64748b;
    }

.cg-kpi-line {
    margin: 8px 0;
    font-size: 14px;
}

.cg-list-row {
    display: grid;
    grid-template-columns: 1.4fr auto;
    gap: 4px 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

    .cg-list-row small {
        grid-column: 1 / -1;
        color: #64748b;
    }

.cg-positive {
    color: #047857;
}

.cg-negative {
    color: #b91c1c;
}

.cg-pill {
    display: inline-block;
    margin: 4px 6px 4px 0;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    font-size: 12px;
}

.pill-label {
    opacity: 0.72;
    font-weight: 500;
    margin-right: 4px;
}

.dashboard-context-strip {
    display: grid;
    grid-template-columns: 230px 170px 210px minmax(280px, 1fr) 190px 190px;
    align-items: stretch;
    width: 100%;
}

.context-cell {
    padding: 14px 18px;
    border-right: 1px solid rgba(120,140,190,.22);
    min-height: 56px;
}

    .context-cell:last-child {
        border-right: none;
    }

.context-label {
    color: #8d9ab8;
    font-size: 12px;
    margin-bottom: 4px;
}

.context-value {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.context-note {
    color: #9ca9c7;
    font-size: 12px;
    margin-top: 3px;
}

.context-value.warning {
    color: #f59e0b;
    font-weight: 600;
}

.context-brand-ddl {
    background: transparent;
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: 700;
    padding: 0;
    width: 100%;
    outline: none;
}

    .context-brand-ddl option {
        color: #111827;
    }

.context-completion {
    display: flex;
    align-items: center;
    gap: 12px;
}

.completion-ring {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #030b22 57%, transparent 58%), conic-gradient(#8b5cf6 calc(var(--pct) * 1%), rgba(255,255,255,.14) 0);
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 1100px) {
    .dashboard-context-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .context-cell:nth-child(2n) {
        border-right: none;
    }
}

@media (max-width: 640px) {
    .dashboard-context-strip {
        grid-template-columns: 1fr;
    }

    .context-cell {
        border-right: none;
        border-bottom: 1px solid rgba(120,140,190,.22);
    }

        .context-cell:last-child {
            border-bottom: none;
        }
}

.ai-question-card {
    margin: 14px 0 18px 0;
}

.ai-question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.ai-question-title {
    font-size: 18px;
    font-weight: 600;
    margin-top: 4px;
}

.ai-question-body {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: stretch;
}

.ai-question-input {
    width: 100%;
    min-height: 58px;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.45;
    background: rgba(255, 255, 255, 0.96);
    color: #111827;
    box-sizing: border-box;
}

    .ai-question-input:focus {
        outline: none;
        border-color: rgba(59, 130, 246, 0.75);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    }

.ai-question-button {
    min-width: 92px;
    border: 0;
    border-radius: 12px;
    padding: 0 18px;
    font-weight: 700;
    cursor: pointer;
    background: #2563eb;
    color: #fff;
}

    .ai-question-button:hover {
        filter: brightness(0.96);
    }

.ai-answer-panel {
    margin-top: 14px;
    border-radius: 12px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.ai-answer-text {
    margin-top: 6px;
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 14px;
}

.ai-question-error {
    display: block;
    margin-top: 10px;
    color: #b91c1c;
    font-weight: 600;
}

@media (max-width: 700px) {
    .ai-question-body {
        grid-template-columns: 1fr;
    }

    .ai-question-button {
        min-height: 44px;
    }
}
.context-billing-progress {
    padding: 0;
    overflow: hidden;
    min-width: 0;
}

.billing-progress-card {
    width: 100%;
    height: 100%;
    min-height: 105px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: 18px;
    color: #ffffff;
    background: radial-gradient(circle at 10% 15%, rgba(118, 86, 255, 0.22), transparent 34%), linear-gradient(135deg, #071126 0%, #090f25 48%, #0d1531 100%);
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.billing-progress-ring {
    --pct: 0;
    width: 60px;
    height: 60px;
    min-width: 60px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(closest-side, #071126 64%, transparent 65%), conic-gradient(#8b5cf6 calc(var(--pct) * 1%), rgba(65, 79, 128, 0.55) 0);
}

.billing-progress-ring-inner {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.billing-progress-content {
    min-width: 0;
    flex: 1;
}

.billing-progress-label {
    font-size: 15px;
    line-height: 1.2;
    font-weight: 400;
    color: rgba(226, 232, 240, 0.78);
    margin-bottom: 8px;
}

.billing-progress-main {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.billing-progress-note {
    font-size: 14px;
    line-height: 1.2;
    font-weight: 400;
    color: rgba(226, 232, 240, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-brand-item {
    min-width: 0;
    overflow: hidden;
}

.context-brand-select-wrap {
    position: relative;
    width: 100%;
    max-width: 190px;
    margin-top: 6px;
}

.context-brand-select {
    width: 100%;
    max-width: 190px;
    box-sizing: border-box;
    height: 34px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(147, 197, 253, 0.35);
    border-radius: 10px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    padding: 4px 32px 4px 10px;
    outline: none;
    cursor: pointer;
}

    .context-brand-select:hover {
        background: rgba(255, 255, 255, 0.09);
        border-color: rgba(147, 197, 253, 0.55);
    }

    .context-brand-select:focus {
        border-color: rgba(96, 165, 250, 0.85);
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
    }

.context-brand-select-wrap::after {
    content: "▾";
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-52%);
    pointer-events: none;
    color: #bfdbfe;
    font-size: 13px;
    font-weight: 700;
}

.context-brand-select option {
    background: #0b1020;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
}

.context-period-item {
    min-width: 0;
    overflow: hidden;
}

.context-period-select-wrap {
    position: relative;
    width: 100%;
    max-width: 140px;
    margin-top: 6px;
}

.context-period-select {
    width: 100%;
    max-width: 140px;
    box-sizing: border-box;
    height: 34px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(147, 197, 253, 0.35);
    border-radius: 10px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    padding: 4px 32px 4px 10px;
    outline: none;
    cursor: pointer;
}

    .context-period-select:hover {
        background: rgba(255, 255, 255, 0.09);
        border-color: rgba(147, 197, 253, 0.55);
    }

    .context-period-select:focus {
        border-color: rgba(96, 165, 250, 0.85);
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
    }

.context-period-select-wrap::after {
    content: "▾";
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-52%);
    pointer-events: none;
    color: #bfdbfe;
    font-size: 13px;
    font-weight: 700;
}

.context-period-select option {
    background: #0b1020;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
}