:root {
  --panel: #fff;
  --surface: #f5fafc;
  --subtle: #e9f4f9;
  --text: #102a40;
  --muted: #334e68;
  --line: #d0e2ec;
  --primary: #235aa5;
  --primary-on: #fff;
  --selected: #fff;
}

:root[data-theme=dark] {
  color-scheme: dark;
  --panel: #102a40;
  --surface: #0b1d2e;
  --subtle: #16334d;
  --text: #e9f4f9;
  --muted: #b8d4e3;
  --line: #284b66;
  --primary: #7cc4fa;
  --primary-on: #002b4d;
  --selected: #1d3f5e;
}

[style*="--light-stroke:"] {
  --theme-stroke: var(--light-stroke);
}

[data-theme=dark] [style*="--light-stroke:"] {
  --theme-stroke: var(--dark-stroke);
}

[style*="--light-fill:"] {
  --theme-fill: var(--light-fill);
}

[data-theme=dark] [style*="--light-fill:"] {
  --theme-fill: var(--dark-fill);
}

[style*="--light-stop-color:"] {
  --theme-stop-color: var(--light-stop-color);
}

[data-theme=dark] [style*="--light-stop-color:"] {
  --theme-stop-color: var(--dark-stop-color);
}

[style*="--light-stop-opacity:"] {
  --theme-stop-opacity: var(--light-stop-opacity);
}

[data-theme=dark] [style*="--light-stop-opacity:"] {
  --theme-stop-opacity: var(--dark-stop-opacity);
}

body.dashboard-boot>div:first-child {
  visibility: hidden;
}

body {
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

a,
button,
input {
  scroll-margin-top: 80px;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

button:disabled {
  opacity: .55;
  cursor: default;
}

main article,
[role=tablist] {
  min-width: 0;
}

.period-tab[aria-selected=true] {
  color: var(--primary);
  background: var(--selected);
  box-shadow: 0 1px 2px rgb(0 0 0 / .05);
}

.period-tab[aria-selected=false] {
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.linked-card {
  position: relative;
}

.linked-card a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.linked-card:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.metric-link:hover,
a.data-link:hover,
button.data-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.data-link,
button.data-link {
  color: inherit;
  text-align: left;
}

#app-sidebar nav a {
  scroll-margin: 12px;
}

#dialog {
  width: min(450px, calc(100vw - 32px));
  max-height: min(82vh, 720px);
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 14px 44px #07152235;
  font-size: 15px;
  line-height: 1.45;
}

#dialog::backdrop {
  background: rgba(9, 29, 45, .48);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-head h2 {
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
}

.dialog-head button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--subtle);
}

#dialog-body {
  display: grid;
  gap: 12px;
}

#dialog-body p {
  color: var(--muted);
}

#dialog-body .dialog-actions {
  display: grid;
  gap: 6px;
}

#dialog-body .action,
#dialog-body select,
#dialog-body input {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
}

#dialog-body select {
  padding-right: 36px;
}

#dialog-body label {
  display: grid;
  gap: 4px;
  font-weight: 700;
}

#dialog-body .action:hover {
  background: var(--subtle);
}

#dialog-body .chosen,
#dialog-body .primary {
  background: var(--primary);
  color: var(--primary-on);
  font-weight: 700;
}

#dialog-body .primary:hover {
  background: var(--primary);
}

#dialog-body .dialog-group {
  font-weight: 700;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

#dialog-body .info {
  font-size: 13px;
}

#load-error {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  width: max-content;
  padding: 10px 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 18px #0002;
  z-index: 45;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

#load-error button {
  font-weight: bold;
  color: var(--primary);
  white-space: nowrap;
}

body:not(.reference) #purchases td {
  overflow-wrap: anywhere;
}

#purchases th {
  white-space: normal;
}

body:not(.reference) #purchases table {
  min-width: 470px;
}

.data-empty {
  padding: 20px 16px;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

.chart-bucket {
  cursor: pointer;
}

.chart-bucket:focus .point,
.chart-bucket:hover .point {
  stroke-width: 4;
}

#performance .live-chart {
  overflow: visible;
}

#performance .live-chart text {
  font-family: Arimo, sans-serif;
  font-size: 11px;
  fill: var(--muted);
}

#performance .chart-link {
  color: var(--primary);
}

#pagination .current-page {
  background: var(--primary);
  color: var(--primary-on);
}

@media(max-width:1023px) {
  #app-sidebar[data-open] {
    min-height: 0;
    height: 100dvh;
    overflow-y: auto;
  }

  #app-sidebar:not([data-open]) {
    visibility: hidden;
  }
}

@media(max-width:420px) {
  #performance>header {
    align-items: stretch;
  }

  body:not(.reference) .period-tab {
    padding-left: 5px;
    padding-right: 5px;
    flex: 1;
  }

  main .grid>div {
    min-width: 0;
  }
}

@media(prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}

.blocked-link {
  position: relative;
  z-index: 1;
}

:root {
  --po-line: #235aa5;
  --po-shadow: #102a40;
}

:root[data-theme=dark] {
  --po-line: #7cc4fa;
  --po-shadow: #235aa5;
}

.reference #pagination button:disabled {
  opacity: 1;
}

.dashboard-boot * {
  transition: none !important;
}

#search-matches {
  position: absolute;
  z-index: 25;
  inset: calc(100% + 6px) 0 auto;
  padding: 6px;
  display: grid;
  gap: 2px;
  max-height: 48vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px #07152222;
}

#search-matches .action,
#search-matches p {
  text-align: left;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
}

#search-matches .action:hover,
#search-matches .action:focus-visible {
  background: var(--subtle);
}
