/* Comparison chart (fundamental-chart.php). Colours come from app.css. */
.fc-body { overflow-x: hidden; }
.fc-shell { display: flex; flex-direction: column; width: min(1480px, calc(100% - 32px)); height: 100vh; margin: 0 auto; padding: 16px 0; }
.fc-shell .app-header { flex: none; margin-bottom: 14px; }
.fc-app { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; flex: 1; min-height: 0; }

.fc-panel { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: auto; }
.fc-box { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 6px 18px rgba(31, 41, 55, .05); }
.fc-panel h2 { margin: 0 0 10px; font-size: 13px; font-weight: 750; letter-spacing: .02em; }
.fc-box > label { display: block; margin: 10px 0 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.fc-box input[type="text"], .fc-add select, .fc-workspace-row select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #d5dce7; border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 13px; }
.fc-box input[type="text"]:focus-visible, .fc-add select:focus-visible, .fc-workspace-row select:focus-visible { outline: 2px solid #a9c1ff; outline-offset: 1px; border-color: var(--accent); }
.fc-add select:disabled { color: var(--muted); background: #f7f8fb; }
.fc-add-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 10px; }
.fc-add-row label { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.fc-add button[type="submit"] { height: 36px; padding: 0 16px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.fc-add button[type="submit"]:hover:not(:disabled), .fc-add button[type="submit"]:focus-visible { background: #1f55df; outline: 2px solid #a9c1ff; outline-offset: 2px; }
.fc-add button[type="submit"]:disabled { opacity: .5; cursor: not-allowed; }
.fc-add-status { min-height: 16px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.fc-add-status:empty { display: none; }

.fc-symbol-field { position: relative; }
.fc-symbol-results { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; margin: 0; padding: 4px; overflow: auto; list-style: none; border: 1px solid #d5dce7; border-radius: 10px; background: #fff; box-shadow: 0 14px 34px rgba(31, 41, 55, .16); }
.fc-symbol-results li { display: grid; gap: 1px; padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.fc-symbol-results li:hover, .fc-symbol-results li[aria-selected="true"] { background: var(--panel-hover); }
.fc-symbol-results strong { font-size: 13px; }
.fc-symbol-results span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.fc-symbol-results span:empty { display: none; }

.fc-box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.fc-box-head h2 { margin: 0; }
.fc-text-button { padding: 4px 6px; border: 0; border-radius: 7px; background: transparent; color: var(--accent); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.fc-text-button:hover, .fc-text-button:focus-visible { background: #eef2ff; outline: none; }
.fc-workspace-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.fc-workspace-row select { font-weight: 700; }
.fc-icon-button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #d5dce7; border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer; }
.fc-icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fc-icon-button:hover, .fc-icon-button:focus-visible { border-color: #f3b8b3; background: #fdeceb; color: #b42318; outline: none; }
.fc-hint { margin: -4px 0 10px; color: var(--muted); font-size: 12px; }

.fc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.fc-chip { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 2px 0 10px; border: 1px solid var(--line); border-radius: 999px; background: #f7f8fb; font-size: 13px; }
.fc-chip .fc-remove { width: 22px; height: 22px; border-radius: 50%; font-size: 16px; }

.fc-metrics { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.fc-metric-item { padding: 8px; border: 1px solid var(--line); border-radius: 9px; }
.fc-metric-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.fc-metric-name { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.fc-metric-item select { width: 58px; height: 28px; padding: 0 4px; border: 1px solid #d5dce7; border-radius: 7px; background: #fff; color: var(--text); font: inherit; font-size: 12px; }
.fc-swatches { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 7px; }
.fc-swatch { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.fc-swatch.is-missing { opacity: .45; }
.fc-swatch input[type="color"] { width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.fc-swatch input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.fc-swatch input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.fc-swatch input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.fc-remove { width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.fc-remove:hover, .fc-remove:focus-visible { background: #fdeceb; color: #b42318; outline: none; }
.fc-series-error { margin: 5px 0 0; color: #b42318; font-size: 12px; }
.fc-empty { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.fc-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 6px 18px rgba(31, 41, 55, .05); overflow: hidden; }
.fc-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.fc-segment { display: inline-flex; padding: 3px; border-radius: 9px; background: #f1f4f9; }
.fc-segment button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.fc-segment button[aria-pressed="true"] { background: #fff; color: #3159b8; box-shadow: 0 1px 3px rgba(31, 41, 55, .12); }
.fc-segment button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fc-option { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.fc-option select { height: 30px; padding: 0 8px; border: 1px solid #d5dce7; border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; }
.fc-status { margin-left: auto; color: var(--muted); font-size: 12px; }
.fc-chart { position: relative; flex: 1; min-height: 360px; }

.fc-legend { position: absolute; z-index: 3; top: 6px; left: 8px; display: grid; gap: 2px; max-width: calc(100% - 16px); padding: 4px 7px; border-radius: 7px; background: rgba(255, 255, 255, .86); font-size: 12px; pointer-events: none; }
.fc-legend-row { display: flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; }
.fc-legend-row i { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.fc-legend-row > span:not(.fc-legend-value):not(.fc-legend-badge) { overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.fc-legend-badge { padding: 0 4px; border-radius: 4px; background: #eef2ff; color: #3159b8; font-size: 10px; font-weight: 700; }
.fc-legend-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* A formula's name in the series list opens it for editing. */
button.fc-metric-name { min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; font-weight: 700; text-align: start; cursor: pointer; }
button.fc-metric-name:hover, button.fc-metric-name:focus-visible { color: var(--accent); text-decoration: underline; outline: none; }

/* "Create your own formula" dialog: statement rows on the left, the formula on the right. */
.fc-dialog { width: min(940px, calc(100% - 32px)); max-height: min(720px, calc(100vh - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 24px 60px rgba(31, 41, 55, .24); }
.fc-dialog::backdrop { background: rgba(16, 24, 40, .38); }
.fc-dialog-form { display: flex; flex-direction: column; max-height: inherit; }
.fc-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.fc-dialog-head h2 { margin: 0; font-size: 15px; font-weight: 750; }
.fc-dialog-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); flex: 1; min-height: 0; }
.fc-formula-picker { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 12px 14px; border-inline-end: 1px solid var(--line); }
.fc-formula-editor { display: flex; flex-direction: column; min-height: 0; padding: 12px 14px; overflow: auto; }
.fc-formula-editor .fc-hint { margin: 0 0 10px; }
.fc-formula-editor > label { display: block; margin: 10px 0 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.fc-dialog input[type="search"], .fc-dialog input[type="text"], .fc-dialog select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #d5dce7; border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 13px; }
.fc-dialog input:focus-visible, .fc-dialog select:focus-visible { outline: 2px solid #a9c1ff; outline-offset: 1px; border-color: var(--accent); }
#fc-formula-expression { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.fc-formula-items { flex: 1; min-height: 240px; overflow: auto; }
.fc-formula-items h3 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 4px 4px; background: var(--panel); color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.fc-formula-items ul { margin: 0 0 6px; padding: 0; list-style: none; }
.fc-formula-item { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 30px; padding: 4px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: start; cursor: pointer; }
.fc-formula-item:hover, .fc-formula-item:focus-visible { background: var(--panel-hover); outline: none; }
.fc-formula-item .fc-item-name { flex: 1; min-width: 0; }
.fc-item-owners { flex: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.fc-formula-letter { display: inline-grid; flex: none; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border: 0; border-radius: 6px; background: #eef2ff; color: #3159b8; font: inherit; font-size: 12px; font-weight: 800; }
button.fc-formula-letter { cursor: pointer; }
button.fc-formula-letter:hover, button.fc-formula-letter:focus-visible { background: #dbe4ff; outline: none; }
.fc-formula-vars { display: grid; gap: 4px; margin: 0 0 4px; padding: 0; list-style: none; }
.fc-formula-vars li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 13px; }
.fc-formula-vars .fc-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-formula-keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fc-formula-keys button { min-width: 36px; height: 30px; padding: 0 8px; border: 1px solid #d5dce7; border-radius: 7px; background: #fff; color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.fc-formula-keys button:hover, .fc-formula-keys button:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.fc-formula-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.fc-formula-options label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.fc-formula-options label[hidden] { display: none; }
.fc-formula-preview { display: grid; gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; }
.fc-formula-preview:empty { display: none; }
.fc-formula-preview li { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px; border-radius: 7px; background: #f7f8fb; }
.fc-formula-missing { color: var(--muted); }
.fc-formula-editor .fc-series-error:empty { display: none; }
.fc-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.fc-button { height: 36px; padding: 0 16px; border: 1px solid #d5dce7; border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.fc-button:hover, .fc-button:focus-visible { background: var(--panel-hover); outline: 2px solid #a9c1ff; outline-offset: 2px; }
.fc-button-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.fc-button-primary:hover:not(:disabled), .fc-button-primary:focus-visible { background: #1f55df; }
.fc-button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 860px) {
    .fc-shell { height: auto; min-height: 100vh; width: calc(100% - 24px); padding: 12px 0 24px; }
    .fc-app { grid-template-columns: minmax(0, 1fr); }
    .fc-stage { order: -1; }
    .fc-chart { flex: none; height: 68vh; min-height: 340px; }
    .fc-panel { overflow: visible; }
    .fc-status { flex-basis: 100%; margin-left: 0; }
    /* The legend is narrow here; the metric name matters more than the TTM badge. */
    .fc-legend-badge { display: none; }
    .fc-legend-row > span:not(.fc-legend-value):not(.fc-legend-badge) { min-width: 4em; }
    .fc-dialog { width: calc(100% - 24px); max-height: calc(100vh - 24px); }
    .fc-dialog-body { grid-template-columns: minmax(0, 1fr); overflow: auto; }
    .fc-formula-picker { border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .fc-formula-items { flex: none; max-height: 38vh; min-height: 0; }
    .fc-formula-editor { overflow: visible; }
}
