/* Approved local composition. Shared primitives stay in @shonoweb/ui. */
:root { --study-coal:#242526; --study-yellow:#ffd629; --study-blue:#5476d7; --study-muted:#657080; --study-canvas:#f8f9fb; }
/* Keep pagination/view changes from resizing the shell with classic scrollbars. */
html { scrollbar-gutter:stable; }
@supports not (scrollbar-gutter:stable) { html { overflow-y:scroll; } }
body { margin:0; min-width:min(320px,100%); background:var(--study-coal); }
a { color:inherit; }
[hidden] { display:none !important; }
.sr-only { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.skip-link { position:fixed; top:-80px; left:90px; z-index:7; padding:12px; background:#fff; }
.skip-link:focus { top:12px; }
.study-shell { display:grid; grid-template-columns:76px minmax(0,1fr); max-width:1600px; margin:0 auto; min-height:100dvh; }
.rail { display:flex; flex-direction:column; align-items:center; gap:26px; padding:26px 8px; color:#fff; --sw-icon-cutout:var(--study-coal); }
.rail-logo { width:44px; height:44px; display:grid; place-items:center; background:#fff; border-radius:12px; }
.rail-logo img { width:34px; height:34px; }
.rail nav { display:flex; flex-direction:column; gap:14px; position:sticky; top:30px; }
.rail-action { display:flex; align-items:center; justify-content:center; width:48px; height:48px; border-radius:12px; color:#d8dbdf; text-decoration:none; transition:background-color 150ms ease-out,color 150ms ease-out; }
.rail-action:hover { background:#3b3c3d; color:white; }
.rail-action.is-active { background:var(--study-yellow); color:var(--study-coal); --sw-icon-cutout:var(--study-yellow); }
.rail-caption { margin-top:auto; font-size:12px; color:#d8dbdf; }
.settings-panel { max-width:640px; }
.settings-options { margin-block:20px 16px; }
main { --study-report-columns:minmax(260px,.32fr) minmax(0,1fr); background:var(--study-canvas); padding:30px 32px 20px; min-width:0; }
/* One experimental surface profile; shared Panel geometry and controls are unchanged. */

.study-header { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:16px; }
.product-name { display:flex; flex-wrap:wrap; align-items:center; gap:10px; color:#525c69; font-size:13px; margin:0 0 8px; }
.demo-label { padding:3px 7px; background:#e6e9ee; border-radius:4px; font-size:12px; color:#525c69; }
.header-note { margin:8px 0 0; color:var(--study-muted); font-size:14px; }
.toolbar { display:grid; grid-template-columns:var(--study-report-columns); gap:16px; align-items:start; margin-bottom:22px; }
.project-field { width:100%; min-width:0; }
.project-control { width:100%; }
.period-field { min-width:0; container-type:inline-size; }
#period-control { width:100%; flex-wrap:nowrap; }
.project-field>label,.period-field>span { display:block; margin-bottom:7px; font-size:12px; color:#525c69; font-weight:600; }
.period-caption { margin-left:auto; flex:0 0 256px; white-space:nowrap; }
.period-caption [data-sw-icon] { display:flex; }
.period-chevron { width:16px; height:16px; flex:0 0 16px; }
@container(max-width:740px) {
  #period-control { flex-wrap:wrap; }
  #period-control>.sw-segment { flex:1; }
  #period-control>.period-caption { flex-basis:100%; margin-left:0; }
}
.range-form { padding:18px; }
.range-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.range-fields input { min-width:0; width:100%; }
.range-note { margin:12px 0; color:var(--study-muted); font-size:12px; }
.range-error { color:var(--danger); font-size:13px; margin:12px 0; }
.range-actions { display:flex; gap:8px; justify-content:flex-end; }
.overview { display:grid; grid-template-columns:var(--study-report-columns); gap:16px; margin-bottom:16px; }
.metric-stack { display:grid; grid-template-rows:1.1fr 1fr; gap:16px; }
.sw-panel.metric-panel { padding:22px; display:flex; flex-direction:column; justify-content:center; }
.metric-label { display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:13px; color:#525c69; }
.metric-label [data-sw-icon] { color:#69717c; display:flex; }
.metric-line { display:flex; gap:10px; justify-content:space-between; align-items:center; margin-top:16px; }
.metric-line strong { font-size:42px; font-weight:600; line-height:1.1; letter-spacing:-.025em; font-variant-numeric:tabular-nums; }
.mini-chart { width:112px; height:58px; flex:0 1 112px; }
.metric-breakdown { color:#525c69; margin:10px 0 0; font-size:13px; }
.metric-breakdown b { color:var(--ink); font-weight:600; }
.metric-foot { color:var(--study-muted); font-size:12px; line-height:1.5; margin:12px 0 0; }
.metric-foot b { font-weight:600; }
.change-up { color:#147a50; }
.change-down { color:#b04435; }
.change-flat { color:#525c69; }
.sw-panel.trend-panel { padding:22px 24px 18px; container-type:inline-size; }
.panel-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px 16px; }
.panel-heading p { margin:5px 0 0; font-size:12px; color:var(--study-muted); }
.trend-controls { display:flex; align-items:center; gap:12px; margin-left:auto; }
/* Reserve the full grouping footprint: adding available choices cannot move the chart. */
.trend-grain-slot { display:flex; justify-content:flex-end; flex:0 0 354px; min-height:52px; }
.trend-controls .sw-segments { flex-wrap:nowrap; }
.grain-short { display:none; }
.chart-legend { display:flex; gap:22px; font-size:12px; color:#525c69; margin-top:16px; }
@container(max-width:850px) {
  .trend-heading { flex-direction:column; align-items:stretch; }
  .trend-controls { justify-content:space-between; margin-left:0; }
}
@container(max-width:600px) {
  .trend-controls { flex-direction:column; align-items:stretch; }
  .trend-grain-slot { flex-basis:auto; justify-content:flex-start; }
  #trend-channels { align-self:flex-end; }
}
@container(max-width:380px) {
  .grain-full { display:none; }
  .grain-short { display:inline; }
  #trend-grains,#trend-channels { width:100%; }
  .trend-controls .sw-segment { flex:1; }
}
.chart-legend span { display:flex; gap:7px; align-items:center; }
.dot { display:inline-block; width:9px; height:9px; border-radius:50%; flex:0 0 9px; }
.all-dot { background:#c6a000; }
.unique-dot { background:var(--study-blue); }
.trend-frame { position:relative; padding:26px 0 24px 32px; margin-top:8px; }
.plot { position:relative; height:208px; }
.plot>svg { width:100%; height:100%; overflow:visible; }
.y-axis { position:absolute; top:26px; bottom:24px; left:0; width:26px; display:flex; flex-direction:column; justify-content:space-between; color:var(--study-muted); font-size:12px; }
.x-axis { position:absolute; bottom:0; right:0; left:32px; height:18px; font-size:12px; color:var(--study-muted); }
.x-axis span { position:absolute; transform:translateX(-50%); white-space:nowrap; }
.x-axis span:first-child { transform:none; }
.x-axis span:last-child:not(:first-child) { transform:translateX(-100%); }
.x-axis span:only-child { transform:translateX(-50%); }
.chart-point { position:absolute; width:44px; height:44px; padding:0; border:0; border-radius:50%; transform:translate(-50%,-50%); background:transparent; cursor:pointer; }
.chart-point:hover,.chart-point.is-selected { background:rgb(84 118 215 / 7%); }
.chart-point:focus-visible { outline:2px solid var(--focus); outline-offset:-6px; }
.chart-tooltip { position:absolute; pointer-events:none; z-index:2; transform:translate(-50%,-100%); padding:10px 13px; background:#252a31; color:#fff; font-size:12px; border-radius:8px; min-width:145px; box-shadow:0 4px 14px #2222; }
.chart-tooltip strong { display:block; margin-bottom:5px; font-weight:500; }
.chart-tooltip small { display:block; margin-top:6px; color:#d8dbdf; font-size:12px; }
.chart-tooltip>span { display:flex; align-items:center; justify-content:space-between; gap:12px; line-height:1.6; }
.chart-tooltip .forms-value b { color:#ffe476; }
.chart-tooltip .calls-value b { color:#c2cfff; }
.chart-empty { min-height:290px; display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; }
.chart-empty strong { font-weight:600; font-size:16px; }
.chart-empty p { color:var(--study-muted); max-width:32ch; font-size:13px; }
.sw-panel.call-panel { display:flex; align-items:center; gap:24px; padding:18px 22px; margin-bottom:16px; }
.call-heading { display:flex; align-items:center; flex-wrap:wrap; gap:14px; flex:1; }
.call-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); flex:2; gap:20px; margin:0; }
.call-metrics>div { border-left:1px solid #e8edf3; padding-left:26px; }
.call-metrics dt { color:var(--study-muted); font-size:12px; }
.call-metrics dd { font-size:28px; font-weight:600; line-height:1.2; margin:5px 0 0; font-variant-numeric:tabular-nums; }
#missed { color:#977815; }
.secondary-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; }
.sw-panel.sources-panel,.sw-panel.methods-panel { padding:22px; }
.sources-content { display:flex; gap:20px; align-items:center; margin-top:16px; }
.widget-actions { display:flex; align-items:center; gap:8px; max-width:100%; margin-left:auto; }
.widget-actions .sw-segments { flex-wrap:nowrap; }
.panel-heading>.sw-popover-host,.widget-actions>.sw-popover-host { display:flex; align-items:center; min-height:52px; }
.widget-menu { width:280px; }
.widget-menu-title { margin:4px 10px 2px; color:var(--study-muted); font-size:12px; }
.widget-menu .widget-check { flex:0 0 18px; }
.widget-menu [aria-pressed='false'] .widget-check { visibility:hidden; }
.donut { width:158px; height:158px; flex:0 0 158px; position:relative; }
.donut>svg { display:block; width:100%; height:100%; transform:rotate(-90deg); }
.donut-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.donut-center strong { font-size:28px; letter-spacing:-.02em; font-weight:600; font-variant-numeric:tabular-nums; }
.donut-center span { font-size:12px; color:var(--study-muted); }
.sources-list { flex:1; min-width:0; }
.source-row { display:flex; width:100%; align-items:center; gap:9px; min-height:44px; padding:7px 10px; background:none; border:0; border-radius:6px; text-align:left; cursor:pointer; }
.source-row:hover { background:#f5f6f8; }
.source-row:disabled { cursor:default; }
.source-name { font-size:12px; flex:1; min-width:0; }
.source-value { font-size:12px; font-weight:600; white-space:nowrap; }
.source-percent { font-size:12px; color:var(--study-muted); min-width:35px; text-align:right; }
.source-empty { color:var(--study-muted); font-size:13px; margin-bottom:0; }
.methods-panel { display:flex; flex-direction:column; }
.methods-panel>.panel-heading { flex-wrap:nowrap; align-items:flex-start; }
.methods-panel>.panel-heading>div:first-child { flex:1; min-width:0; }
#channel-bars { margin-top:22px; }
.channel-row+.channel-row { margin-top:22px; }
.channel-heading { display:flex; align-items:center; gap:18px; font-size:13px; margin-bottom:9px; }
.channel-heading>span:first-child { flex:1; }
.channel-heading strong { font-weight:600; }
.channel-percent { min-width:35px; color:var(--study-muted); text-align:right; }
.channel-track { height:14px; background:#f0f3f7; border-radius:7px; overflow:hidden; }
.channel-bar { display:block; height:100%; border-radius:7px; }
.channel-bar--calls { background:linear-gradient(90deg,#85a1ee,#4b6fd0); }
.channel-bar--forms { background:linear-gradient(90deg,#ffe678,#ffd126); }
.methods-action { display:flex; justify-content:flex-end; margin-top:auto; padding-top:18px; }
.sw-panel.delivery-panel { padding:24px 26px; }
.delivery-icon { display:flex; color:#977815; }
.delivery-count { display:flex; align-items:baseline; gap:14px; margin:25px 0 16px; }
.delivery-count strong { font-size:42px; font-weight:600; line-height:1; }
.delivery-count span { font-size:14px; color:#626b78; }
.delivery-footer { display:flex; justify-content:space-between; gap:20px; align-items:center; }
.delivery-footer p { max-width:45ch; color:var(--study-muted); font-size:13px; margin:0; }
.delivery-footer .sw-button { flex-shrink:0; }
.journal-header { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:24px 26px 16px; }
.journal-header p { font-size:12px; color:var(--study-muted); margin:5px 0 0; }
.search-field { width:245px; position:relative; }
.search-field>[data-sw-icon] { position:absolute; top:12px; left:12px; color:#626b78; display:flex; }
.search-field input { padding-left:40px; }
.journal-table { width:100%; border-collapse:collapse; font-size:13px; }
.journal-table th { text-align:left; padding:10px 22px; background:#f9fafb; color:#626b78; font-weight:500; font-size:12px; border-block:1px solid #edf0f3; }
.journal-table td { padding:13px 22px; border-bottom:1px solid #edf0f3; }
.journal-table td:first-child { white-space:nowrap; }
.journal-table td:first-child small { color:var(--study-muted); padding-left:8px; }
.mail-status { display:inline-flex; align-items:center; gap:7px; font-size:12px; }
.mail-status i { width:6px; height:6px; flex:0 0 6px; border-radius:50%; background:#147a50; }
.mail-status.is-failed { color:#aa392b; }
.mail-status.is-failed i { background:#aa392b; }
.call-status { font-size:12px; }
.journal-footer { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 26px; color:var(--study-muted); font-size:12px; }
.active-filter { display:flex; align-items:center; justify-content:space-between; gap:12px; background:#fff8d8; padding:6px 26px; font-size:12px; }
.empty-journal { padding:30px 26px; text-align:center; color:var(--study-muted); font-size:13px; }
.study-footer { display:flex; align-items:center; justify-content:space-between; gap:20px; padding-top:14px; color:#626b78; font-size:12px; }
.study-error { display:flex; justify-content:space-between; gap:16px; align-items:center; background:#fff0ee; border-radius:12px; padding:16px 20px; margin-bottom:20px; font-size:13px; }
.study-error p { margin:5px 0 0; }
@media(max-width:1150px) {
  main { --study-report-columns:250px minmax(0,1fr); padding:24px; }
  .metric-line strong { font-size:36px; }
  .mini-chart { width:86px; flex-basis:86px; }
  .donut { width:130px; height:130px; flex-basis:130px; }
  .sources-content { gap:14px; }
  .call-heading { flex-basis:220px; }
  .call-metrics>div { padding-left:18px; }
}
@media(max-width:940px) {
  #period-control { flex-wrap:wrap; }
  #period-control>.sw-segment { flex:1; }
  #period-control>.period-caption { flex-basis:100%; margin-left:0; }
  main { --study-report-columns:minmax(0,1fr); }
  .metric-stack { grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:none; }
  .secondary-grid { grid-template-columns:1fr; }
  .call-panel { flex-wrap:wrap; }
  .call-heading { flex-basis:100%; }
  .call-metrics { flex-basis:100%; }
  .call-metrics>div:first-child { border-left:0; padding-left:0; }
}
@media(max-width:620px) {
  body { background:var(--study-canvas); }
  .study-shell { display:block; }
  .rail { position:sticky; top:0; z-index:4; background:var(--study-coal); padding:8px 16px; flex-direction:row; justify-content:space-between; gap:16px; }
  .rail nav { position:static; flex-direction:row; gap:8px; }
  .rail-caption { display:none; }
  .rail-logo { width:44px; height:44px; border-radius:10px; }
  .rail-action { width:44px; height:44px; border-radius:10px; }
  main { padding:22px 16px 18px; }
  .study-header { gap:12px; margin-bottom:20px; align-items:flex-start; }
  .header-note { font-size:13px; max-width:30ch; }
  .toolbar { gap:12px; margin-bottom:20px; }
  .project-field,.period-field { width:100%; }
  #period-control { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); }
  #period-control>.sw-segment { grid-column:span 2; padding-inline:8px; }
  #period-control>.sw-segment:nth-child(4),#period-control>.sw-segment:nth-child(5) { grid-column:span 3; }
  #period-control>.period-caption { grid-column:1 / -1; width:100%; margin-left:0; flex-basis:auto; }
  .period-field>span { display:none; }
  .range-fields { grid-template-columns:1fr; }
  .overview { gap:16px; }
  .metric-stack { gap:12px; }
  .sw-panel.metric-panel { padding:16px; justify-content:flex-start; }
  .metric-label { font-size:12px; min-height:34px; align-items:flex-start; }
  .metric-label [data-sw-icon] { display:none; }
  .metric-line { flex-wrap:wrap; margin-top:8px; gap:6px; }
  .metric-line strong { font-size:32px; }
  .mini-chart { width:90px; height:40px; flex-basis:90px; }
  .metric-breakdown { font-size:12px; line-height:1.7; }
  .metric-foot { margin-top:auto; padding-top:10px; }
  .sw-panel.trend-panel { padding:20px 18px 14px; }
  .sources-panel .widget-actions { width:100%; }
  #source-channels { flex:1; }
  #source-channels .sw-segment { flex:1; padding-inline:10px; }
  .plot { height:200px; }
  .trend-frame { padding-top:32px; }
  .y-axis { top:32px; }
  .chart-tooltip { min-width:138px; }
  .sw-panel.call-panel { padding:20px 18px; gap:18px; }
  .call-metrics { gap:12px; }
  .call-metrics>div { padding-left:8px; }
  .call-metrics dt { min-height:34px; line-height:1.5; }
  .call-metrics dd { font-size:24px; margin-top:6px; }
  .sw-panel.sources-panel,.sw-panel.methods-panel { padding:20px 18px; }
  .sources-content { flex-direction:column; gap:10px; }
  .donut { width:150px; height:150px; flex-basis:150px; }
  .sources-list { width:100%; }
  .source-name,.source-value { font-size:13px; }
  .methods-action .sw-button { width:100%; }
  .sw-panel.delivery-panel { padding:20px 18px; }
  .delivery-footer { flex-direction:column; align-items:stretch; }
  .journal-header { align-items:stretch; flex-direction:column; gap:16px; padding:20px 18px 16px; }
  .search-field { width:100%; }
  .journal-table { display:block; }
  .journal-table thead { display:none; }
  .journal-table tbody { display:block; }
  .journal-table tr { display:grid; grid-template-columns:1fr; padding:14px 18px; gap:8px; border-top:1px solid #edf0f3; }
  .journal-table td { padding:0; border:0; font-size:13px; }
  .journal-table td:first-child { color:var(--study-muted); font-size:12px; }
  .journal-table .source-cell { font-weight:500; }
  .journal-table .form-cell { color:var(--study-muted); }
  .journal-footer,.active-filter { padding-inline:18px; }
  .study-footer { flex-direction:column; align-items:flex-start; gap:0; }
  .study-footer p { max-width:42ch; }
  .study-error { align-items:flex-start; flex-direction:column; }
}
@media(max-width:380px) {
  .call-metrics { grid-template-columns:1fr; gap:12px; }
  .call-metrics>div { display:flex; align-items:center; justify-content:space-between; gap:12px; border-left:0; padding-left:0; }
  .call-metrics dt { min-height:0; }
  .call-metrics dd { margin:0; }
}


html:has(#app-view[hidden]) body{background:var(--background);}
.rail-logout{border:0;background:transparent;margin-top:auto;cursor:pointer;flex-shrink:0;}
.updated-at{font-size:12px;color:var(--muted);}
.data-scope{color:var(--muted);font-size:13px;margin:0 0 16px;}
#settings{display:grid;gap:24px;}
#settings .settings-panel{max-width:none;}
#settings-content .sw-panel{padding:24px;}
#settings .section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px;}
.settings-details>div{display:flex;justify-content:space-between;margin-bottom:14px;gap:16px;}
.settings-details dd{margin:0;}
#refresh[aria-busy="true"]{cursor:wait;}
#dashboard[aria-busy="true"],#journal[aria-busy="true"]{opacity:.55;pointer-events:none;}
.journal-page{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--muted);display:block;margin-top:4px;}
@media(max-width:620px){.rail-logout{margin-left:auto;margin-top:0;width:44px;}.rail{gap:8px;} .rail nav{gap:2px;} .rail-logo{width:36px;height:36px;} .rail nav .rail-action{width:42px;height:44px;} #settings-content .sw-panel{padding:20px;} }
