/* Shared context-window meter (js/shared/components/context-meter.js).
   A chip-sized pill plus an anchored popover. Scoped to .ctx-meter-*;
   colours are tokens only so dark mode follows for free. */

.ctx-meter-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.ctx-meter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    margin: 0;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.ctx-meter i { font-size: 12px; line-height: 1; opacity: 0.75; }
.ctx-meter:hover,
.ctx-meter[aria-expanded="true"] {
    color: var(--color-primary);
    border-color: var(--color-primary-lighter);
}
.ctx-meter.is-empty { color: var(--color-text-muted); }
.ctx-meter.is-high {
    color: var(--color-warning-text);
    background: var(--color-warning-bg);
    border-color: var(--color-warning-border);
}
.ctx-meter.is-critical {
    color: var(--color-error-text);
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
}

/* Popover */
.ctx-meter-pop {
    position: absolute;
    z-index: 1200;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 12px 14px;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    color: var(--color-text-primary);
    font-size: 12.5px;
    text-align: left;
}
.ctx-meter-pop-top    { bottom: calc(100% + 8px); }
.ctx-meter-pop-bottom { top: calc(100% + 8px); }
.ctx-meter-pop-left   { left: 0; }
.ctx-meter-pop-right  { right: 0; }

.ctx-meter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ctx-meter-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-primary);
}
.ctx-meter-title i { margin-right: 6px; color: var(--color-text-secondary); }
.ctx-meter-close {
    border: 0;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}
.ctx-meter-close:hover { color: var(--color-text-primary); background: var(--color-bg-hover); }

.ctx-meter-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}
.ctx-meter-big {
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-primary);
}
.ctx-meter-big.is-high     { color: var(--color-warning); }
.ctx-meter-big.is-critical { color: var(--color-error); }
.ctx-meter-sub { color: var(--color-text-secondary); }

.ctx-meter-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--color-gray-100);
    overflow: hidden;
    margin-bottom: 8px;
}
.ctx-meter-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--color-primary);
    transition: width 0.3s ease, background 0.15s ease;
}
.ctx-meter-fill.is-high     { background: var(--color-warning); }
.ctx-meter-fill.is-critical { background: var(--color-error); }

.ctx-meter-muted {
    margin: 0 0 8px;
    color: var(--color-text-secondary);
    line-height: 1.45;
}

.ctx-meter-details { margin: -2px 0 8px; }
.ctx-meter-details summary {
    cursor: pointer;
    color: var(--color-primary);
    font-size: 12px;
    user-select: none;
}
.ctx-meter-summary {
    margin: 6px 0 0;
    padding: 8px;
    max-height: 180px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
    font-size: 11.5px;
    line-height: 1.45;
    background: var(--color-bg-light);
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    color: var(--color-text-primary);
}

.ctx-meter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.ctx-meter-compact i { margin-right: 4px; }
.ctx-meter-note { font-size: 12px; }
.ctx-meter-note.is-ok    { color: var(--color-success); }
.ctx-meter-note.is-muted { color: var(--color-text-secondary); }
.ctx-meter-note.is-error { color: var(--color-error); }

.ctx-meter-help {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 11.5px;
    line-height: 1.45;
}
