/* ==========================================================================
   LEDIA CLOUD — COMMAND CENTRE
   ========================================================================== */

.dashboard-page {
    --dash-border: rgba(255, 255, 255, 0.085);
    --dash-border-soft: rgba(255, 255, 255, 0.055);
    --dash-panel: rgba(14, 15, 17, 0.82);
    --dash-panel-2: rgba(20, 21, 24, 0.72);
    --dash-hover: rgba(255, 255, 255, 0.035);
    --dash-brand: var(--brand, #f4b554);
    --dash-green: #54d98c;

    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    overflow: hidden;
}

.dashboard-page,
.dashboard-page * {
    box-sizing: border-box;
}

/* ==========================================================================
   SHELL
   ========================================================================== */

.dashboard-shell {
    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    display: grid;

    grid-template-rows:
        auto minmax(0, 1.6fr) minmax(185px, 0.8fr) auto;

    gap: 12px;

    overflow: hidden;
}

/* ==========================================================================
   COMMAND HEADER
   ========================================================================== */

.dashboard-command-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 28px;

    padding: 4px 3px 2px;
}

.dashboard-heading {
    min-width: 0;
}

.dashboard-kicker {
    margin-bottom: 6px;

    color: var(--muted-2);

    font-size: 9px;
    font-weight: 750;

    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.dashboard-title-line {
    display: flex;
    align-items: center;

    gap: 12px;
}

.dashboard-title-line h1 {
    margin: 0;

    color: var(--text);

    font-size: 27px;
    line-height: 1;

    font-weight: 720;

    letter-spacing: -0.035em;
}

.dashboard-heading>p {
    margin: 7px 0 0;

    color: var(--muted);

    font-size: 11px;
}

/* ==========================================================================
   HEALTH
   ========================================================================== */

.dashboard-health {
    display: inline-flex;
    align-items: center;

    gap: 7px;

    padding: 6px 10px;

    border: 1px solid rgba(84, 217, 140, 0.16);
    border-radius: 999px;

    background: rgba(84, 217, 140, 0.045);

    color: #a8cdb6;

    font-size: 8px;
    font-weight: 750;

    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.dashboard-health-dot,
.dashboard-ai-dot {
    width: 7px;
    height: 7px;

    flex: 0 0 auto;

    border-radius: 50%;

    background: var(--dash-green);

    box-shadow:
        0 0 10px rgba(84, 217, 140, 0.42);
}

/* ==========================================================================
   SUMMARY
   ========================================================================== */

.dashboard-summary {
    display: flex;
    align-items: center;

    gap: 15px;

    padding-bottom: 2px;
}

.dashboard-summary-item {
    display: flex;
    align-items: baseline;

    gap: 6px;

    white-space: nowrap;
}

.dashboard-summary-item strong {
    color: var(--text);

    font-size: 15px;
    font-weight: 720;
}

.dashboard-summary-item span {
    color: var(--muted);

    font-size: 9px;
}

.dashboard-summary-attention strong {
    color: var(--dash-brand);
}

.dashboard-summary-divider {
    width: 1px;
    height: 24px;

    background: var(--dash-border);
}

/* ==========================================================================
   GRIDS
   ========================================================================== */

.dashboard-primary-grid {
    min-width: 0;
    min-height: 0;

    display: grid;

    grid-template-columns:
        minmax(235px, 0.8fr) minmax(360px, 1.35fr) minmax(285px, 0.95fr);

    overflow: hidden;

    border: 1px solid var(--dash-border);
    border-radius: 22px;

    background:
        linear-gradient(145deg,
            rgba(255, 255, 255, 0.016),
            rgba(255, 255, 255, 0.003)),
        rgba(10, 11, 12, 0.72);
}

.dashboard-secondary-grid {
    min-width: 0;
    min-height: 0;

    display: grid;

    grid-template-columns:
        minmax(500px, 1.35fr) minmax(380px, 1fr);

    overflow: hidden;

    border: 1px solid var(--dash-border);
    border-radius: 20px;

    background:
        linear-gradient(145deg,
            rgba(255, 255, 255, 0.014),
            rgba(255, 255, 255, 0.002)),
        rgba(10, 11, 12, 0.68);
}

/* ==========================================================================
   PANELS
   ========================================================================== */

.dashboard-panel {
    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    padding: 16px 18px;

    overflow: hidden;

    background: transparent;
}

.dashboard-primary-grid>.dashboard-panel:not(:last-child),
.dashboard-secondary-grid>.dashboard-panel:not(:last-child) {
    border-right: 1px solid var(--dash-border);
}

.dashboard-panel-header {
    flex: 0 0 auto;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 13px;
}

.dashboard-panel-header h2 {
    margin: 0;

    color: var(--text);

    font-size: 16px;
    font-weight: 680;

    letter-spacing: -0.02em;
}

.dashboard-count-pill {
    min-width: 27px;
    height: 27px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--dash-border);
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.02);

    color: var(--muted);

    font-size: 10px;
}

.dashboard-count-pill.attention {
    color: var(--dash-brand);

    border-color: rgba(244, 181, 84, 0.17);

    background: rgba(244, 181, 84, 0.055);
}

/* ==========================================================================
   PORTFOLIO
   ========================================================================== */

.dashboard-portfolio-list {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;
}

.dashboard-portfolio-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr) auto 18px;

    align-items: center;

    gap: 12px;

    padding: 10px 2px;

    border-bottom: 1px solid var(--dash-border-soft);
}

.dashboard-portfolio-row>div:first-child {
    min-width: 0;
}

.dashboard-portfolio-row strong {
    display: block;

    color: var(--text);

    font-size: 11px;
    font-weight: 650;
}

.dashboard-portfolio-row span {
    display: block;

    margin-top: 3px;

    color: var(--muted-2);

    font-size: 8px;
}

.dashboard-portfolio-value {
    text-align: right;
}

.dashboard-portfolio-value strong {
    font-size: 11px;
}

.dashboard-trend {
    text-align: center;

    font-size: 13px;
}

.dashboard-trend.positive {
    color: var(--dash-green);
}

.dashboard-trend.neutral {
    color: var(--muted-2);
}

.dashboard-portfolio-total {
    flex: 0 0 auto;

    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 12px;

    padding-top: 13px;
}

.dashboard-portfolio-total span {
    color: var(--muted);

    font-size: 9px;
}

.dashboard-portfolio-total strong {
    color: var(--text);

    font-size: 17px;
}

/* ==========================================================================
   LEDIA BRIEF
   ========================================================================== */

.dashboard-ai-badge,
.dashboard-agent-live {
    display: inline-flex;
    align-items: center;

    gap: 6px;

    color: var(--muted);

    font-size: 8px;

    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-agent-live>span {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--dash-green);

    box-shadow:
        0 0 9px rgba(84, 217, 140, 0.4);
}

.dashboard-brief-content {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;

    padding-right: 4px;
}

.dashboard-brief-content p {
    margin: 0 0 13px;

    color: var(--muted);

    font-size: 11px;
    line-height: 1.55;
}

.dashboard-brief-content p strong {
    color: var(--text);

    font-weight: 650;
}

.dashboard-brief-content .dashboard-brief-greeting {
    color: var(--text);

    font-size: 15px;
    font-weight: 650;
}

.dashboard-priority {
    margin-top: 5px;

    padding: 12px 13px;

    border: 1px solid rgba(244, 181, 84, 0.13);
    border-radius: 12px;

    background: rgba(244, 181, 84, 0.04);
}

.dashboard-priority-label {
    margin-bottom: 6px;

    color: var(--dash-brand);

    font-size: 8px;
    font-weight: 750;

    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.dashboard-priority p {
    margin: 0;
}

/* ==========================================================================
   TEXT ACTION
   ========================================================================== */

.dashboard-text-action {
    appearance: none;

    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;

    gap: 8px;

    width: max-content;

    margin-top: 10px;
    padding: 0;

    border: 0;

    background: transparent;

    color: var(--muted);

    font: inherit;
    font-size: 10px;
    font-weight: 650;

    cursor: pointer;
}

.dashboard-text-action:hover {
    color: var(--dash-brand);
}

/* ==========================================================================
   AGENT FEED
   ========================================================================== */

.dashboard-agent-feed {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;
}

.dashboard-agent-event {
    display: grid;

    grid-template-columns:
        8px minmax(0, 1fr);

    gap: 11px;

    padding: 10px 0;

    border-bottom: 1px solid var(--dash-border-soft);
}

.dashboard-agent-event-dot {
    width: 7px;
    height: 7px;

    margin-top: 4px;

    border-radius: 50%;
}

.dashboard-agent-event-dot.success {
    background: var(--dash-green);

    box-shadow:
        0 0 8px rgba(84, 217, 140, 0.32);
}

.dashboard-agent-event-copy {
    min-width: 0;
}

.dashboard-agent-event-top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;
}

.dashboard-agent-event-top strong {
    color: var(--text);

    font-size: 10px;
    font-weight: 650;
}

.dashboard-agent-event-top span {
    color: var(--muted-2);

    font-size: 8px;
}

.dashboard-agent-event-copy p {
    margin: 4px 0 7px;

    color: var(--muted);

    font-size: 9px;
    line-height: 1.45;
}

.dashboard-agent-status {
    color: rgba(84, 217, 140, 0.75);

    font-size: 7px;
    font-weight: 700;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ==========================================================================
   REVENUE PIPELINE
   ========================================================================== */

.dashboard-pipeline-total {
    color: var(--text);

    font-size: 15px;
}

.dashboard-pipeline-list {
    flex: 1 1 auto;

    display: grid;

    align-content: center;

    gap: 11px;
}

.dashboard-pipeline-row {
    display: grid;

    grid-template-columns:
        150px minmax(0, 1fr);

    align-items: center;

    gap: 15px;
}

.dashboard-pipeline-name {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;
}

.dashboard-pipeline-name strong {
    color: var(--text);

    font-size: 10px;
}

.dashboard-pipeline-name span {
    color: var(--muted);

    font-size: 10px;
}

.dashboard-pipeline-track {
    height: 8px;

    overflow: hidden;

    border-radius: 999px;

    background: rgba(255, 255, 255, 0.055);
}

.dashboard-pipeline-fill {
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(90deg,
            var(--dash-brand),
            rgba(244, 181, 84, 0.55));
}

.dashboard-revenue-footer {
    display: flex;
    align-items: baseline;

    gap: 6px;

    padding-top: 8px;
}

.dashboard-revenue-footer strong {
    color: var(--text);

    font-size: 13px;
}

.dashboard-revenue-footer span {
    color: var(--muted);

    font-size: 9px;
}

/* ==========================================================================
   NEED TO KNOW
   ========================================================================== */

.dashboard-attention-list {
    flex: 1 1 auto;

    min-height: 0;

    display: grid;

    align-content: center;

    gap: 4px;

    overflow-y: auto;
}

.dashboard-attention-item {
    display: grid;

    grid-template-columns:
        7px minmax(0, 1fr) auto;

    align-items: center;

    gap: 10px;

    padding: 8px 0;

    border-bottom: 1px solid var(--dash-border-soft);
}

.dashboard-attention-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: var(--muted-2);
}

.dashboard-attention-item.high .dashboard-attention-dot {
    background: var(--dash-brand);

    box-shadow:
        0 0 8px rgba(244, 181, 84, 0.32);
}

.dashboard-attention-item strong {
    display: block;

    color: var(--text);

    font-size: 10px;
}

.dashboard-attention-item p {
    margin: 3px 0 0;

    color: var(--muted);

    font-size: 8px;
}

.dashboard-attention-tag {
    padding: 5px 7px;

    border: 1px solid var(--dash-border);
    border-radius: 7px;

    color: var(--muted);

    font-size: 7px;

    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ==========================================================================
   EMPTY STATES
   ========================================================================== */

.dashboard-empty-message {
    min-height: 100%;

    display: flex;
    flex-direction: column;
    justify-content: center;

    color: var(--muted);
}

.dashboard-empty-message strong {
    color: var(--text);

    font-size: 10px;
    font-weight: 650;
}

.dashboard-empty-message p {
    margin: 5px 0 0;

    color: var(--muted);

    font-size: 9px;
    line-height: 1.45;
}

/* ==========================================================================
   STATUS BAR
   ========================================================================== */

.dashboard-statusbar {
    min-height: 22px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    padding: 0 4px;

    color: var(--muted-2);

    font-size: 7px;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-status-left,
.dashboard-status-right {
    display: flex;
    align-items: center;

    gap: 10px;
}

.dashboard-status-right {
    gap: 18px;
}

.dashboard-status-left strong,
.dashboard-status-right strong {
    color: var(--muted);
}

.dashboard-status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--dash-green);

    box-shadow:
        0 0 9px rgba(84, 217, 140, 0.42);
}

.dashboard-status-online {
    color: rgba(84, 217, 140, 0.72);
}

/* ==========================================================================
   COMMAND ACTIONS
   ========================================================================== */

.dashboard-command-actions {
    display: flex;
    align-items: center;

    gap: 20px;
}

.dashboard-chat-button {
    appearance: none;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    min-height: 34px;

    padding: 0 13px;

    border: 1px solid rgba(244, 181, 84, 0.22);
    border-radius: 10px;

    background: rgba(244, 181, 84, 0.07);

    color: var(--text);

    font: inherit;
    font-size: 10px;
    font-weight: 680;

    cursor: pointer;

    transition:
        background 140ms ease,
        border-color 140ms ease,
        transform 140ms ease;
}

.dashboard-chat-button:hover {
    border-color: rgba(244, 181, 84, 0.38);

    background: rgba(244, 181, 84, 0.12);
}

.dashboard-chat-button:active {
    transform: translateY(1px);
}

.dashboard-chat-button-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--dash-green);

    box-shadow:
        0 0 9px rgba(84, 217, 140, 0.42);
}

/* ==========================================================================
   LEDIA CHAT — BACKDROP
   ========================================================================== */

.ledia-chat-backdrop {
    position: fixed;
    inset: 0;

    z-index: 5000;

    display: flex;

    padding: 14px;

    background: rgba(0, 0, 0, 0.72);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 160ms ease,
        visibility 160ms ease;
}

.ledia-chat-backdrop.is-open {
    opacity: 1;
    visibility: visible;

    pointer-events: auto;
}

/* ==========================================================================
   LEDIA CHAT — FULL SCREEN SHELL
   ========================================================================== */

.ledia-chat-modal {
    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    display: grid;

    grid-template-columns:
        250px minmax(0, 1fr);

    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 18px;

    background:
        linear-gradient(145deg,
            rgba(255, 255, 255, 0.018),
            rgba(255, 255, 255, 0.002)),
        #0d0e10;

    box-shadow:
        0 32px 100px rgba(0, 0, 0, 0.58);

    transform: translateY(5px) scale(0.995);

    transition:
        transform 160ms ease;
}

.ledia-chat-backdrop.is-open .ledia-chat-modal {
    transform: translateY(0) scale(1);
}

/* ==========================================================================
   LEDIA CHAT — SIDEBAR
   ========================================================================== */

.ledia-chat-sidebar {
    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    border-right: 1px solid rgba(255, 255, 255, 0.075);

    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.018),
            transparent 28%),
        rgba(7, 8, 9, 0.72);
}

.ledia-chat-sidebar-top {
    flex: 0 0 auto;

    padding: 18px 12px 12px;
}

.ledia-chat-sidebar-brand {
    margin: 0 3px 12px;

    color: var(--muted-2);

    font-size: 8px;
    font-weight: 750;

    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ledia-chat-new {
    appearance: none;

    width: 100%;
    min-height: 38px;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 0 11px;

    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.025);

    color: var(--text);

    font: inherit;
    font-size: 10px;
    font-weight: 650;

    text-align: left;

    cursor: pointer;

    transition:
        border-color 140ms ease,
        background 140ms ease;
}

.ledia-chat-new:hover {
    border-color: rgba(244, 181, 84, 0.22);

    background: rgba(244, 181, 84, 0.055);
}

.ledia-chat-new span {
    color: var(--dash-brand);

    font-size: 16px;
    font-weight: 400;
    line-height: 1;
}

/* ==========================================================================
   LEDIA CHAT — CONVERSATION HISTORY
   ========================================================================== */

.ledia-chat-history-list {
    flex: 1 1 auto;

    min-width: 0;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 3px 8px 14px;
}

.ledia-chat-history-empty {
    padding: 12px 8px;

    color: var(--muted-2);

    font-size: 9px;
    line-height: 1.5;
}

.ledia-chat-history-item {
    appearance: none;

    width: 100%;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr) auto;

    align-items: center;

    gap: 8px;

    margin-bottom: 2px;
    padding: 9px;

    border: 1px solid transparent;
    border-radius: 9px;

    background: transparent;

    color: var(--muted);

    font: inherit;

    text-align: left;

    cursor: pointer;

    transition:
        color 130ms ease,
        background 130ms ease,
        border-color 130ms ease;
}

.ledia-chat-history-item:hover {
    color: var(--text);

    background: rgba(255, 255, 255, 0.03);
}

.ledia-chat-history-item.is-active {
    border-color: rgba(244, 181, 84, 0.12);

    background: rgba(244, 181, 84, 0.05);

    color: var(--text);
}

.ledia-chat-history-title {
    min-width: 0;

    overflow: hidden;

    font-size: 10px;
    font-weight: 560;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.ledia-chat-history-time {
    color: var(--muted-2);

    font-size: 7px;

    white-space: nowrap;
}

/* ==========================================================================
   LEDIA CHAT — MAIN
   ========================================================================== */

.ledia-chat-main {
    min-width: 0;
    min-height: 0;

    display: grid;

    grid-template-rows:
        auto minmax(0, 1fr) auto auto auto;

    overflow: hidden;

    background: rgba(13, 14, 16, 0.72);
}

/* ==========================================================================
   LEDIA CHAT — HEADER
   ========================================================================== */

.ledia-chat-header {
    min-width: 0;
    min-height: 60px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    padding: 0 20px;

    border-bottom: 1px solid var(--dash-border);
}

.ledia-chat-identity {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 10px;
}

.ledia-chat-avatar {
    width: 32px;
    height: 32px;

    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid rgba(244, 181, 84, 0.2);
    border-radius: 10px;

    background:
        linear-gradient(145deg,
            rgba(244, 181, 84, 0.17),
            rgba(244, 181, 84, 0.035));

    color: var(--dash-brand);

    font-size: 13px;
    font-weight: 760;
}

.ledia-chat-name {
    max-width: min(600px, 50vw);

    overflow: hidden;

    color: var(--text);

    font-size: 12px;
    font-weight: 680;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.ledia-chat-state {
    display: flex;
    align-items: center;

    gap: 6px;

    margin-top: 3px;

    color: var(--muted);

    font-size: 7px;

    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.ledia-chat-state span {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: var(--dash-green);

    box-shadow:
        0 0 8px rgba(84, 217, 140, 0.42);
}

.ledia-chat-close {
    appearance: none;

    width: 30px;
    height: 30px;

    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid var(--dash-border);
    border-radius: 8px;

    background: rgba(255, 255, 255, 0.02);

    color: var(--muted);

    font: inherit;
    font-size: 18px;
    line-height: 1;

    cursor: pointer;
}

.ledia-chat-close:hover {
    color: var(--text);

    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   LEDIA CHAT — MESSAGES
   ========================================================================== */

.ledia-chat-messages {
    min-width: 0;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding:
        28px clamp(26px, 6vw, 92px) 22px;

    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.ledia-chat-welcome {
    min-height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 30px 20px;

    text-align: center;
}

.ledia-chat-mark {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 12px;

    border: 1px solid rgba(244, 181, 84, 0.2);
    border-radius: 13px;

    background: rgba(244, 181, 84, 0.07);

    color: var(--dash-brand);

    font-size: 16px;
    font-weight: 760;
}

.ledia-chat-welcome h3 {
    margin: 0;

    color: var(--text);

    font-size: 16px;
    font-weight: 680;
}

.ledia-chat-welcome p {
    max-width: 360px;

    margin: 7px 0 0;

    color: var(--muted);

    font-size: 10px;
    line-height: 1.55;
}

/* ==========================================================================
   LEDIA CHAT — MESSAGE ROWS
   ========================================================================== */

.ledia-chat-message {
    width: fit-content;
    max-width: min(760px, 78%);

    margin-bottom: 18px;
}

.ledia-chat-message.assistant {
    margin-right: auto;
}

.ledia-chat-message.user {
    margin-left: auto;
}

.ledia-chat-message-meta {
    margin-bottom: 5px;

    color: var(--muted-2);

    font-size: 7px;
    font-weight: 700;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ledia-chat-message.user .ledia-chat-message-meta {
    text-align: right;
}

/* ==========================================================================
   LEDIA CHAT — MESSAGE BODY
   ========================================================================== */

.ledia-chat-message-body {
    width: fit-content;
    max-width: 100%;

    padding: 9px 11px;

    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 11px;

    background: rgba(255, 255, 255, 0.016);

    color: var(--text);

    font-size: 11px;
    line-height: 1.55;

    overflow-wrap: anywhere;
}

.ledia-chat-message.user .ledia-chat-message-body {
    border-color: rgba(244, 181, 84, 0.16);

    background: rgba(244, 181, 84, 0.06);
}

.ledia-chat-message.is-error .ledia-chat-message-body {
    border-color: rgba(244, 181, 84, 0.2);
}

/* ==========================================================================
   LEDIA CHAT — MARKDOWN CONTENT
   ========================================================================== */

.ledia-chat-message-body p {
    margin: 0 0 9px;
}

.ledia-chat-message-body p:last-child {
    margin-bottom: 0;
}

.ledia-chat-message-body ul,
.ledia-chat-message-body ol {
    margin: 7px 0;

    padding-left: 20px;
}

.ledia-chat-message-body li {
    margin: 3px 0;
}

.ledia-chat-message-body h3,
.ledia-chat-message-body h4,
.ledia-chat-message-body h5,
.ledia-chat-message-body h6 {
    margin: 12px 0 6px;

    color: var(--text);

    line-height: 1.3;
}

.ledia-chat-message-body h3:first-child,
.ledia-chat-message-body h4:first-child,
.ledia-chat-message-body h5:first-child,
.ledia-chat-message-body h6:first-child {
    margin-top: 0;
}

.ledia-chat-message-body code {
    padding: 2px 4px;

    border-radius: 5px;

    background: rgba(255, 255, 255, 0.055);

    font-size: 0.92em;
}

/* ==========================================================================
   LEDIA CHAT — MARKDOWN TABLES
   ========================================================================== */

.ledia-chat-table-wrap {
    max-width: 100%;

    overflow-x: auto;

    margin: 8px 0;
}

.ledia-chat-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 10px;
}

.ledia-chat-table th,
.ledia-chat-table td {
    padding: 7px 9px;

    border: 1px solid rgba(255, 255, 255, 0.07);

    text-align: left;
    vertical-align: top;
}

.ledia-chat-table th {
    color: var(--text);

    background: rgba(255, 255, 255, 0.025);

    font-weight: 650;
}

.ledia-chat-table td {
    color: var(--muted);
}

/* ==========================================================================
   LEDIA CHAT — LOADING
   ========================================================================== */

.ledia-chat-loading-state {
    min-height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 10px;

    color: var(--muted);

    font-size: 9px;
}

.ledia-chat-loading-state .ledia-chat-thinking {
    padding: 0;
}

/* ==========================================================================
   LEDIA CHAT — THINKING
   ========================================================================== */

.ledia-chat-thinking {
    min-height: 0;

    display: none;
    align-items: center;

    gap: 5px;

    padding:
        0 clamp(26px, 6vw, 92px) 9px;
}

.ledia-chat-thinking.is-visible {
    display: flex;
}

.ledia-chat-thinking span {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: var(--muted);

    animation:
        ledia-chat-pulse 1s infinite ease-in-out;
}

.ledia-chat-thinking span:nth-child(2) {
    animation-delay: 120ms;
}

.ledia-chat-thinking span:nth-child(3) {
    animation-delay: 240ms;
}

@keyframes ledia-chat-pulse {

    0%,
    70%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    35% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

/* ==========================================================================
   LEDIA CHAT — COMPOSER
   ========================================================================== */

.ledia-chat-composer {
    width: min(920px,
            calc(100% - 48px));

    justify-self: center;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr) auto;

    align-items: end;

    gap: 9px;

    margin: 4px 0 12px;
    padding: 7px;

    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 13px;

    background: rgba(255, 255, 255, 0.022);
}

.ledia-chat-composer:focus-within {
    border-color: rgba(244, 181, 84, 0.25);
}

.ledia-chat-composer textarea {
    width: 100%;

    min-height: 34px;
    max-height: 130px;

    resize: none;

    padding: 8px;

    border: 0;
    outline: 0;

    background: transparent;

    color: var(--text);

    font: inherit;
    font-size: 11px;
    line-height: 1.45;

    overflow-y: auto;
}

.ledia-chat-composer textarea::placeholder {
    color: var(--muted-2);
}

.ledia-chat-send {
    appearance: none;

    height: 34px;

    padding: 0 15px;

    border: 1px solid rgba(244, 181, 84, 0.24);
    border-radius: 9px;

    background: var(--dash-brand);

    color: #16110a;

    font: inherit;
    font-size: 9px;
    font-weight: 760;

    cursor: pointer;
}

.ledia-chat-send:hover {
    filter: brightness(1.04);
}

.ledia-chat-send:disabled,
.ledia-chat-composer textarea:disabled {
    opacity: 0.5;

    cursor: default;
}

/* ==========================================================================
   LEDIA CHAT — FOOTER
   ========================================================================== */

.ledia-chat-footer {
    min-height: 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 0 20px;

    border-top: 1px solid var(--dash-border-soft);

    color: var(--muted-2);

    font-size: 7px;
    font-weight: 650;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ledia-chat-runtime-state {
    display: flex;
    align-items: center;

    gap: 6px;
}

.ledia-chat-runtime-state i {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: var(--dash-green);
}

/* ==========================================================================
   SCROLLBARS
   ========================================================================== */

.dashboard-page *,
.ledia-chat-backdrop * {
    scrollbar-width: thin;

    scrollbar-color:
        rgba(255, 255, 255, 0.11) transparent;
}

.dashboard-page *::-webkit-scrollbar,
.ledia-chat-backdrop *::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.dashboard-page *::-webkit-scrollbar-track,
.ledia-chat-backdrop *::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-page *::-webkit-scrollbar-thumb,
.ledia-chat-backdrop *::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.11);
}

/* ==========================================================================
   RESPONSIVE — COMMAND CENTRE
   ========================================================================== */

@media (max-width: 1100px) {
    .dashboard-shell {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .dashboard-command-header,
    .dashboard-primary-grid,
    .dashboard-secondary-grid,
    .dashboard-statusbar {
        min-width: 940px;
    }

    .dashboard-summary-item span {
        display: none;
    }

    .dashboard-command-actions {
        min-width: max-content;
    }

    .ledia-chat-modal {
        grid-template-columns:
            220px minmax(0, 1fr);
    }

    .ledia-chat-messages {
        padding-left: 30px;
        padding-right: 30px;
    }
}

@media (max-height: 780px) {
    .dashboard-shell {
        gap: 9px;

        grid-template-rows:
            auto minmax(0, 1.65fr) minmax(155px, 0.7fr) auto;
    }

    .dashboard-panel {
        padding: 13px 15px;
    }

    .dashboard-portfolio-row {
        padding: 7px 2px;
    }

    .dashboard-agent-event {
        padding: 7px 0;
    }

    .dashboard-brief-content p {
        margin-bottom: 9px;
    }
}

/* ==========================================================================
   RESPONSIVE — LEDIA CHAT
   ========================================================================== */

@media (max-width: 760px) {
    .ledia-chat-backdrop {
        padding: 0;
    }

    .ledia-chat-modal {
        grid-template-columns:
            180px minmax(0, 1fr);

        border: 0;
        border-radius: 0;
    }

    .ledia-chat-header {
        padding: 0 14px;
    }

    .ledia-chat-messages {
        padding:
            20px 16px 14px;
    }

    .ledia-chat-message {
        max-width: 90%;
    }

    .ledia-chat-composer {
        width: calc(100% - 24px);

        margin-bottom: 9px;
    }

    .ledia-chat-footer {
        padding: 0 14px;
    }
}

@media (max-width: 560px) {
    .ledia-chat-modal {
        display: block;
    }

    .ledia-chat-sidebar {
        display: none;
    }

    .ledia-chat-main {
        width: 100%;
        height: 100%;
    }

    .ledia-chat-message {
        max-width: 94%;
    }
}

/* ==========================================================================
   LEDIA CHAT — HISTORY ACTIONS / RENAME
   ========================================================================== */

.ledia-chat-history-row {
    position: relative;

    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;

    min-width: 0;
}

.ledia-chat-history-row .ledia-chat-history-item {
    min-width: 0;
}

.ledia-chat-history-action {
    appearance: none;

    width: 26px;
    height: 26px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 7px;

    background: transparent;

    color: var(--muted-2);

    font: inherit;
    font-size: 9px;
    line-height: 1;

    opacity: 0;

    cursor: pointer;

    transition:
        opacity 120ms ease,
        color 120ms ease,
        background 120ms ease;
}

.ledia-chat-history-row:hover .ledia-chat-history-action,
.ledia-chat-history-row.is-active .ledia-chat-history-action {
    opacity: 1;
}

.ledia-chat-history-action:hover {
    color: var(--text);

    background: rgba(255, 255, 255, 0.05);
}

.ledia-chat-history-item-editing {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;

    gap: 5px;

    margin: 2px 0;
    padding: 5px;

    border: 1px solid rgba(244, 181, 84, 0.18);
    border-radius: 9px;

    background: rgba(244, 181, 84, 0.035);
}

.ledia-chat-history-rename-input {
    width: 100%;
    min-width: 0;

    padding: 6px 7px;

    border: 1px solid rgba(244, 181, 84, 0.24);
    border-radius: 6px;
    outline: 0;

    background: rgba(0, 0, 0, 0.28);

    color: var(--text);

    font: inherit;
    font-size: 9px;
}

.ledia-chat-history-rename-input:focus {
    border-color: rgba(244, 181, 84, 0.45);
}

.ledia-chat-history-rename-actions {
    display: flex;
    align-items: center;

    gap: 3px;
}

.ledia-chat-history-rename-save,
.ledia-chat-history-rename-cancel {
    appearance: none;

    width: 23px;
    height: 23px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 6px;

    background: rgba(255, 255, 255, 0.035);

    color: var(--muted);

    font: inherit;
    font-size: 10px;

    cursor: pointer;
}

.ledia-chat-history-rename-save:hover {
    background: rgba(244, 181, 84, 0.08);

    color: var(--dash-brand);
}

.ledia-chat-history-rename-cancel:hover {
    background: rgba(255, 255, 255, 0.06);

    color: var(--text);
}

/* ==========================================================================
   CONVERSATION ACTION MENU
   ========================================================================== */

.ledia-chat-history-menu-wrap {
    position: relative;
    flex: 0 0 auto;
}

.ledia-chat-history-action {
    position: relative;
    z-index: 2;
}

.ledia-chat-history-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;

    z-index: 40;

    width: 126px;
    padding: 5px;

    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;

    background: #151617;

    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.42);
}

.ledia-chat-history-menu-item {
    display: flex;
    align-items: center;

    width: 100%;

    padding: 8px 10px;

    border: 0;
    border-radius: 7px;

    background: transparent;

    color: rgba(255, 255, 255, 0.82);

    font: inherit;
    font-size: 12px;
    text-align: left;

    cursor: pointer;

    transition:
        background 140ms ease,
        color 140ms ease;
}

.ledia-chat-history-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.ledia-chat-history-menu-delete {
    color: #ff7676;
}

.ledia-chat-history-menu-delete:hover {
    background: rgba(255, 90, 90, 0.1);
    color: #ff9292;
}

.ledia-chat-history-row.menu-open {
    position: relative;
    z-index: 20;
}

.ledia-chat-environment-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
}

.ledia-chat-environment-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.55;
}

.ledia-chat-environment {
    min-width: 112px;
    height: 26px;
    padding: 0 24px 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    font: inherit;
    font-size: 11px;
    outline: none;
}

.ledia-chat-environment:not(:disabled) {
    cursor: pointer;
}

.ledia-chat-environment:focus {
    border-color: rgba(255, 255, 255, 0.24);
}

.ledia-chat-environment:disabled {
    opacity: 0.65;
    cursor: default;
}