:root {
  color-scheme: light;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #f8f8f8;
  accent-color: var(--accent);
  --ink: #353535;
  --muted: #606060;
  --line: #dedede;
  --subtle: #f3f3f3;
  --field: #fcfcfc;
  --header: #292929;
  --header-line: #494949;
  --accent: #ffb81c;
  --accent-hover: #efa80c;
  --accent-ink: #805000;
  --soft: #fff3d7;
  --white: #fff;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
::selection { color: var(--header); background: var(--soft); }
h1, h2, p { margin: 0; }
.shell { width: min(100% - 80px, 1344px); margin-inline: auto; }
.topbar { background: var(--header); color: var(--white); border-bottom: 1px solid var(--header-line); }
.topbar-inner { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.branding, .topbar-end { display: flex; align-items: center; gap: 12px; }
.branding { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.mark { display: flex; align-items: end; justify-content: center; gap: 3px; width: 32px; height: 32px; padding-bottom: 8px; border-radius: 9px; background: var(--accent); }
.mark i { width: 3px; background: var(--header); border-radius: 2px; height: 7px; }
.mark i:nth-child(2) { height: 12px; }.mark i:nth-child(3) { height: 16px; }
.topbar-end { gap: 22px; font-size: 12px; }
.provider { color: #d1d1d1; }
.source { border: 1px solid #686868; border-radius: 999px; padding: 5px 10px; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.source::before { content: ""; display: block; width: 6px; height: 6px; border-radius: 100%; background: #bdbdbd; }
.source[data-mode="demo"]::before { background: var(--accent); }
.source[data-mode="live"]::before { background: #91e1b5; }
.source[data-mode="error"]::before { background: #ec9b85; }
main.shell { padding-top: 38px; padding-bottom: 45px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 25px; }
h1 { font-size: clamp(32px, 4vw, 51px); letter-spacing: -.055em; line-height: 1.06; font-weight: 700; }
.heading p { color: var(--muted); font-size: 15px; margin-top: 10px; }
.active-period { display: grid; gap: 3px; border-left: 2px solid var(--accent); padding: 1px 0 1px 14px; min-width: 175px; }
.active-period span { font-size: 10px; font-weight: 750; color: var(--accent-ink); letter-spacing: .105em; }
.active-period strong { font-size: 15px; }
.active-period small { color: var(--muted); font-size: 11px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 3px #29292908; min-width: 0; }
.filters { padding: 18px 21px; }
.scope { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 16px; }
.filters label, legend { color: var(--muted); font-size: 12px; font-weight: 700; }
.scope label, .dates label { display: grid; gap: 6px; min-width: 0; }
select, .dates input { background-color: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; height: 40px; padding: 0 10px; font-size: 13px; font-weight: 600; min-width: 0; }
select { width: 100%; }
.period-filters { display: flex; align-items: end; gap: 15px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--subtle); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
.segmented { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--subtle); border: 1px solid var(--line); border-radius: 8px; min-height: 40px; align-items: center; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; left: 50%; top: 50%; opacity: 0; margin: 0; }
.segmented span { display: block; padding: 7px 12px; border-radius: 5px; white-space: nowrap; }
.segmented input:checked + span { color: var(--accent-ink); background: var(--soft); box-shadow: 0 1px 3px #2929291a; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent-ink); }
.dates { display: flex; gap: 8px; min-width: 0; }
.primary { margin-left: auto; display: flex; justify-content: space-between; align-items: center; gap: 13px; min-height: 40px; color: var(--header); background: var(--accent); border: 1px solid var(--accent-ink); border-radius: 8px; padding: 7px 13px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.primary:hover:enabled { background: var(--accent-hover); }
.primary span { font-size: 16px; }
.notice { padding: 14px 17px; margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--subtle); font-size: 14px; }
.notice.error { border-color: #eed0c7; color: #812d1d; background: #fff2ef; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin: 19px 0; }
.metric { display: grid; gap: 8px; padding: 15px 17px; }
.metric-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.metric-icon { display: grid; place-items: center; width: 24px; height: 24px; background: var(--soft); color: var(--accent-ink); border-radius: 6px; font-size: 15px; }
.metric strong { font-size: clamp(21px, 2.3vw, 33px); font-weight: 700; line-height: 1; letter-spacing: -.048em; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); font-size: 11px; }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.trend, .breakdown { padding: 19px 19px 15px; }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
h2 { font-size: 20px; letter-spacing: -.035em; line-height: 1.13; overflow-wrap: anywhere; }
.card-head p { color: var(--muted); font-size: 12px; margin-top: 5px; }
.compact-select { flex-shrink: 0; }
.compact-select select, .secondary { height: 31px; background: var(--subtle); font-size: 11px; border: 1px solid var(--line); border-radius: 7px; padding: 0 7px; color: var(--ink); font-weight: 700; }
.plot { position: relative; min-width: 0; height: 252px; margin-top: 15px; }
canvas { display: block; width: 100%; height: 100%; border-radius: 8px; }
.tooltip { position: absolute; pointer-events: none; z-index: 1; min-width: 107px; border-radius: 8px; background: var(--header); color: var(--white); padding: 8px 10px; font-size: 11px; line-height: 1.6; white-space: pre-line; box-shadow: 0 3px 12px #29292925; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); background: var(--field); border: 1px dashed var(--line); border-radius: 8px; font-size: 13px; padding: 16px; }
.chart-footer { display: flex; align-items: start; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 0 10px; color: var(--muted); font-size: 11px; }
#legend { display: flex; gap: 14px; flex-wrap: wrap; }
.key { display: inline-flex; align-items: center; gap: 5px; }
.key::before { content: ""; width: 14px; height: 3px; background: var(--key-color, var(--accent-ink)); border-radius: 8px; }
.chart-applications { background: var(--field); border: 1px solid var(--line); border-radius: 8px; margin: 0 0 10px; padding: 10px; }
.chart-applications h3 { font-size: 13px; margin: 0; }
.chart-applications-period { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 4px; }
.chart-applications-scroll { max-height: 220px; overflow: auto; margin-top: 4px; }
.chart-applications-scroll .applications-table { margin-top: 0; }
.chart-applications-scroll th, .chart-applications-scroll td { padding-block: 6px; }
.chart-applications-scroll thead th { position: sticky; top: 0; background: var(--field); }
.measure-details { border-top: 1px solid var(--subtle); font-size: 11px; color: var(--muted); padding-top: 9px; }
.measure-details p { line-height: 1.6; margin-top: 6px; }
.protocols { margin: 11px 0 0; padding: 0; list-style: none; max-height: 392px; overflow-y: auto; }
.protocols li + li { border-top: 1px solid var(--subtle); }
.protocol-button { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; width: 100%; border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 12px; padding: 9px 4px; }
.protocol-button:hover { background: var(--subtle); }
.protocol-button[aria-pressed="true"] { background: var(--soft); }
.protocol-button:focus-visible { outline-offset: -2px; }
.protocol-label { display: flex; align-items: center; gap: 7px; min-width: 0; overflow-wrap: anywhere; }
.dot { display: block; flex: 0 0 7px; height: 7px; border-radius: 50%; background: var(--protocol-color); }
.protocol-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.bar { display: block; grid-column: 1; align-self: center; height: 5px; background: var(--line); border-radius: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 8px; background: var(--protocol-color); }
.share { font-size: 10px; text-align: right; color: var(--muted); }
.protocol-peak { grid-column: 1 / -1; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.protocol-notice { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.applications { margin-top: 16px; padding: 19px; }
.applications-table { width: 100%; margin-top: 13px; border-collapse: collapse; font-size: 13px; }
.applications-table th, .applications-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.applications-table th { text-align: left; }
.applications-table tbody th { overflow-wrap: anywhere; }
.applications-table thead th { color: var(--muted); font-size: 11px; }
.applications-table thead th:not(:first-child), .applications-table td { text-align: right; }
.applications-table td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.applications-table tbody tr:last-child > * { border-bottom: 0; }
.application-protocols { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 940px) {
  .shell { width: min(100% - 42px, 1344px); }
  .analysis-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .shell { width: calc(100% - 26px); }
  main.shell { padding-top: 25px; }
  .provider { display: none; }
  .heading { display: grid; gap: 12px; }
  .heading p { font-size: 13px; }
  .active-period { min-width: 0; }
  .filters { padding: 14px; }
  .scope { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .scope label:last-child { grid-column: 1 / -1; }
  .period-filters { flex-wrap: wrap; gap: 10px; }
  .primary { width: 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric { padding: 11px 10px; }
  .trend, .breakdown, .applications { padding: 14px 12px; }
  .applications-table th, .applications-table td { padding-inline: 4px; }
  .applications-table td { white-space: normal; overflow-wrap: anywhere; }
  .plot { height: 220px; }
}

.top-action {
  padding: 6px 9px;
  border: 1px solid #797979;
  border-radius: 7px;
  color: var(--white);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}
.top-action:hover { background: var(--header-line); }
.top-action:focus-visible { outline-color: var(--accent); }
.auth-card { width: min(100%, 440px); margin: clamp(28px, 8vh, 95px) auto; padding: clamp(20px, 5vw, 33px); }
.auth-card h1 { font-size: clamp(28px, 5vw, 38px); }
.auth-card > p:not(.notice), .invitation-result p { color: var(--muted); font-size: 13px; line-height: 1.5; }
#auth-description { margin-top: 9px; }
.auth-card form { display: grid; gap: 15px; margin-top: 20px; }
.auth-card label, .invite-form label, .invitation-result label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.auth-card input, .invite-form input, .invitation-result input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-size: 14px;
}
.auth-card .primary { margin-left: 0; justify-content: center; }
.auth-card.setup-card { width: min(100%, 620px); margin-top: clamp(10px, 4vh, 48px); }
.setup-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setup-fields legend { font-size: 13px; color: var(--ink); margin-bottom: 10px; }
.setup-fields + .setup-fields { border-top: 1px solid var(--line); padding-top: 5px; }
.setup-fields label:first-of-type, .setup-hint { grid-column: 1 / -1; }
.setup-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
#back-to-login { margin-top: 14px; }
.accounts-dialog {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100dvh - 40px);
  padding: clamp(15px, 4vw, 25px);
  color: var(--ink);
}
.accounts-dialog::backdrop { background: #29292994; }
.invite-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-top: 20px; }
.invitation-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 11px;
  margin-top: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.invitation-result button { height: 40px; }
.invitation-result p { grid-column: 1 / -1; font-size: 12px; }
.accounts-list { list-style: none; padding: 0; margin: 16px 0 0; }
.accounts-list li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.accounts-list li div:first-child { min-width: 0; overflow-wrap: anywhere; }
.accounts-list small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.revoke-access { color: #812d1d; }
.no-accounts { color: var(--muted); }
@media (max-width: 650px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding-block: 10px; }
  .topbar-end { flex-wrap: wrap; gap: 6px; }
  .invite-form { grid-template-columns: 1fr; }
  .invitation-result { grid-template-columns: 1fr; }
  .setup-fields { grid-template-columns: 1fr; }
}
