/* Amytics layout and interaction primitives.
 * Hallmark · genre: modern-minimal · macrostructure: Workbench
 * design-system: design.md · designed-as-app
 * Current visual system is implemented in amytics.css and tokens.css.
 */
@import url("/tokens.css");
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  overflow-x: clip;
}
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font: 400 var(--text-body)/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
  font-weight: 550;
  white-space: nowrap;
}
button:hover {
  background: var(--color-sidebar);
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
button[aria-busy="true"] {
  cursor: progress;
}
button.primary {
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-color: var(--color-accent);
}
button.primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-accent-ink);
}
button.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--color-accent);
}
button.danger {
  color: var(--color-error);
}
a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.035em;
  font-style: normal;
  overflow-wrap: anywhere;
  min-width: 0;
}
h1 {
  font-size: var(--text-title);
  font-weight: 680;
  margin: 0 0 var(--space-sm);
}
h2 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 0;
}
h3 {
  font-size: var(--text-body);
  margin: 0;
}
p {
  margin: var(--space-sm) 0 var(--space-lg);
}
small,
.muted {
  color: var(--color-muted);
}
small {
  font-size: var(--text-xs);
}
code,
pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--color-sidebar);
  color: var(--color-ink);
  padding: var(--space-lg);
  border-radius: var(--radius-sm);
}
.skip {
  position: absolute;
  top: -100px;
  left: var(--space-xl);
  z-index: 1000;
  background: var(--color-surface);
  padding: var(--space-lg);
}
.skip:focus {
  top: var(--space-lg);
}
.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--color-sidebar);
  color: var(--color-ink);
  border-right: 1px solid var(--color-rule);
  padding: var(--space-2xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 var(--space-sm) var(--space-2xl);
  font-weight: 650;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}
.brand img {
  width: 32px;
  height: 32px;
}
.sidebar nav {
  display: grid;
  gap: var(--space-xs);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 46px;
  padding: var(--space-md);
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: 550;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.nav-item:hover {
  text-decoration: none;
  background: var(--color-surface);
  color: var(--color-ink);
}
.nav-item.active {
  background: var(--color-tint);
  color: var(--color-accent);
}
.icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-bottom {
  margin-top: auto;
  padding: var(--space-xl) var(--space-sm) 0;
}
.allowance {
  border-top: 1px solid var(--color-rule);
  padding: var(--space-xl) 0;
}
.allowance progress {
  margin: var(--space-md) 0;
  width: 100%;
  height: 5px;
  accent-color: var(--color-accent);
}
.account {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-sm);
}
.avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  background: var(--color-surface);
  color: var(--color-ink);
  font-weight: 600;
}
.account span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace {
  min-width: 0;
}
.topbar {
  height: 76px;
  padding: 0 var(--space-3xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.topbar .right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}
.mobile-menu {
  display: none;
}
main.content {
  max-width: 1416px;
  margin: auto;
  padding: var(--space-3xl);
}
.pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}
.pagehead p {
  margin: 0;
  color: var(--color-muted);
}
.actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.eyebrow {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-sm);
}
.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}
.metric {
  padding: var(--space-sm) var(--space-xl);
  border-right: 1px solid var(--color-rule);
}
.metric:first-child {
  padding-left: var(--space-sm);
}
.metric:last-child {
  border: 0;
}
.metric dt {
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.metric dd {
  margin: var(--space-sm) 0 0;
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.metric small {
  display: block;
  margin-top: var(--space-sm);
}
.panel {
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
  overflow: hidden;
}
.panel-head {
  padding: var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}
.panel-body {
  padding: var(--space-xl);
}
.panel-head + .panel-body {
  padding-top: 0;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-xl);
}
.chart {
  width: 100%;
  height: 190px;
  display: block;
}
.chart text {
  font-size: 11px;
  fill: var(--color-muted);
  font-family: var(--font-body);
}
.chart .axis {
  stroke: var(--color-rule);
  stroke-dasharray: 3 5;
}
.chart .line {
  stroke: var(--color-accent);
  stroke-width: 2.5;
  fill: none;
}
.chart .area {
  fill: var(--color-tint);
}
.chart-empty {
  min-height: 190px;
  display: grid;
  place-content: center;
  text-align: center;
  padding: var(--space-xl);
}
.chart-empty p {
  margin: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.legend {
  font-size: var(--text-xs);
  color: var(--color-muted);
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--color-accent);
  border-radius: 50%;
}
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-xl);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--color-rule);
}
.list-row a.title {
  font-weight: 600;
  color: var(--color-ink);
}
.list-row small {
  display: block;
  margin-top: var(--space-xs);
  overflow-wrap: anywhere;
}
.list-row .num {
  font-variant-numeric: tabular-nums;
}
.list-label {
  font-size: var(--text-xs);
  color: var(--color-muted);
  padding-block: var(--space-md);
  background: var(--color-paper);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 550;
  white-space: nowrap;
  background: var(--color-sidebar);
  color: var(--color-muted);
}
.badge.active,
.badge.FINISHED,
.badge.verified {
  color: var(--color-success);
  background: var(--color-success-bg);
}
.badge.ERROR,
.badge.EXCEPTION {
  color: var(--color-error);
  background: var(--color-error-bg);
}
.badge.RUNNING,
.badge.IN_QUEUE,
.badge.WAITING {
  color: var(--color-accent);
  background: var(--color-tint);
}
.status-block {
  border-radius: var(--radius-md);
  background: var(--color-paper);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.status-block strong {
  color: var(--color-ink);
}
.empty {
  padding: var(--space-4xl) var(--space-xl);
  text-align: center;
  max-width: 540px;
  margin: auto;
}
.empty .symbol {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  margin: 0 auto var(--space-xl);
  background: var(--color-tint);
  color: var(--color-accent);
}
.empty .symbol .icon {
  height: 28px;
  width: 28px;
}
.empty h2 {
  font-size: 1.4rem;
}
.empty p {
  color: var(--color-muted);
}
.empty .actions {
  justify-content: center;
}
.mini-list {
  padding: 0 var(--space-xl) var(--space-xl);
}
.mini-row {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--color-rule);
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  align-items: center;
}
.mini-row:last-child {
  border: 0;
}
.mini-row small {
  display: block;
  margin-top: var(--space-xs);
}
.journey {
  padding: var(--space-sm) var(--space-xl) var(--space-xl);
}
.step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  position: relative;
  padding: var(--space-lg) 0;
}
.step + .step {
  border-top: 1px solid var(--color-rule);
}
.step-number {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--color-paper);
  font-size: var(--text-sm);
  font-weight: 600;
}
.step-content {
  flex: 1;
  min-width: 0;
}
.step-content p {
  margin: var(--space-xs) 0 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.step .actions {
  flex-shrink: 0;
}
.step .actions button {
  padding: var(--space-sm);
  min-width: 44px;
}
.details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-xl);
  margin: 0;
}
.details dt {
  color: var(--color-muted);
  font-size: var(--text-xs);
  margin-bottom: var(--space-xs);
}
.details dd {
  margin: 0;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.filterbar {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}
.filterbar input {
  max-width: 300px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xl);
}
.cards .panel {
  margin: 0;
}
.footer {
  padding: var(--space-xl) 0;
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-muted);
  gap: var(--space-lg);
}
label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 550;
  margin-bottom: var(--space-lg);
}
input,
select,
textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--space-md);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  min-width: 0;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
input[type="checkbox"] {
  display: inline-block;
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--color-accent);
}
input[type="range"] {
  padding: 0;
  accent-color: var(--color-accent);
}
.check {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  font-weight: 400;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--space-lg);
}
.form-grid .wide {
  grid-column: 1/-1;
}
.hint {
  font-size: var(--text-xs);
  color: var(--color-muted);
  font-weight: 400;
  display: block;
  margin-top: var(--space-sm);
}
.form-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
  white-space: pre-line;
}
.form-error:empty {
  display: none;
}
.form-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
}
details {
  border-top: 1px solid var(--color-rule);
  margin: var(--space-lg) 0;
  padding-top: var(--space-lg);
}
summary {
  cursor: pointer;
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 550;
  padding: var(--space-sm) 0;
}
details > div {
  margin-top: var(--space-lg);
}
.day-grid {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.day-grid label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin: var(--space-sm) 0 var(--space-lg);
}
dialog {
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(640px, calc(100% - 32px));
  max-height: 90vh;
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 20px 80px var(--color-shadow);
}
dialog::backdrop {
  background: var(--color-scrim);
}
.modal-head {
  padding: var(--space-xl) var(--space-2xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-rule);
}
.modal-head h2 {
  font-size: 1.25rem;
}
.modal-body {
  padding: var(--space-2xl);
}
.modal-foot {
  border-top: 1px solid var(--color-rule);
  padding: var(--space-lg) var(--space-2xl);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  background: var(--color-paper);
  color: var(--color-ink);
}
.modal-foot button {
  min-width: 100px;
}
dialog .preview {
  display: block;
  width: 100%;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
}
.auth-card {
  max-width: 460px;
  margin: 12vh auto;
  padding: var(--space-2xl);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-lg);
}
.auth-card .brand {
  justify-content: center;
  padding-bottom: var(--space-xl);
}
.auth-card > h1,
.auth-card > p {
  text-align: center;
}
.auth-card > p {
  color: var(--color-muted);
}
.auth-card form {
  margin-top: var(--space-2xl);
}
.auth-card form > button {
  width: 100%;
  margin-top: var(--space-sm);
}
#notice {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-md);
  background: var(--color-ink);
  color: var(--color-paper);
  max-width: calc(100% - 32px);
  box-shadow: 0 6px 24px var(--color-shadow);
  font-size: var(--text-sm);
}
#notice:empty {
  display: none;
}
.loading {
  padding: var(--space-4xl);
  text-align: center;
  color: var(--color-muted);
}
@media (max-width: 1100px) {
  main.content {
    padding: var(--space-2xl);
  }
  .topbar {
    padding-inline: var(--space-2xl);
  }
  .shell {
    grid-template-columns: 204px minmax(0, 1fr);
  }
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .metric {
    padding-inline: var(--space-lg);
  }
  .metric dd {
    font-size: 1.65rem;
  }
  .list-row {
    gap: var(--space-lg);
  }
}
@media (max-width: 768px) {
  .shell {
    display: block;
  }
  .sidebar {
    display: none;
    position: fixed;
    z-index: 20;
    width: 250px;
    box-shadow: 20px 0 70px var(--color-shadow);
  }
  .sidebar.open {
    display: flex;
  }
  .mobile-menu {
    display: block;
  }
  .topbar {
    height: 68px;
    padding-inline: var(--space-lg);
  }
  .topbar .right > span {
    display: none;
  }
  main.content {
    padding: var(--space-xl);
  }
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xl);
  }
  .metric:nth-child(2) {
    border: 0;
  }
  .metric:nth-child(3) {
    padding-left: var(--space-sm);
  }
  .cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .pagehead {
    align-items: flex-start;
  }
  .list-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-lg);
  }
  .list-row .secondary {
    display: none;
  }
  .pagehead .actions {
    justify-content: flex-end;
  }
  .filterbar {
    align-items: flex-end;
  }
  .footer {
    flex-wrap: wrap;
  }
}
@media (max-width: 480px) {
  main.content {
    padding: var(--space-xl) var(--space-lg);
  }
  .pagehead {
    display: block;
  }
  .pagehead .actions {
    margin-top: var(--space-lg);
    justify-content: flex-start;
  }
  .pagehead h1 {
    font-size: 1.8rem;
  }
  .panel-head,
  .panel-body {
    padding: var(--space-lg);
  }
  .metric-strip {
    padding: var(--space-lg);
    gap: var(--space-lg);
  }
  .metric {
    padding-inline: var(--space-sm);
  }
  .metric dt {
    font-size: var(--text-xs);
  }
  .metric dd {
    font-size: 1.5rem;
  }
  .list-row {
    padding: var(--space-lg);
  }
  .modal-body,
  .modal-head {
    padding: var(--space-xl);
  }
  .modal-foot {
    padding: var(--space-lg);
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid .wide {
    grid-column: auto;
  }
  .auth-card {
    margin: var(--space-2xl) var(--space-lg);
    padding: var(--space-xl);
  }
  .journey {
    padding-inline: var(--space-lg);
  }
  .step {
    gap: var(--space-md);
    flex-wrap: wrap;
  }
  .step .actions {
    margin-left: 42px;
  }
  .details {
    gap: var(--space-lg);
  }
  .topbar .right {
    gap: var(--space-xs);
  }
  .topbar .breadcrumb {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .empty {
    padding: var(--space-2xl) var(--space-lg);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--color-muted);
}
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--color-sidebar);
}
input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--color-error);
}
.hint {
  min-height: 1lh;
}
.status-block button {
  display: block;
  margin-top: var(--space-md);
}

/* Amytics appearance and accessibility refinement.
 * Hallmark · pre-emit critique: P4 H4 E4 S4 R5 V4
 * Motion: page reveal, dialog/drawer reveal, press feedback; reduced motion disables all three.
 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
button {
  min-width: 44px;
  transition: transform var(--dur-fast) var(--ease-out);
}
button:disabled:active {
  transform: none;
}
button:not(.primary):not(.quiet),
input,
select,
textarea {
  border-color: var(--color-control);
}
button.quiet:hover {
  background: var(--color-tint);
}
input::placeholder,
textarea::placeholder {
  color: var(--color-muted);
  opacity: 1;
}
input,
select {
  min-height: 44px;
  padding-block: var(--space-sm);
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--color-accent);
}
select option {
  background: var(--color-surface);
  color: var(--color-ink);
}
:focus-visible {
  outline-offset: 4px;
}
#main:focus,
h1[tabindex="-1"]:focus {
  outline: none;
}
.metric dd {
  font-size: 2rem;
}
.metric small {
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.5;
}
.metric dt {
  line-height: 1.5;
}
.metric-strip {
  margin-top: 0;
}
.sidebar {
  height: 100dvh;
  overflow-y: auto;
}
.sidebar .brand {
  flex-shrink: 0;
}
.sidebar-bottom {
  flex-shrink: 0;
}
.account .avatar {
  flex-shrink: 0;
}
.account button {
  margin-left: auto;
  flex-shrink: 0;
}
.topbar {
  gap: var(--space-lg);
}
.topbar > .actions {
  min-width: 0;
  flex-wrap: nowrap;
}
.breadcrumb {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .right {
  flex-shrink: 0;
  gap: var(--space-sm);
}
.topbar .right > span {
  display: none;
}
.pagehead > div:first-child {
  min-width: 0;
}
.pagehead .actions {
  flex-shrink: 0;
}
.pagehead p {
  max-width: 60ch;
}
.panel {
  overflow: clip;
}
.split {
  margin-bottom: var(--space-xl);
}
.split > .panel,
.split > div > .panel:last-child {
  margin-bottom: 0;
}
.panel-head > div {
  min-width: 0;
}
.panel-head small {
  display: block;
  margin-top: var(--space-xs);
}
.panel-head > a,
.eyebrow a,
.empty a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.list-row a.title {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.list-row small {
  margin-top: 0;
}
.list-row > div,
.mini-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.mini-row {
  flex-wrap: wrap;
}
.mini-row button {
  flex-shrink: 0;
}
.filterbar label {
  margin: 0;
}
.filterbar input,
.filterbar select {
  max-width: none;
}
.campaign-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
}
.date-filters {
  align-items: flex-end;
}
.date-filters label {
  flex: 0 1 200px;
  min-width: 0;
}
.filter-feedback {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin: var(--space-md) 0;
}
.chart text {
  font-size: 12px;
}
.chart-data {
  margin-bottom: 0;
  padding-top: var(--space-sm);
}
.chart-data summary {
  font-weight: 400;
}
.chart-table-wrap {
  max-height: 240px;
  overflow-y: auto;
}
.chart-data table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.chart-data caption {
  text-align: left;
  color: var(--color-muted);
  padding-bottom: var(--space-md);
}
.chart-data th,
.chart-data td {
  text-align: left;
  padding: var(--space-sm);
  border-bottom: 1px solid var(--color-rule);
}
.chart-data th:last-child,
.chart-data td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.chart-data th {
  font-weight: 600;
}
.check,
.day-grid label {
  min-height: 44px;
  cursor: pointer;
}
summary {
  min-height: 44px;
}
.form-error:focus {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
.form-error {
  scroll-margin: var(--space-xl);
}
.field-label {
  display: block;
}
.appearance-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
}
.appearance-control select {
  margin: 0;
  width: 112px;
  cursor: pointer;
}
.appearance-control .icon {
  color: var(--color-muted);
}
.auth-appearance {
  display: flex;
  justify-content: center;
  margin: var(--space-xl) 0 0;
}
.appearance-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md);
  border: 0;
  padding: 0;
  margin: var(--space-lg) 0 0;
}
.appearance-option {
  position: relative;
  margin: 0;
  cursor: pointer;
}
.appearance-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
}
.appearance-option .choice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 64px;
  padding: var(--space-md);
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-control);
  border-radius: var(--radius-md);
}
.appearance-option input:checked + .choice {
  background: var(--color-tint);
  color: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 1px var(--color-accent);
}
.appearance-option input:focus-visible + .choice {
  outline: 3px solid var(--color-focus);
  outline-offset: 4px;
}
.appearance-option input:active + .choice {
  transform: translateY(1px);
}
.auth-card {
  margin-block: clamp(32px, 9vh, 96px);
}
.auth-card > p:last-of-type {
  margin-bottom: 0;
}
dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  max-height: min(90dvh, 900px);
  scrollbar-gutter: stable;
}
.modal-head {
  gap: var(--space-lg);
}
.modal-head h2 {
  line-height: 1.35;
}
.modal-head button {
  flex-shrink: 0;
  padding: var(--space-sm);
}
.modal-foot {
  flex-wrap: wrap;
}
.modal-foot button {
  min-width: 0;
}
.modal-body > :last-child {
  margin-bottom: 0;
}
.modal-body .actions {
  margin-top: var(--space-lg);
}
.drawer-close {
  display: none;
}
.navigation-drawer {
  inset: 0 auto 0 0;
  margin: 0;
  width: min(304px, calc(100% - 48px));
  height: 100dvh;
  max-height: 100dvh;
  border: 0;
  border-right: 1px solid var(--color-rule);
  border-radius: 0;
  background: var(--color-sidebar);
  padding: 0;
}
.navigation-drawer .sidebar {
  display: flex;
  width: 100%;
  height: 100%;
  position: static;
  box-shadow: none;
  border: 0;
}
.navigation-drawer .brand {
  justify-content: space-between;
}
.navigation-drawer .brand span {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.navigation-drawer .drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}
@keyframes content-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes drawer-enter {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes backdrop-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.content-enter {
  animation: content-enter var(--dur-medium) var(--ease-out);
}
#modal[open] {
  animation: dialog-enter var(--dur-enter) var(--ease-out);
}
.navigation-drawer[open] {
  animation: drawer-enter var(--dur-enter) var(--ease-out);
}
dialog[open]::backdrop {
  animation: backdrop-enter var(--dur-medium) var(--ease-out);
}
@media (hover: hover) {
  .appearance-option:hover .choice {
    background: var(--color-paper);
  }
  .appearance-option:has(input:checked):hover .choice {
    background: var(--color-tint);
  }
  .list-row:not(.list-label):hover {
    background: var(--color-paper);
  }
}
@media (max-width: 1100px) {
  .pagehead {
    flex-wrap: wrap;
  }
}
@media (max-width: 768px) {
  .appearance-control > .icon {
    display: none;
  }
  .topbar {
    gap: var(--space-sm);
  }
  .topbar > .actions {
    gap: var(--space-xs);
    flex: 1;
  }
  .topbar .right {
    gap: var(--space-xs);
  }
  .topbar .right > [data-action="refresh"] {
    padding-inline: var(--space-sm);
  }
  .appearance-control select {
    width: 96px;
    padding-inline: var(--space-sm);
  }
  .date-filters label {
    flex: 1 1 120px;
  }
}
@media (max-width: 480px) {
  .topbar {
    padding-inline: var(--space-sm);
  }
  .topbar .breadcrumb {
    max-width: none;
    font-size: var(--text-xs);
  }
  .topbar .breadcrumb .workspace-label {
    display: none;
  }
  .metric dd {
    font-size: 1.75rem;
  }
  .metric dt {
    font-size: var(--text-sm);
  }
  .metric small {
    font-size: var(--text-xs);
  }
  .metric-strip {
    gap: var(--space-xl) var(--space-md);
  }
  .campaign-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .pagehead .actions {
    flex-wrap: wrap;
  }
  .appearance-options {
    gap: var(--space-sm);
  }
  .appearance-option .choice {
    flex-direction: column;
    min-height: 84px;
    padding: var(--space-sm);
  }
  .modal-body,
  .modal-head {
    padding: var(--space-lg);
  }
  .modal-head h2 {
    font-size: 1.125rem;
  }
  .panel-head {
    align-items: flex-start;
  }
  .panel-head > div:first-child {
    flex: 1 1 100%;
  }
  .step .actions {
    margin-left: 44px;
  }
  .date-filters > button {
    width: 100%;
  }
  .footer {
    line-height: 1.6;
  }
}
@media (prefers-reduced-motion: reduce) {
  dialog::backdrop {
    animation: none !important;
    transition: none !important;
  }
  button:active,
  .appearance-option input:active + .choice {
    transform: none;
  }
}
@media (forced-colors: active) {
  .appearance-option input:checked + .choice {
    outline: 2px solid Highlight;
  }
  .nav-item.active {
    outline: 1px solid Highlight;
  }
}

.brand > span {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.appearance-control .field-label {
  display: contents;
}

.auth-card form > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: var(--space-sm);
}
.appearance-control select {
  width: auto;
  min-width: 7em;
}
@media (max-width: 768px) {
  .topbar {
    height: auto;
    min-height: 68px;
    padding-block: var(--space-sm);
    flex-wrap: wrap;
  }
  .topbar > .actions {
    flex: 1 1 80px;
  }
  .topbar .right {
    margin-left: auto;
  }
  .appearance-control select {
    width: auto;
    min-width: 6.5em;
  }
}

/* Keep long dialogs readable while their form content scrolls. */
#modal {
  overflow: clip;
  scrollbar-gutter: auto;
}
#modal-form {
  display: flex;
  flex-direction: column;
  max-height: min(90dvh, 900px);
}
.modal-head,
.modal-foot {
  flex-shrink: 0;
}
.modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
@media (max-width: 768px) {
  .topbar .appearance-control .icon {
    display: none;
  }
}
@media (max-width: 360px) {
  .metric dt {
    min-height: 3em;
  }
}

/* Hallmark · component: workspace header · genre: modern-minimal
 * theme: existing Amytics tokens · pre-emit critique: P4 H5 E4 S4 R5 V4
 * States: default, hover, focus, active, disabled, loading;
 * success and errors use the existing live status region.
 */
.pagehead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "title actions utilities";
  align-items: center;
  gap: var(--space-xl);
  padding-block: var(--space-sm) var(--space-xl);
  margin-bottom: var(--space-xl);
}
.page-title {
  grid-area: title;
  min-width: 0;
}
.pagehead .page-actions {
  grid-area: actions;
  margin: 0;
}
.page-actions:empty {
  display: none;
}
.toolbar-utilities {
  grid-area: utilities;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.page-actions:not(:empty) + .toolbar-utilities {
  border-left: 1px solid var(--color-rule);
  padding-left: var(--space-lg);
}
button.toolbar-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  color: var(--color-muted);
  align-items: center;
  justify-content: center;
}
.toolbar-utilities .toolbar-button {
  display: inline-flex;
}
.pagehead .mobile-menu {
  grid-area: navigation;
}
.toolbar-button .icon {
  width: 21px;
  height: 21px;
}
button.toolbar-button[aria-expanded="true"] {
  color: var(--color-accent);
  background: var(--color-tint);
}
@media (hover: hover) {
  button.toolbar-button:hover {
    color: var(--color-ink);
    background: var(--color-sidebar);
  }
}
.toolbar-button[aria-busy="true"] .icon {
  animation: toolbar-refresh 900ms linear infinite;
}
@keyframes toolbar-refresh {
  to {
    transform: rotate(360deg);
  }
}
.appearance-popover {
  position: fixed;
  inset: auto;
  margin: 0;
  width: 272px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  padding: var(--space-md);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 12px 36px var(--color-shadow);
}
.appearance-popover:popover-open {
  animation: content-enter var(--dur-medium) var(--ease-out);
}
.appearance-popover fieldset {
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}
.appearance-popover legend {
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 650;
}
.theme-row {
  display: block;
  position: relative;
  margin: 0;
}
.theme-row input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  opacity: 0;
}
.theme-label {
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 450;
  cursor: pointer;
}
.theme-check {
  display: flex;
  margin-left: auto;
  visibility: hidden;
}
.theme-row input:checked + .theme-label {
  background: var(--color-tint);
  color: var(--color-accent);
}
.theme-row input:checked + .theme-label .theme-check {
  visibility: visible;
}
.theme-row input:focus-visible + .theme-label {
  outline: 3px solid var(--color-focus);
  outline-offset: -3px;
}
@media (hover: hover) {
  .theme-row:hover .theme-label {
    background: var(--color-sidebar);
    color: var(--color-ink);
  }
}
.theme-row:active .theme-label {
  transform: translateY(1px);
}
.appearance-popover p {
  margin: var(--space-md) var(--space-md) var(--space-xs);
  font-size: var(--text-xs);
  color: var(--color-muted);
}
@media (min-width: 769px) and (max-width: 1100px) {
  .pagehead {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title utilities" "actions actions";
    align-items: start;
  }
  .page-actions:not(:empty) + .toolbar-utilities {
    border: 0;
    padding: 0;
  }
}
@media (max-width: 768px) {
  main.content {
    padding-top: var(--space-md);
  }
  .pagehead {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "navigation utilities" "title title" "actions actions";
    gap: var(--space-lg);
    padding-top: 0;
    padding-bottom: var(--space-sm);
  }
  .pagehead .mobile-menu {
    display: inline-flex;
    margin-left: -8px;
  }
  .pagehead .page-actions {
    justify-content: flex-start;
  }
  .page-actions:not(:empty) + .toolbar-utilities {
    border: 0;
    padding: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .appearance-popover:popover-open,
  .toolbar-button[aria-busy="true"] .icon {
    animation: none;
  }
  .theme-row:active .theme-label {
    transform: none;
  }
}
