/* APE visual language. This file changes presentation only; screens retain their data and actions. */
:root {
  --ink: #111317;
  --muted: #6b727d;
  --line: #e1e4e9;
  --paper: #f7f8fa;
  --white: #fff;
  --accent: #2f66d9;
  --accent-hover: #2455bd;
  --accent-pale: #e8effc;
  --danger: #c8322e;
  --danger-pale: #fce6e6;
  --amber: #b26a00;
  --amber-pale: #fdf1dc;
  --radius: 6px;
  --shadow: none;
  --ds-nav-open: 216px;
  --ds-nav-closed: 44px;
  --ds-row: 32px;
  font-family: "IBM Plex Sans", Inter, "Segoe UI", Arial, sans-serif;
}

.shell { width: 100%; max-width: none; margin: 0; }
.shell, .shell button, .shell input, .shell select, .shell textarea { font-family: inherit; }
.shell { font-size: 13px; line-height: 1.4; }
.shell .main-area { min-width: 0; }
.shell .page { max-width: none; width: 100%; margin: 0; padding: 16px; }
.shell .page-header { align-items: center; gap: 12px; margin-bottom: 12px; }
.shell .page-header .actions { padding: 0; }
.shell h1 { font-size: 18px; line-height: 24px; letter-spacing: 0; font-weight: 600; }
.shell h2 { font-size: 15px; line-height: 20px; letter-spacing: 0; }
.shell h3 { font-size: 13px; line-height: 18px; }
.shell .eyebrow { font-size: 10px; letter-spacing: .07em; }
.shell .page-copy { margin-top: 4px; }
.shell .actions { gap: 6px; }

/* The same navigation stays available in its existing expanded and collapsed states. */
.shell .sidebar { padding: 6px; gap: 2px; overflow-y: auto; scrollbar-width: thin; }
.shell .sidebar-head { min-height: 32px; margin-bottom: 2px; }
.shell .sidebar-head .brand-mark { width: 24px; height: 24px; border-radius: 4px; }
.shell .sidebar-head .brand strong { font-size: 15px; }
.shell .nav-collapse { width: 28px; height: 28px; border-radius: 4px; }
.shell .nav-list { gap: 1px; }
.shell .nav-link { min-height: 30px; padding: 4px 8px; gap: 8px; border-radius: 4px; font-size: 12px; font-weight: 500; color: #4a505a; }
.shell .nav-link:hover { background: #f2f4f7; color: var(--ink); }
.shell .nav-link.active { background: var(--accent-pale); color: var(--accent); }
.shell .nav-icon { width: 18px; font-size: 16px; }
.shell.nav-collapsed .nav-link { width: 30px; height: 30px; }
.shell.nav-collapsed .sidebar-head { justify-content: center; }
.shell .docs-nav-link { margin-top: 3px; }
.shell .topbar { height: 44px; min-height: 44px; padding: 0 8px; gap: 8px; background: #fff; }
.shell .topbar .brand-mobile { display: none; }
.shell .workspace-control { gap: 6px; }
.shell .workspace-control label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.shell .workspace-control select { min-height: 28px; max-width: 220px; padding: 2px 22px 2px 8px; border: 1px solid #c7ccd4; border-radius: 4px; background: #fff; font-size: 12px; }
.shell .topbar-user { gap: 8px; margin-left: auto; }
.shell .user-email { font-size: 11px; }
.shell .section-guide-toggle { min-height: 28px; padding: 2px 6px; border-radius: 4px; }
.shell .section-guide-toggle[aria-pressed="true"] { border-color: #c9d9f8; }
.shell .section-guide-panel { border-color: #c9d9f8; background: #f4f7fe; border-radius: 6px; }

/* Dense, flat surfaces and controls from the supplied kit. */
.shell .metric-grid { gap: 8px; margin-bottom: 12px; }
.shell .metric-card { padding: 10px 12px; border-radius: 6px; box-shadow: none; }
.shell .metric-label { margin-bottom: 3px; font-size: 11px; }
.shell .metric-value { font-size: 24px; line-height: 30px; font-variant-numeric: tabular-nums; }
.shell .metric-foot { margin-top: 3px; }
.shell .panel { margin-bottom: 12px; border-radius: 6px; box-shadow: none; }
.shell .panel-head { padding: 10px 12px 8px; }
.shell .panel-body { padding: 0 12px 12px; }
.shell .toolbar { gap: 6px; padding: 0 12px 10px; flex-wrap: wrap; justify-content: flex-start; }
.shell .button { min-height: 28px; padding: 3px 8px; gap: 5px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.shell .button.small { min-height: 24px; padding: 2px 6px; font-size: 11px; }
.shell .button.secondary { border-color: #c7ccd4; }
.shell .button.secondary:hover { background: #f2f4f7; }
.shell .button.quiet:hover { background: #eef0f3; }
.shell .field { gap: 4px; }
.shell .field label { font-size: 12px; }
.shell .field input, .shell .field select, .shell .search, .shell .select { min-height: 28px; padding: 3px 8px; border-radius: 4px; font-size: 12px; }
.shell .field textarea { padding: 7px 8px; border-radius: 4px; font-size: 12px; }
.shell .badge { padding: 2px 6px; border-radius: 4px; font-size: 10px; }
.shell .notice, .shell .subtle-callout { padding: 9px 12px; border-radius: 6px; }
.shell .breadcrumbs { margin-bottom: 12px; }
.shell .empty { padding: 24px 16px; }
.shell .empty-symbol { width: 36px; height: 36px; margin-bottom: 8px; border-radius: 6px; }
.shell .empty p { margin: 5px auto 10px; }
.shell .two-columns { gap: 12px; }

/* Tables remain horizontally scrollable; dense rows make large datasets scannable. */
.shell .table-scroll { border: 1px solid var(--line); border-radius: 6px; }
.shell .data-table th, .shell .data-table td { height: 32px; padding: 5px 8px; font-size: 12px; line-height: 18px; }
.shell .data-table th { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); background: var(--paper); }
.shell .data-table th:first-child, .shell .data-table td:first-child { padding-left: 8px; }
.shell .data-table th:last-child, .shell .data-table td:last-child { padding-right: 8px; }
.shell .data-table tbody tr:hover { background: #f2f4f7; }
.shell .data-table tbody tr:hover td:first-child { background: #f2f4f7; }
.shell .data-table .cell-subtitle { margin-top: 2px; }

/* Findings keep their real media, actions, filters and modal. Cards follow the kit's two-column layout. */
.shell .ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shell .ref-card { display: grid; grid-template-columns: 144px minmax(0, 1fr); align-items: stretch; min-width: 0; border-radius: 6px; box-shadow: none; }
.shell .ref-card:hover { border-color: #c7ccd4; box-shadow: 0 1px 2px #11131710; }
.shell .ref-card > .ref-preview { width: 144px; max-width: none; height: 100%; min-height: 144px; }
.shell .ref-card > .ref-preview:has(iframe) { grid-column: 1 / -1; width: 100%; min-height: 0; }
.shell .ref-card > .ref-preview:has(iframe) + .ref-card-body { grid-column: 1 / -1; }
.shell .ref-card > .ref-preview:has(iframe) iframe { height: 200px; }
.shell .ref-card > .ref-preview:has(iframe).ref-embed-wide iframe { height: auto; aspect-ratio: 16 / 9; }
.shell .ref-card > .ref-preview .ref-poster, .shell .ref-card > .ref-preview .media-thumbnail { width: 100%; height: 100%; min-height: 144px; }
.shell .ref-card > .ref-preview .ref-poster img, .shell .ref-card > .ref-preview .media-thumbnail img { width: 100%; height: 100%; min-height: 144px; object-fit: cover; }
.shell .ref-card > .ref-preview.ref-preview-link { padding: 8px; gap: 5px; }
.shell .ref-card > .ref-preview.ref-preview-link strong { font-size: 12px; }
.shell .ref-card > .ref-preview .ref-preview-footer { padding: 4px 6px; }
.shell .ref-card-body { min-width: 0; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.shell .ref-card h2 { margin: 0; font-size: 13px; line-height: 18px; }
.shell .ref-card .ref-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; font-weight: 600; }
.shell .ref-author { margin: 0; font-size: 11px; }
.shell .ref-card .ref-summary { margin: 0; font-size: 11px; line-height: 15px; -webkit-line-clamp: 2; }
.shell .ref-card .ref-brief { margin: 0; }
.shell .ref-card .ref-tags { margin: 2px 0; }
.shell .ref-card .ref-tags span, .shell .ref-tag-chips button, .shell .ref-tag-chips span { border-radius: 4px; }
.shell .ref-card .ref-metrics { gap: 10px; padding: 4px 0; margin-top: auto; }
.shell .ref-card .ref-metrics span { flex-direction: row; align-items: baseline; gap: 3px; }
.shell .ref-card .ref-metrics strong { font-size: 12px; }
.shell .ref-card .ref-metrics small { font-size: 10px; }
.shell .ref-card-bottom { gap: 5px; }
.shell .ref-card-body > .button { width: auto; align-self: flex-start; }
.shell .ref-viewbar, .shell .ref-toolbar { padding-left: 12px; padding-right: 12px; }
.shell .ref-view-option { min-height: 28px; padding: 3px 8px; border-radius: 4px; }
.shell .ref-view-option[aria-selected="true"], .shell .ref-view-option[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.shell .ref-platform-icon { border-radius: 4px; }
.shell .ref-icon-action { border-radius: 4px; }
.shell .ref-table-wrap { border-radius: 6px; }
.shell .ref-table th, .shell .ref-table td { padding: 6px 8px; font-size: 12px; }
.shell .ref-table th { font-size: 11px; font-weight: 500; background: var(--paper); }
.shell .ref-detail-dialog, .shell .ref-player-dialog { border-radius: 8px; }

/* Mobile keeps the existing navigation behavior and makes every card legible. */
@media (max-width: 960px) {
  .shell .sidebar { padding: 5px 8px; overflow: visible; }
  .shell .topbar { height: auto; min-height: 44px; }
  .shell .page { padding: 12px; }
}
@media (max-width: 700px) {
  .shell .ref-grid { grid-template-columns: minmax(0, 1fr); }
  .shell .topbar { height: auto; min-height: 44px; padding: 6px 8px; }
  .shell .page { padding: 10px; }
  .shell .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell .button, .shell .field input, .shell .field select, .shell .search, .shell .select,
  .shell .section-guide-toggle, .shell .ref-view-option, .shell .ref-icon-action { min-height: 40px; }
}
@media (max-width: 420px) {
  .shell .ref-card { grid-template-columns: 96px minmax(0, 1fr); }
  .shell .ref-card > .ref-preview { width: 96px; min-height: 128px; }
  .shell .ref-card > .ref-preview .ref-poster, .shell .ref-card > .ref-preview .media-thumbnail,
  .shell .ref-card > .ref-preview .ref-poster img, .shell .ref-card > .ref-preview .media-thumbnail img { min-height: 128px; }
  .shell .user-email { display: none; }
}
