:root {
  --background: #f3f4f6;
  --foreground: #111111;
  --card: #ffffff;
  --muted: #e9eaed;
  --muted-foreground: #777986;
  --border: #cbcdd3;
  --primary: #003968;
  --accent: #eaf3fb;
  --green: #0c8f4f;
  --green-bg: #eaf8f0;
  --red: #d9363e;
  --red-bg: #fff0f0;
  --yellow: #9b6500;
  --yellow-bg: #fff6df;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
  --brand-navy: #003968;
  --brand-dark: #00192d;
  --brand-yellow: #f9c80e;
  --brand-red: #ff595e;
  --brand-green: #0cce6b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; height: 100vh; overflow: hidden; background: var(--background); color: var(--foreground); font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mt { margin-top: 16px; }

.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 24px; padding: 18px; background: #17202b; color: #e3e8ee; border-right: 1px solid #283546; }
.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: #fff; color: var(--primary); font-size: 13px; font-weight: 800; }
.brand-block strong, .brand-block span { display: block; }
.brand-block strong { font-size: 15px; }
.brand-block span { margin-top: 2px; color: #93a1b2; font-size: 12px; }
nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item { width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; color: #cbd4df; background: transparent; text-align: left; }
.nav-item.active, .nav-item:hover { background: #263241; color: #fff; }
.sidebar-footer { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 16px; border-top: 1px solid #283546; }
.sidebar-footer span { color: #93a1b2; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.sidebar-footer strong { color: #dce5ef; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 18px; gap: 14px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-header h1 { margin: 0; font-size: 24px; line-height: 1.15; letter-spacing: 0; }
.page-header p { margin: 4px 0 0; color: var(--muted-foreground); }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 34px; border-radius: 8px; transition: 0.16s ease; }
.button { padding: 0 12px; border: 1px solid var(--border); background: var(--card); color: var(--foreground); }
.button:hover, .icon-button:hover { background: var(--muted); }
.button:disabled { opacity: 0.6; cursor: default; }
.icon-button { width: 34px; border: 0; background: transparent; color: var(--muted-foreground); font-size: 24px; line-height: 1; }

.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { display: flex; flex-direction: column; gap: 4px; min-height: 88px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.stat-card span, .stat-card small { color: var(--muted-foreground); font-size: 12px; }
.stat-card strong { font-size: 26px; line-height: 1; }

.table-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); }
.search-box { display: flex; align-items: center; gap: 8px; min-width: 260px; max-width: 440px; flex: 1; height: 34px; padding: 0 10px; border-radius: 8px; background: var(--muted); color: var(--muted-foreground); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--foreground); }
.search-clear { display: inline-grid; place-items: center; flex: 0 0 auto; width: 22px; height: 22px; border: 0; border-radius: 999px; background: #d6d9df; color: #3c414a; font-size: 16px; line-height: 1; }
.search-clear:hover { background: #c7cbd3; }
.filters { display: flex; align-items: flex-end; gap: 8px; color: var(--muted-foreground); }
.filter-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.filter-field span { color: var(--muted-foreground); }
select { height: 34px; max-width: 180px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--foreground); }
.row-count { margin-left: auto; color: var(--muted-foreground); white-space: nowrap; }
.error-banner { padding: 10px 12px; border-bottom: 1px solid #ffd8d8; background: var(--red-bg); color: var(--red); }

.table-wrap { flex: 1; min-height: 0; overflow: auto; }
.pagination { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--card); }
.page-size-field { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); font-size: 12px; font-weight: 650; white-space: nowrap; }
.page-size-field select { width: 76px; }
.page-info { margin-left: auto; color: var(--muted-foreground); font-size: 12px; white-space: nowrap; }
.page-actions { display: flex; gap: 8px; }
table { width: 100%; min-width: 2540px; border-collapse: collapse; }
table.accounts-table { min-width: 720px; }
.account-row { cursor: pointer; }
.account-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
thead { position: sticky; top: 0; z-index: 5; background: var(--card); }
th, td { border-bottom: 1px solid var(--border); padding: 9px 10px; text-align: left; vertical-align: middle; }
th { color: var(--muted-foreground); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
th:last-child, td:last-child { position: sticky; right: 0; z-index: 4; background: inherit; box-shadow: -8px 0 10px rgba(243, 244, 246, 0.86); }
th:last-child { z-index: 7; background: var(--card); }
th button { padding: 0; border: 0; background: transparent; color: inherit; text-transform: inherit; letter-spacing: inherit; font-size: inherit; font-weight: inherit; }
tbody tr { transition: background 0.14s ease; }
tbody tr:nth-child(even) { background: #f8f9fb; }
tbody tr:hover { background: var(--accent); }
tbody tr.row-selected, tbody tr.row-selected:nth-child(even) { background: #dceeff; }
tbody tr.row-selected:hover { background: #d2e8ff; }
tbody tr.row-selected td:first-child { box-shadow: inset 4px 0 0 var(--primary); }
.cell-title { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.cell-sub { display: block; margin-top: 2px; color: var(--muted-foreground); font-size: 11px; }
.summary-cell { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2f333a; }
.summary-link { display: block; max-width: 190px; overflow: hidden; padding: 0; border: 0; background: transparent; color: #2f333a; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.summary-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.context-cell { min-width: 92px; color: #2f333a; font-weight: 600; white-space: nowrap; }
.video-type-cell { width: 170px; max-width: 170px; overflow: hidden; white-space: nowrap; }
.video-type-link { display: block; max-width: 160px; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.visible-text-cell { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visible-text-link { display: block; max-width: 170px; overflow: hidden; padding: 0; border: 0; background: transparent; color: #2f333a; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.visible-text-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.caption-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caption-link { display: block; max-width: 220px; overflow: hidden; padding: 0; border: 0; background: transparent; color: #2f333a; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.caption-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.product-focus { font-weight: 700; white-space: nowrap; }
.numeric-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted-foreground); }
.row-actions a { color: var(--primary); text-decoration: none; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--primary); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.language-risk-link { text-decoration: none; }
.quality-link { text-decoration: none; }
.link-button:hover { opacity: 0.78; }
.quality-disabled { color: var(--muted-foreground); font-weight: 650; opacity: 0.62; }
.play-cell { width: 52px; text-align: center; }
.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.play-button:hover { background: var(--accent); }
.play-button.playing { border-color: var(--primary); background: var(--primary); color: #fff; }
.play-button:disabled { cursor: default; opacity: 0.36; background: var(--muted); color: var(--muted-foreground); }
.loading-cell, .empty-cell { height: 180px; color: var(--muted-foreground); text-align: center; }

.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 22px; padding: 2px 8px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge-neutral { border-color: var(--border); background: var(--muted); color: #333842; }
.badge-good { background: var(--green-bg); color: var(--green); }
.badge-bad { background: var(--red-bg); color: var(--red); }
.badge-warn { background: var(--yellow-bg); color: var(--yellow); }

.account-detail-panel { flex: 1; min-height: 0; overflow: auto; padding: 0 2px 18px; animation: account-page-in 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.account-detail-topbar { position: sticky; top: 0; z-index: 10; padding: 2px 0 12px; background: var(--background); }
.back-button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); color: var(--brand-navy); font-weight: 700; }
.back-button:hover { background: var(--accent); }
.back-button span { font-size: 19px; line-height: 1; }
.account-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }
.account-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 62px; height: 62px; border-radius: 16px; background: var(--brand-navy); color: #fff; font-size: 26px; font-weight: 800; }
.account-platform { margin-bottom: 6px; }
.account-hero h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.account-hero p { margin: 5px 0 0; color: var(--muted-foreground); font-size: 13px; }
.account-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.account-stat-card { display: flex; flex-direction: column; gap: 5px; min-height: 116px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03); }
.account-stat-card span { color: var(--muted-foreground); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.account-stat-card strong { margin-top: auto; color: var(--foreground); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.account-stat-card strong.account-stat-text { font-size: 22px; line-height: 1.1; }
.account-stat-card small { color: var(--muted-foreground); font-size: 12px; }
.account-dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 12px; }
.dashboard-tile { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03); }
.timeline-tile { min-height: 442px; }
.account-breakdown-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.tile-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tile-heading span { color: var(--muted-foreground); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.tile-heading h3 { margin: 3px 0 0; font-size: 17px; }
.tile-heading > strong { color: var(--muted-foreground); font-size: 12px; font-weight: 650; }
.regularity-chart { display: block; width: 100%; height: 330px; overflow: visible; }
.regularity-chart { touch-action: none; user-select: none; cursor: crosshair; }
.regularity-chart:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.regularity-chart.selecting .chart-point { pointer-events: none; }
.regularity-selection { fill: var(--primary); fill-opacity: .16; stroke: var(--primary); stroke-width: 1; pointer-events: none; }
.regularity-zoom-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.regularity-zoom-period { font-size: 12px; color: var(--foreground); }
.regularity-zoom-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted-foreground); }
.chart-grid-line { stroke: rgba(0, 0, 0, 0.08); stroke-width: 1; }
.chart-axis-label { fill: #8e8e93; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; font-size: 11px; }
.chart-line { fill: none; stroke: var(--brand-navy); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { fill: #fff; stroke: var(--brand-navy); stroke-width: 2.5; transition: 0.15s ease; }
.chart-point:hover { r: 6; fill: var(--brand-yellow); }
.account-empty-chart { display: grid; place-items: center; min-height: 160px; color: var(--muted-foreground); font-size: 12px; text-align: center; }
.breakdown-list { display: flex; flex-direction: column; gap: 12px; }
.breakdown-row { display: flex; flex-direction: column; gap: 5px; }
.breakdown-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.breakdown-label span { display: flex; align-items: center; min-width: 0; color: #343840; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breakdown-label i { flex: 0 0 auto; width: 8px; height: 8px; margin-right: 8px; border-radius: 999px; }
.breakdown-label strong { font-variant-numeric: tabular-nums; }
.breakdown-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--muted); }
.breakdown-track span { display: block; height: 100%; border-radius: inherit; }
.donut-layout { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 18px; align-items: center; min-height: 160px; }
.donut-chart { display: grid; place-items: center; width: 136px; height: 136px; border-radius: 50%; }
.donut-chart > div { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 82px; height: 82px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5); }
.donut-chart strong { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.donut-chart span { margin-top: 4px; color: var(--muted-foreground); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.donut-legend > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.donut-legend span { display: flex; align-items: center; min-width: 0; overflow: hidden; color: #343840; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend i { flex: 0 0 auto; width: 8px; height: 8px; margin-right: 7px; border-radius: 999px; }
.donut-legend strong { font-variant-numeric: tabular-nums; }
.account-posts-tile { margin-top: 12px; padding: 0; overflow: hidden; }
.account-history-heading { padding: 16px; margin: 0; }
.account-posts-tile .table-wrap { height: min(68vh, 720px); min-height: 430px; border-top: 1px solid var(--border); }
.account-posts-tile tbody tr { cursor: pointer; }
@keyframes account-page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(0, 0, 0, 0.42); backdrop-filter: blur(4px); }
.modal { display: flex; flex-direction: column; width: min(1180px, 100%); max-height: 92vh; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--background); box-shadow: var(--shadow); }
.transcript-modal { width: min(900px, 100%); }
.summary-modal { width: min(760px, 100%); }
.storyboard-backdrop { background: rgba(16, 24, 40, .22); backdrop-filter: blur(2px); }
.storyboard-modal { width: min(1100px, 100%); border-radius: 10px; background: var(--card); box-shadow: 0 6px 24px rgba(0, 25, 50, .18); font-size: 12px; }
.storyboard-modal .modal-header { padding: 12px 16px; align-items: center; }
.storyboard-modal .modal-header h2 { font-size: 14px; font-weight: 650; }
.storyboard-modal .modal-header p { margin-top: 3px; font-size: 11px; }
.storyboard-modal .modal-header .icon-button { width: 28px; height: 28px; min-width: 28px; border: 0; background: transparent; color: var(--muted-foreground); }
.storyboard-modal .modal-header .icon-button:hover { background: var(--muted); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px; border-bottom: 1px solid var(--border); background: var(--card); }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-header p { margin: 4px 0 0; max-width: 760px; overflow: hidden; color: var(--muted-foreground); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tab-bar { display: flex; gap: 4px; padding: 8px 12px 0; background: var(--card); }
.tab { height: 34px; padding: 0 12px; border: 0; border-radius: 7px 7px 0 0; background: transparent; color: var(--muted-foreground); }
.tab.active { background: var(--background); color: var(--foreground); font-weight: 650; }
.modal-body { flex: 1; min-height: 0; overflow: auto; padding: 14px; }
.transcript-modal-body { padding: 0; overflow: hidden; }
.summary-modal-body { height: min(58vh, 520px); overflow: auto; padding: 14px; }
.quality-modal { width: min(860px, 100%); }
.quality-modal-body { height: min(72vh, 680px); overflow: auto; padding: 14px; }
.storyboard-modal-body { height: auto; max-height: min(66vh, 560px); overflow: auto; padding: 12px 16px 16px; overscroll-behavior: contain; scroll-snap-type: x proximity; scroll-padding-inline: 16px; scrollbar-width: thin; scrollbar-color: #cbd1d8 transparent; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-section { padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.span-2 { grid-column: span 2; }
.detail-section h3, .section-title h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); }
.detail-section p { margin: 0 0 10px; line-height: 1.5; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 32px; border-top: 1px solid #edf0f3; }
.kv:first-of-type { border-top: 0; }
.kv span, .context-grid span { color: var(--muted-foreground); font-size: 12px; }
.context-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.context-grid div { display: flex; flex-direction: column; gap: 3px; }
.caption { margin-top: 12px; padding-top: 12px; border-top: 1px solid #edf0f3; color: #30343b; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-title span { color: var(--muted-foreground); font-size: 12px; }
.media-grid { display: grid; gap: 10px; }
.media-grid.crops { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.media-grid.frames { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.media-item { margin: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.media-item img, .media-grid.frames img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #111; }
.media-grid.frames img { border-radius: 8px; }
.media-item figcaption { display: flex; flex-direction: column; gap: 3px; padding: 8px; min-height: 62px; }
.media-item figcaption strong { font-size: 12px; line-height: 1.3; }
.media-item figcaption span { color: var(--muted-foreground); font-size: 11px; line-height: 1.3; }
.empty-state { display: grid; place-items: center; min-height: 120px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted-foreground); }
.full-text { margin: 0 0 12px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); line-height: 1.55; }
.segments { display: flex; flex-direction: column; gap: 8px; }
.segment { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.segment span { color: var(--muted-foreground); font-size: 12px; }
.segment p { margin: 0; }
.json-view { margin: 0; padding: 14px; overflow: auto; border-radius: 8px; background: #111820; color: #dbe7f5; font-size: 12px; line-height: 1.45; }
.transcript-text-panel { height: min(70vh, 720px); overflow: auto; padding: 14px; }
.long-transcript { margin: 0; padding: 14px; min-height: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--foreground); white-space: pre-wrap; line-height: 1.58; font-family: inherit; font-size: 14px; }
.translation-list { display: flex; flex-direction: column; gap: 10px; }
.translation-item { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px 12px; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.translation-item span { color: var(--muted-foreground); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.translation-item p { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.risk-list { display: flex; flex-direction: column; gap: 12px; }
.risk-item { padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.risk-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.risk-item-header strong { font-size: 13px; text-transform: capitalize; }
.risk-item-header span, .risk-item-header em { padding: 2px 7px; border-radius: 6px; background: var(--muted); color: #333842; font-size: 11px; font-style: normal; font-weight: 700; }
.risk-text-grid { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 12px; }
.risk-text-grid span { color: var(--muted-foreground); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.risk-text-grid p { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.storyboard-list { display: grid; grid-auto-flow: column; grid-auto-columns: min(196px, 66vw); align-items: start; gap: 14px; width: max-content; }
.storyboard-item { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; padding: 0 14px 0 0; border-right: 1px solid var(--border); scroll-snap-align: start; }
.storyboard-item:last-child { border-right: 0; }
.storyboard-item img { display: block; flex: none; width: 100%; height: clamp(140px, 23vh, 180px); object-fit: contain; border-radius: 8px; background: var(--muted); }
.storyboard-copy { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.storyboard-time { align-self: flex-start; padding: 2px 6px; border-radius: 5px; background: var(--muted); color: var(--muted-foreground); font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.storyboard-copy p { margin: 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.storyboard-copy strong { display: block; margin-bottom: 1px; color: var(--muted-foreground); font-size: 11px; font-weight: 500; }

@media (max-width: 980px) {
  body { overflow: auto; }
  .app-shell { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .sidebar { display: none; }
  .main { min-height: 100vh; }
  .stats-row, .detail-grid, .context-grid { grid-template-columns: 1fr; }
  .account-stat-grid, .account-dashboard-grid, .account-breakdown-grid { grid-template-columns: 1fr; }
  .timeline-tile { grid-row: auto; min-height: 360px; }
  .regularity-chart { height: 260px; }
  .donut-layout { grid-template-columns: 110px minmax(0, 1fr); }
  .donut-chart { width: 110px; height: 110px; }
  .donut-chart > div { width: 66px; height: 66px; }
  .span-2 { grid-column: span 1; }
  .toolbar { flex-wrap: wrap; }
  .pagination { flex-wrap: wrap; }
  .page-info { order: 3; width: 100%; margin-left: 0; }
  .search-box { max-width: none; min-width: 100%; }
}

/* Weekly post IDs: readable hover card, also accessible for text selection. */
#regularityZoom { position: relative; }
.regularity-popup { position: absolute; z-index: 5; width: 300px; max-width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--foreground); box-shadow: 0 6px 24px rgba(0, 25, 50, .18); font-size: 12px; cursor: text; user-select: text; }
.regularity-popup[hidden] { display: none; }
.regularity-popup strong, .regularity-popup > span { display: block; }
.regularity-popup strong { font-size: 13px; line-height: 1.5; }
.regularity-popup > span { margin-top: 4px; color: var(--muted-foreground); }
.regularity-popup ul { margin: 10px 0 0; padding: 0; list-style: none; max-height: 180px; overflow-y: auto; overscroll-behavior: contain; }
.regularity-popup li { padding: 5px 0; border-top: 1px solid var(--border); }
.regularity-popup code { font-size: 12px; overflow-wrap: anywhere; }
.regularity-popup p { margin: 10px 0 0; color: var(--muted-foreground); }
.regularity-hover-line { stroke: var(--primary); stroke-width: 1; stroke-dasharray: 3 3; opacity: .45; pointer-events: none; }
.chart-point.active-week { r: 6; fill: var(--brand-yellow); }

@media (min-width: 981px) and (max-width: 1300px) {
  .account-breakdown-grid .donut-layout { grid-template-columns: minmax(0, 1fr); }
  .account-breakdown-grid .donut-chart { margin-inline: auto; }
}

#accountsPanel .account-post-count { text-align: center; }
#accountsPanel .account-post-count button { justify-content: center; }

/* Shared Results and account-history storyboard availability. */
.storyboard-cell { text-align: center; }
.storyboard-link { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; vertical-align: middle; text-decoration: none; }
.storyboard-icon { display: block; width: 24px; height: 24px; object-fit: contain; }

/* Keep the Results filters usable when the video-type selector is present. */
#resultsPanel .toolbar, #resultsPanel .filters { flex-wrap: wrap; }
#videoTypeFilter { max-width: 280px; }

/* Storyboard text is optional; the footer remains accessible while scrolling. */
.storyboard-copy[hidden] { display: none; }
.storyboard-footer { flex: none; display: flex; align-items: center; padding: 4px 12px; border-top: 1px solid var(--border); }
.storyboard-text-toggle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted-foreground); cursor: pointer; }
.storyboard-text-toggle:hover { background: var(--muted); color: var(--foreground); }
.storyboard-text-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.storyboard-text-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
