/* TulaOps brand tokens and shared component styles (docs/04-ui-and-brand.md). */
:root {
    --tula-emerald: #00A86B;
    --tula-emerald-700: #007A4D;
    --tula-sage: #2E7D5F;
    --tula-charcoal: #1A1A1A;
    --tula-mint: #E8F6EF;
    --tula-loss: #C62828;
    --tula-surface: #FFFFFF;
    --tula-border: #B9C9C0;
    --tula-muted: #4A4F4C;
    --tula-radius: 10px;
}

html, body {
    font-family: Poppins, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.tula-num {
    font-variant-numeric: tabular-nums;
}

.tula-logo {
    display: block;
    width: auto;
    max-width: 100%;
}

/* Note panel beside forms (CAS upload, settings). */
.tula-note {
    background: var(--tula-mint);
    border: 1px solid #CDE8DA;
    border-radius: var(--tula-radius);
    padding: 20px 24px;
    color: var(--tula-charcoal);
}

    .tula-note h3 {
        color: var(--tula-sage);
        font-size: 1rem;
        font-weight: 600;
        margin: 0 0 6px;
    }

    .tula-note h3 + p, .tula-note p {
        margin: 0 0 14px;
        font-size: .9rem;
        line-height: 1.5;
    }

    .tula-note ol {
        margin: 0 0 14px;
        padding-left: 20px;
        font-size: .9rem;
        line-height: 1.6;
    }

    .tula-note a {
        color: var(--tula-emerald-700);
        font-weight: 500;
    }

/* File picker: [Browse | file name] */
.tula-filepicker {
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 48px;
    border: 1px solid var(--tula-border);
    border-radius: var(--tula-radius);
    background: var(--tula-surface);
    cursor: pointer;
    overflow: hidden;
}

    .tula-filepicker:focus-within {
        outline: 2px solid var(--tula-emerald-700);
        outline-offset: 1px;
    }

    .tula-filepicker.is-disabled {
        opacity: .6;
        cursor: not-allowed;
    }

.tula-filepicker__button {
    display: flex;
    align-items: center;
    padding: 0 22px;
    background: var(--tula-mint);
    color: var(--tula-emerald-700);
    font-weight: 600;
    border-right: 1px solid var(--tula-border);
    white-space: nowrap;
}

.tula-filepicker__name {
    display: flex;
    align-items: center;
    padding: 0 16px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--tula-charcoal);
}

    .tula-filepicker__name.is-empty {
        color: #7A847E;
    }

.tula-filepicker__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Tables become stacked cards on phones (MudTable Breakpoint handles layout; this keeps labels readable). */
@media (max-width: 599.98px) {
    .mud-table-cell::before {
        font-weight: 600;
        color: var(--tula-sage);
    }
}

/* ---- Data visualisation (dataviz reference palette: 7 categorical slots, validated in this order) ---- */
.tula-viz {
    --tula-series-1: #2a78d6; /* blue    — Equity */
    --tula-series-2: #eb6834; /* orange  — Debt */
    --tula-series-3: #1baf7a; /* aqua    — Hybrid */
    --tula-series-4: #eda100; /* yellow  — Fund of funds */
    --tula-series-5: #e87ba4; /* magenta — Commodity */
    --tula-series-6: #008300; /* green   — Solution oriented */
    --tula-series-7: #4a3aa7; /* violet  — Other */
    --tula-viz-gap: var(--mud-palette-surface, #FFFFFF);
    --tula-viz-track: #E1E0D9;
}

/* Dark mode: the same hues stepped for the dark surface (set by MainLayout when dark mode is on). */
.tula-dark .tula-viz {
    --tula-series-1: #3987e5;
    --tula-series-2: #d95926;
    --tula-series-3: #199e70;
    --tula-series-4: #c98500;
    --tula-series-5: #d55181;
    --tula-series-6: #008300;
    --tula-series-7: #9085e9;
    --tula-viz-track: #2C2C2A;
}

.tula-alloc__bar {
    display: flex;
    gap: 2px; /* surface gap between segments */
    height: 14px;
    margin: 4px 0 14px;
}

.tula-alloc__hit {
    display: flex;
    min-width: 4px;
    padding: 4px 0; /* hit target taller than the mark */
    margin: -4px 0;
}

.tula-alloc__seg {
    display: block;
    width: 100%;
    height: 14px;
}

.tula-alloc__hit:first-child .tula-alloc__seg { border-radius: 4px 0 0 4px; }
.tula-alloc__hit:last-child .tula-alloc__seg { border-radius: 0 4px 4px 0; }
.tula-alloc__hit:only-child .tula-alloc__seg { border-radius: 4px; }

.tula-alloc__legend {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

    .tula-alloc__legend td {
        padding: 5px 0;
        border-top: 1px solid var(--mud-palette-lines-default, #E1E0D9);
    }

        .tula-alloc__legend td + td {
            text-align: right;
            padding-left: 12px;
            white-space: nowrap;
        }

.tula-alloc__share {
    color: var(--mud-palette-text-secondary);
    width: 4.5em;
}

.tula-alloc__swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: -1px;
}

/* Single-series magnitude bar inside a table cell (top AMCs, top investors). */
.tula-inline-bar {
    height: 6px;
    border-radius: 0 4px 4px 0;
    background: var(--tula-series-1);
    min-width: 2px;
    margin-top: 4px;
}

/* ---- Stat tiles ---- */
.tula-stat {
    padding: 16px 18px;
    height: 100%;
}

.tula-stat__label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: var(--mud-palette-text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tula-stat__value {
    white-space: nowrap;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.25;
    margin-top: 6px;
    color: var(--mud-palette-text-primary);
}

.tula-stat__detail {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    font-size: .85rem;
    color: var(--mud-palette-text-secondary);
}

.tula-stat__detail--up { color: var(--mud-palette-success); }
.tula-stat__detail--down { color: var(--mud-palette-error); }

.tula-gain { color: var(--mud-palette-success); }
.tula-loss { color: var(--mud-palette-error); }

@media (max-width: 599.98px) {
    .tula-stat { padding: 12px 12px; }
    .tula-stat__value { font-size: 1.2rem; }
    .tula-stat__label { font-size: .7rem; letter-spacing: .02em; }
    .tula-stat__detail { font-size: .75rem; }
}

/* Portfolio statement table: figures and dates stay on one line; the scheme column takes the slack (the table scrolls sideways). */
@media (min-width: 600px) {
    .tula-statement td.tula-cell { white-space: nowrap; }
    .tula-statement .mud-table-row .mud-table-cell { padding: 6px 8px; }
    .tula-statement th.mud-table-cell { vertical-align: bottom; line-height: 1.25; }
}
