/*
 * Tab and section styles, loaded after styles.css (index.html, and snip.mjs PAGE_STYLESHEETS in the
 * same order): Mx Operations Performance, OOS Event Metrics, BLUF, FCP charts and controls, Aircraft
 * OOS Events, and the Full Dataset explorer. Tokens and shared components are in styles.css.
 */
/* Mx Operations Performance: one row of three cards per region / carrier */
.ops-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 260px)); gap: 8px; }
.ops-grid .metric { min-height: 104px; padding: 10px 12px; }
.ops-grid .metric .label { font-size: 12px; }
.ops-grid .metric .value { font-size: 26px; }
.ops-grid .metric .value.nodata { color: var(--text); font-size: 22px; }
.ops-grid .metric.otp .value.below { color: var(--red); }
.ops-grid .metric.otp .value.met { color: var(--green); }
.ops-grid .metric.extra { border-style: dashed; }
.ops-note { grid-column: 1 / -1; color: var(--text-dim); font-size: 11px; font-style: italic; }

/* OOS Event Metrics: Quick's KPI row, then the two tables side by side (.agents/tasks/oos-metrics/layout/layout.md) */
.oos-kpi-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.oos-kpi-tile { position: relative; }
.oos-kpi-slot { height: 100%; }
.oos-kpi-tile .oos-kpi { box-sizing: border-box; height: 100%; min-height: 112px; padding: 34px 10px 12px; }
.oos-kpi .label { text-transform: none; letter-spacing: 0; font-size: 12px; line-height: 1.25; }
.oos-kpi .value { font-size: 28px; }
.oos-kpi .value.nodata { font-size: 20px; }
.oos-kpi-tile > .snip-btn { top: 4px; right: 4px; }
.oos-kpi-tile > .post-btn { top: 4px; right: 36px; }
/* KPI cards (.oos-kpi-row: repeat(7, minmax(0, 1fr))): icons only; three 30px icons need 98px */
.oos-kpi-tile > .post-btn, .oos-kpi-tile > .aw-post-btn { width: 30px; padding: 0; justify-content: center; }
.oos-kpi-tile > .post-btn span, .oos-kpi-tile > .aw-post-btn span { display: none; }
.oos-kpi-tile > .aw-post-btn { top: 4px; right: 68px; }
.oos-table-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: stretch; margin-bottom: 10px; }
.oos-table-row[hidden] { display: none; }
.oos-table-row > .section { margin-bottom: 0; min-width: 0; }
@media (max-width: 1200px) {
  .oos-kpi-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .oos-table-row { grid-template-columns: 1fr; }
}
/* data-pinned sections never collapse: no caret, plain title */
.section[data-pinned] > .section-head button { cursor: default; color: var(--text); }
.section[data-pinned] > .section-head button::before { content: none; }
.oos-panel .report-wrap { display: inline-block; max-width: 100%; border: 0; }
table.report.oos-table { width: auto; }
table.report.oos-table th { background: var(--glass); color: var(--text); font-weight: 700; text-transform: none; letter-spacing: 0; border: 1px solid var(--border); }
table.report.oos-table td, table.report.oos-table td.num { text-align: center; border: 1px solid var(--border); }
table.report.oos-table tbody tr:nth-child(even) { background: var(--glass); }

/* BLUF */
.bluf-status { color: var(--text-dim); font-size: 12px; font-style: italic; padding: 6px 0; }
.bluf-status:empty { display: none; }
.bluf-notes { margin: 0 0 8px; padding-left: 18px; color: var(--text-dim); font-size: 11px; }
.bluf-notes li.warning { color: var(--amber); }
.bluf-text {
  white-space: pre-wrap;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  line-height: 1.5;
}
.bluf-text:empty { display: none; }
.bluf-text p { margin: 0 0 10px; white-space: pre-line; }
.bluf-text p:last-child { margin-bottom: 0; }
.bluf-text[hidden] { display: none; }
.bluf-editor {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 120px;
  resize: vertical;
  font: inherit;
  line-height: 1.5;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.bluf-editor[hidden] { display: none; }
.bluf-actions { margin-bottom: 10px; }
.bluf-actions button + button { margin-left: 6px; }
.bluf-actions button:disabled { cursor: not-allowed; }
.bluf-edited { margin-left: 10px; font-size: 11px; font-style: italic; color: var(--accent); }
.bluf-edited[hidden] { display: none; }
/* Numbers table toggle: collapsed by default, chevron as on the section heads */
.bluf-metrics-bar { margin-bottom: 8px; }
.bluf-metrics-toggle::before { content: '\0025B8'; color: var(--accent); margin-right: 6px; }
.bluf-metrics-toggle[aria-expanded='true']::before { content: '\0025BE'; }
.report-wrap[hidden] { display: none; }
table.report td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* FCP trend charts */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.chart-card { background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px 4px; }
.chart-card h3 { margin: 0 0 2px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text); }
.chart-card .chart-total { text-align: center; font-size: 11px; color: var(--text-dim); }
.bar-chart { width: 100%; height: auto; display: block; }
.bar-chart .grid { stroke: var(--row-line); stroke-width: 1; }
.bar-chart .axis { stroke: var(--text-dim); stroke-width: 1; }
.bar-chart .tick, .bar-chart .xlabel { fill: var(--text-dim); font-size: 10px; }
.bar-chart .value { fill: var(--text); font-size: 11px; font-weight: 600; }
.bar-chart .legend { fill: var(--text); font-size: 11px; }
.chart-grid.history { grid-template-columns: 1fr; }

/* FCP controls (not a section, never snipped) and the filter note inside filtered sections */
.fcp-filters {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 10px; padding: 8px 10px;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
}
.fcp-filters[hidden] { display: none; }
.fcp-filters label { color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.fcp-filter-code { position: relative; font-size: 11px; color: var(--text-dim); }
.fcp-filter-code summary { cursor: pointer; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.fcp-filter-code summary span { color: var(--text); }
.fcp-filter-code[open] summary { border-color: var(--accent); }
.fcp-filter-code-list {
  position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: 280px; overflow: auto;
  display: flex; flex-direction: column; gap: 4px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.fcp-filter-code-list label { color: var(--text); white-space: nowrap; }
.fcp-filter-code-list input[type='checkbox'] { padding: 0; margin: 0; accent-color: var(--accent); }
.filter-note { margin: 0 0 8px; color: var(--amber); font-size: 11px; font-style: italic; }
.filter-note[hidden] { display: none; }

/* Aircraft OOS Events controls (two rows, Quick's order; not a section, never snipped) and its one table.
   The table fits the section width (wrapping headers and text) so a snip keeps all 21 columns. */
.aoos-filters {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; padding: 8px 10px;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
}
.aoos-filters[hidden] { display: none; }
.aoos-filter-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.aoos-filters label { color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.aoos-filters select { max-width: 260px; }
.aoos-filters input[type='number'] { width: 70px; }
table.report.aoos-table { table-layout: fixed; width: 100%; font-size: 11px; }
table.report.aoos-table th {
  background: var(--glass); color: var(--text); font-weight: 700; text-transform: none; letter-spacing: 0;
  white-space: normal; padding: 6px 4px; border: 1px solid var(--border);
}
table.report.aoos-table th { font-size: 10.5px; padding: 6px 2px; overflow-wrap: break-word; hyphens: auto; }
/* Widths in AOOS_COLUMNS order: text and ATA 7.5%, times 5%, short text 4%; the 9 number columns share the rest. */
table.report.aoos-table th.aoos-text, table.report.aoos-table th:nth-child(9) { width: 7.5%; }
table.report.aoos-table th:is(:nth-child(3), :nth-child(20), :nth-child(21)) { width: 5%; }
table.report.aoos-table th:is(:nth-child(1), :nth-child(2), :nth-child(4), :nth-child(5), :nth-child(10)) { width: 4%; }
table.report.aoos-table td {
  white-space: normal; overflow-wrap: break-word; vertical-align: top; padding: 5px 4px; border: 1px solid var(--border);
}
table.report.aoos-table td.empty { text-align: center; }
table.report.aoos-table tbody tr:nth-child(even) { background: var(--glass); }
.aoos-table .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-align: left; }

/* Full dataset explorer */
.explorer-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding-bottom: 10px; }
.explorer-controls label { color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.column-filters { display: contents; }
#text-filter { min-width: 220px; }
select { max-width: 220px; cursor: pointer; }
.row-count { margin-left: auto; color: var(--text-dim); font-style: italic; }
.explorer-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: var(--radius); }
table.explorer { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12px; }
table.explorer th, table.explorer td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--row-line);
  white-space: nowrap;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
table.explorer th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--navy);
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
table.explorer tbody tr:hover { background: var(--row-hover); }
table.explorer td.null { color: var(--text-dim); opacity: 0.6; }
table.explorer td.null::after { content: '\002014'; }
.show-all { margin-top: 10px; }
