:root {
  color-scheme: dark;
  --sidebar-width: 236px;
  --topbar-height: 68px;
  --page-gutter: clamp(16px, 1.35vw, 24px);
  --canvas: #0f1110;
  --sidebar: #121411;
  --stage: #151714;
  --surface: #1b1e1a;
  --surface-raised: #222520;
  --surface-soft: #292d27;
  --surface-inset: #111310;
  --surface-hover: #2c3029;
  --border: #353a32;
  --border-strong: #4b5246;
  --hairline: rgba(255, 255, 255, 0.075);
  --text: #f2f0e8;
  --text-soft: #c3c2b9;
  --muted: #999c91;
  --faint: #767a70;
  --accent: #1595f5;
  --accent-hover: #38a6ff;
  --accent-soft: #102d46;
  --accent-border: #21557b;
  --green: #55c48b;
  --green-soft: #102d20;
  --green-border: #1d5d3c;
  --amber: #eab862;
  --amber-soft: #3c321f;
  --amber-border: #6b572c;
  --orange: #e79552;
  --red: #ff7078;
  --red-soft: #3b1d20;
  --red-border: #702f35;
  --purple: #b579e1;
  --purple-soft: #321d3d;
  --purple-border: #62347a;
  --blue: #6caeff;
  --blue-soft: #1a2c42;
  --blue-border: #34577b;
  --chart-primary: #eab862;
  --chart-secondary: #7aa7dc;
  --chart-tertiary: #dca36f;
  --chart-quaternary: #b579e1;
  --chart-grid: #353a32;
  --focus: #8ac7ff;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius-xs: 4px;
  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --transition: 160ms cubic-bezier(0.2, 0.75, 0.25, 1);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --canvas: #e9e1c9;
  --sidebar: #e2d8b9;
  --stage: #f2ead0;
  --surface: #f7f0dc;
  --surface-raised: #fffaf0;
  --surface-soft: #e9dfc3;
  --surface-inset: #eee6cf;
  --surface-hover: #e4d9ba;
  --border: #c7bda0;
  --border-strong: #978c70;
  --hairline: rgba(55, 48, 38, 0.12);
  --text: #302e2a;
  --text-soft: #514d44;
  --muted: #6d685c;
  --faint: #817b6c;
  --accent: #006a9f;
  --accent-hover: #005783;
  --accent-soft: #d5e8ef;
  --accent-border: #8bb9ca;
  --green: #1f6841;
  --green-soft: #dce9d8;
  --green-border: #91b893;
  --amber: #7a4e08;
  --amber-soft: #eee1b9;
  --amber-border: #c6a958;
  --orange: #a94f19;
  --red: #a6353b;
  --red-soft: #f0d7cf;
  --red-border: #c98c82;
  --purple: #74469a;
  --purple-soft: #e9daf0;
  --purple-border: #b59ac6;
  --blue: #176b9f;
  --blue-soft: #d7e6ed;
  --blue-border: #8eb4c5;
  --chart-primary: #a86516;
  --chart-secondary: #3979a8;
  --chart-tertiary: #b35f2e;
  --chart-quaternary: #74469a;
  --chart-grid: #c7bda0;
  --focus: #006da8;
  --shadow-sm: 0 8px 22px rgba(62, 52, 34, 0.11);
  --shadow-lg: 0 24px 70px rgba(62, 52, 34, 0.22);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 78% -20%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 34rem),
    var(--canvas);
  color: var(--text);
}

button,
input,
select,
textarea {
  margin: 0;
  color: inherit;
  font: inherit;
}

button,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
select:not(:disabled),
summary {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

a {
  color: var(--accent-hover);
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: currentColor;
}

img,
svg {
  display: block;
  max-width: 100%;
}

svg.icon {
  flex: 0 0 auto;
}

h1,
h2,
h3,
h4,
p {
  margin-block: 0;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}

::selection {
  background: color-mix(in srgb, var(--accent) 38%, transparent);
  color: var(--text);
}

:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 80%, transparent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  min-height: 34px;
  border: 3px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 48%, transparent);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 72%, transparent);
  background-clip: padding-box;
}

admin-app,
login-view,
activity-view,
messages-view,
users-view,
logs-view,
invoices-view {
  display: block;
  min-width: 0;
}

/* Application frame */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

app-sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: block;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 16px 14px 14px;
  overflow: hidden;
  border-right: 0;
  background: color-mix(in srgb, var(--sidebar) 96%, transparent);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  min-height: 52px;
  gap: 11px;
  padding: 4px 8px 12px;
}

.brand-orb {
  display: block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-orb--large {
  width: 48px;
  height: 48px;
}

.brand-wordmark {
  display: block;
  width: 100px;
  line-height: 0;
}

.brand-wordmark img {
  display: block;
  width: 100%;
  height: auto;
}

.brand-wordmark__light {
  display: none !important;
}

[data-theme="light"] .brand-wordmark__dark {
  display: none;
}

[data-theme="light"] .brand-wordmark__light {
  display: block !important;
}

.brand-copy,
.profile-button__copy,
.nav-item__copy {
  display: grid;
  min-width: 0;
}

.brand-copy small,
.sidebar__scope small,
.profile-button small,
.nav-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button.sidebar__close {
  display: none;
  margin-left: auto;
}

.sidebar__scope {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 8px;
  margin: 6px 2px 20px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.sidebar__scope > span:last-child {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 4px;
}

.sidebar__scope strong {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.25;
}

.status-orbit {
  position: relative;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 50%;
  background: var(--amber);
}

.status-orbit::after {
  display: none;
}

.status-orbit.is-healthy {
  background: var(--green);
}

.sidebar__nav {
  display: grid;
  align-content: start;
  gap: 5px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  gap: 11px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.nav-item:hover {
  border-color: color-mix(in srgb, var(--border) 74%, transparent);
  background: color-mix(in srgb, var(--surface-raised) 78%, transparent);
  color: var(--text);
}

.nav-item:active {
  transform: translateY(1px);
}

.nav-item.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
}

.nav-item.is-active::before {
  position: absolute;
  left: -4px;
  width: 3px;
  height: 24px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  content: "";
}

.nav-item__icon {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
}

.nav-item.is-active .nav-item__icon {
  color: var(--accent-hover);
}

.nav-item strong,
.profile-button strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid var(--hairline);
}

.profile-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.profile-button:hover {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.profile-button > svg {
  margin-left: auto;
  color: var(--muted);
}

.avatar,
.avatar-button,
.user-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-raised));
  color: var(--text);
  font-weight: 750;
  text-transform: uppercase;
}

.avatar {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.avatar--small {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.sidebar-scrim {
  display: none;
}

.app-stage {
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  min-width: 0;
  min-height: calc(100vh - 12px);
  min-height: calc(100dvh - 12px);
  margin: 6px 8px 6px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--stage);
  box-shadow: 0 1px rgba(255, 255, 255, 0.025) inset;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 16px;
  padding: 0 var(--page-gutter);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--stage) 92%, transparent);
  backdrop-filter: blur(14px);
}

.topbar__left,
.topbar__actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.topbar__title {
  display: grid;
  min-width: 0;
}

.topbar__title span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.topbar__title strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button.topbar__menu {
  display: none;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.connection-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent);
}

.icon-button,
.theme-button,
.avatar-button {
  display: inline-grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.icon-button:hover,
.theme-button:hover,
.avatar-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.icon-button:active,
.theme-button:active,
.avatar-button:active {
  transform: translateY(1px);
}

.icon-button--small {
  width: 34px;
  height: 34px;
  border-radius: 7px;
}

.icon-button--ghost {
  border-color: transparent;
  background: transparent;
}

.avatar-button {
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  font-size: 12px;
  font-weight: 780;
}

.theme-button__light {
  display: none;
}

[data-theme="light"] .theme-button__dark {
  display: none;
}

[data-theme="light"] .theme-button__light {
  display: block;
}

.page-stage {
  min-width: 0;
  min-height: 0;
  padding: 22px var(--page-gutter) 28px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.account-popover {
  position: fixed;
  z-index: 80;
  top: 62px;
  right: 20px;
  width: min(330px, calc(100vw - 28px));
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  animation: popover-in var(--transition) both;
}

.account-popover__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 8px;
}

.account-popover__close {
  align-self: start;
}

.account-popover__head > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.account-popover__head strong,
.account-popover__head small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover__head strong {
  font-size: 14px;
}

.account-popover__head small {
  color: var(--muted);
  font-size: 12px;
}

.account-popover__connection {
  display: grid;
  gap: 3px;
  margin: 4px 0 7px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.account-popover__connection span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.account-popover__connection code {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-action {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  gap: 10px;
  padding: 8px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.popover-action:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.popover-action--danger {
  color: var(--red);
}

/* Page composition */

.page-view,
.view-shell,
.dashboard-view,
.page-content {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 18px;
}

.page-view,
.view-shell,
.dashboard-view {
  animation: page-in 240ms ease-out both;
}

.page-header,
.page-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
  gap: 18px;
}

.page-refresh {
  color: var(--muted);
}

.page-refresh:hover,
.sidebar__close:hover,
.account-popover__close:hover {
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

.page-header__copy,
.page-heading__copy,
.page-title-group {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.page-header h1,
.page-heading h1,
.page-title {
  color: var(--text);
  font-size: clamp(27px, 2.25vw, 34px);
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.page-header p,
.page-heading p,
.page-subtitle {
  max-width: 72ch;
  color: var(--muted);
  font-size: 14px;
}

.page-actions,
.panel-actions,
.toolbar-actions,
.filter-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.panel,
.card,
.surface-card,
.dashboard-card,
.filter-panel,
.filter-bar,
.toolbar-panel,
.metric-card,
.chart-card,
.table-panel,
.list-panel,
.conversation-panel,
.logs-panel,
.activity-panel,
.revenue-panel,
.outstanding-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 1px rgba(255, 255, 255, 0.018) inset;
}

.panel,
.card,
.surface-card,
.dashboard-card {
  padding: 16px;
}

.panel-header,
.card-header,
.section-header,
.chart-card__header,
.table-panel__header,
.list-panel__header,
.conversation-panel__header,
.logs-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 14px;
}

.panel-title,
.card-title,
.section-title,
.panel-header h2,
.card-header h2,
.section-header h2,
.chart-card__header h2,
.table-panel__header h2,
.list-panel__header h2 {
  color: var(--text);
  font-size: clamp(18px, 1.55vw, 25px);
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.section-kicker,
.field-label,
.filter-label,
.control-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.055em;
  line-height: 1.35;
  text-transform: uppercase;
}

.filter-panel,
.filter-bar,
.toolbar-panel {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px;
}

.filter-grid,
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  align-items: end;
  min-width: 0;
  flex: 1 1 680px;
  gap: 12px;
}

.filter-group,
.field,
.control-group {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.field > span,
.filter-group > label,
.filter-group > span,
.control-group > label,
.control-group > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 690;
  letter-spacing: 0.045em;
  line-height: 1.35;
  text-transform: uppercase;
}

:where(.field, .filter-group, .control-group) input,
:where(.field, .filter-group, .control-group) select,
:where(.field, .filter-group, .control-group) textarea,
.input,
.select,
.search-input,
.filter-input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--text);
  outline: 0;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

:where(.field, .filter-group, .control-group) input:hover,
:where(.field, .filter-group, .control-group) select:hover,
:where(.field, .filter-group, .control-group) textarea:hover,
.input:hover,
.select:hover,
.search-input:hover,
.filter-input:hover {
  border-color: color-mix(in srgb, var(--border-strong) 72%, var(--text));
}

:where(.field, .filter-group, .control-group) input:focus,
:where(.field, .filter-group, .control-group) select:focus,
:where(.field, .filter-group, .control-group) textarea:focus,
.input:focus,
.select:focus,
.search-input:focus,
.filter-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
  opacity: 1;
}

select {
  text-overflow: ellipsis;
}

option {
  background: var(--surface-raised);
  color: var(--text);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  opacity: 0.8;
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}

.field--compact {
  gap: 4px;
}

.field--compact input,
.field--compact select {
  min-height: 36px;
}

.search-field,
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: min(250px, 100%);
  flex: 1 1 300px;
}

.search-field > svg,
.search-box > svg,
.search-field__icon {
  position: absolute;
  z-index: 1;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}

.search-field input,
.search-box input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px 8px 37px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--text);
  outline: 0;
}

.search-field input:focus,
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition), transform var(--transition);
}

.button:hover,
.btn:hover {
  border-color: color-mix(in srgb, var(--border-strong) 65%, var(--text));
  background: var(--surface-hover);
}

.button:active,
.btn:active {
  transform: translateY(1px);
}

.button--primary,
.btn--primary,
.primary-button {
  border-color: color-mix(in srgb, var(--accent) 80%, #ffffff);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 5px 18px color-mix(in srgb, var(--accent) 18%, transparent);
}

.button--primary:hover,
.btn--primary:hover,
.primary-button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

[data-theme="light"] .button--primary,
[data-theme="light"] .btn--primary,
[data-theme="light"] .primary-button {
  color: #fffdf5;
}

.button--secondary,
.btn--secondary {
  background: var(--surface);
}

.button--ghost,
.btn--ghost,
.link-button {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--text-soft);
}

.button--ghost:hover,
.btn--ghost:hover,
.link-button:hover {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--text);
}

.button--danger,
.btn--danger {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.button--small,
.btn--small {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
}

.button--large,
.btn--large {
  min-height: 48px;
  padding-inline: 18px;
  font-size: 14px;
}

/* Metrics and charts */

.metrics-grid,
.metric-grid,
.summary-grid,
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  gap: 18px;
}

.metric-card,
.kpi-card {
  position: relative;
  display: grid;
  min-height: 132px;
  align-content: space-between;
  gap: 12px;
  padding: 15px;
}

.metric-card__top,
.metric-card__label,
.kpi-card__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.metric-card__icon,
.kpi-card__icon {
  color: var(--muted);
}

.metric-card__value,
.metric-value,
.kpi-card__value {
  color: var(--text);
  font-size: clamp(28px, 2.3vw, 36px);
  font-weight: 770;
  letter-spacing: -0.04em;
  line-height: 1;
}

.metric-card__meta,
.metric-card__description,
.kpi-card__meta {
  color: var(--muted);
  font-size: 13px;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 680;
}

.metric-trend.is-down,
.metric-trend--down {
  color: var(--red);
}

.chart-card,
.chart-panel {
  min-height: 300px;
  padding: 18px;
}

.chart-card__header,
.chart-header {
  margin-bottom: 15px;
}

.chart-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-title svg,
.chart-accent {
  color: var(--accent);
}

.chart-wrap,
.chart-container,
.chart-canvas {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 230px;
  overflow: hidden;
}

.chart-wrap svg,
.chart-container > svg,
.chart-svg {
  width: 100%;
  height: 100%;
  min-height: 230px;
  overflow: visible;
}

.chart-grid line,
.grid-line {
  stroke: color-mix(in srgb, var(--border) 70%, transparent);
  stroke-dasharray: 3 5;
  stroke-width: 1;
}

.chart-axis,
.chart-axis text,
.chart-label {
  fill: var(--muted);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
}

.chart-line,
.line-series {
  fill: none;
  stroke: var(--amber);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.25;
  vector-effect: non-scaling-stroke;
}

.chart-area,
.area-series {
  fill: color-mix(in srgb, var(--amber) 8%, transparent);
}

.chart-point {
  fill: var(--surface);
  stroke: var(--amber);
  stroke-width: 2;
}

.chart-bar,
.bar-series rect {
  fill: #7aa7dc;
}

.chart-bar--secondary,
.bar-series--secondary rect {
  fill: #dca36f;
}

.chart-legend,
.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
}

/* Tables, list rows, and pagination */

.table-panel {
  overflow: hidden;
}

.table-panel__header {
  min-height: 55px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}

.table-scroll,
.table-wrap,
.data-table-wrap {
  width: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior-inline: contain;
}

table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: middle;
}

th {
  height: 44px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.045em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: color-mix(in srgb, var(--surface-hover) 65%, transparent);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td strong,
.cell-primary {
  color: var(--text);
  font-weight: 680;
}

.cell-secondary,
.table-meta {
  color: var(--muted);
  font-size: 12px;
}

.cell-mono,
.invoice-number,
.log-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.amount,
.numeric,
.date-cell,
.status-cell {
  text-align: right;
  white-space: nowrap;
}

.selection-cell {
  width: 48px;
  text-align: center;
}

.selection-cell input,
.row-check {
  width: 16px;
  height: 16px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  opacity: 0.45;
  transition: opacity var(--transition);
}

tr:hover .row-actions,
tr:focus-within .row-actions,
.list-row:hover .row-actions,
.list-row:focus-within .row-actions {
  opacity: 1;
}

.badge,
.status-badge,
.pill,
.log-level {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 730;
  letter-spacing: 0.025em;
  line-height: 1.2;
  white-space: nowrap;
}

.badge--success,
.status-badge--success,
.status-badge--active,
.status-paid,
.is-paid {
  border-color: var(--green-border);
  background: var(--green-soft);
  color: var(--green);
}

.badge--info,
.status-badge--info,
.status-sent,
.is-sent {
  border-color: var(--blue-border);
  background: var(--blue-soft);
  color: var(--blue);
}

.badge--warning,
.status-badge--warning,
.status-overdue,
.is-warning {
  border-color: var(--amber-border);
  background: var(--amber-soft);
  color: var(--amber);
}

.badge--danger,
.status-badge--danger,
.status-failed,
.is-danger {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.badge--purple,
.status-badge--purple {
  border-color: var(--purple-border);
  background: var(--purple-soft);
  color: var(--purple);
}

.badge--neutral,
.status-badge--inactive {
  color: var(--muted);
}

.pagination,
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 8px;
}

.pagination__button,
.page-button,
.pager button {
  display: inline-grid;
  min-width: 36px;
  height: 36px;
  place-items: center;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
}

.pagination__button:hover,
.page-button:hover,
.pager button:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.pagination__button.is-current,
.page-button.is-current,
.pager button[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pagination__summary {
  margin-inline: 8px;
  color: var(--muted);
  font-size: 12px;
}

.list-panel {
  overflow: hidden;
}

.list-panel__header {
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.list-row,
.activity-row,
.user-row {
  min-width: 0;
  border-bottom: 1px solid var(--hairline);
}

.list-row:last-child,
.activity-row:last-child,
.user-row:last-child {
  border-bottom: 0;
}

/* Activity and project analytics */

.activity-list,
.recent-activity,
.activity-feed {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
  overflow: auto;
}

.activity-row,
.activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 64px;
  gap: 16px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-inset);
}

.activity-row__person,
.activity-item__person,
.activity-row__meta,
.activity-item__meta {
  display: grid;
  min-width: 0;
}

.activity-row strong,
.activity-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-row small,
.activity-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-row__meta,
.activity-item__meta {
  justify-items: end;
  font-variant-numeric: tabular-nums;
}

.activity-panel,
.recent-activity-panel {
  max-height: 510px;
  overflow: hidden;
}

/* Users */

.users-toolbar,
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 14px;
  padding: 2px 10px;
}

.users-list,
.user-list {
  min-width: 0;
  border-top: 1px solid var(--hairline);
}

.user-row,
.user-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 88px;
  gap: 12px;
  padding: 12px 18px;
  transition: background var(--transition);
}

.user-row:hover,
.user-item:hover {
  background: color-mix(in srgb, var(--surface-hover) 42%, transparent);
}

.user-avatar,
.user-row__icon {
  width: 32px;
  height: 32px;
  color: var(--muted);
  font-size: 11px;
}

.user-row__content,
.user-details,
.user-item__content {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.user-row__name,
.user-name,
.user-item__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.user-email,
.user-row__email,
.user-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-id,
.user-row__id {
  overflow: hidden;
  color: var(--accent-hover);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row__actions,
.user-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Invoices and revenue */

.invoice-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px auto auto;
  align-items: center;
  gap: 12px;
}

.revenue-grid,
.billing-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  min-width: 0;
  gap: 18px;
}

.revenue-panel,
.revenue-chart {
  min-height: 190px;
  padding: 14px 0 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.revenue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
  padding-right: 2px;
}

.revenue-header__title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.revenue-header h2 {
  font-size: 18px;
  font-weight: 720;
}

.revenue-total {
  color: var(--text);
  font-size: 16px;
  font-weight: 740;
  white-space: nowrap;
}

.outstanding-card {
  display: grid;
  min-height: 190px;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.outstanding-card h2 {
  font-size: 18px;
}

.outstanding-card__value,
.outstanding-value {
  font-size: 30px;
  font-weight: 770;
  letter-spacing: -0.035em;
}

.outstanding-breakdown {
  display: grid;
  gap: 6px;
  margin: 2px 0 0;
}

.outstanding-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 12px;
}

.outstanding-breakdown strong {
  color: var(--text);
}

.invoice-table tbody tr {
  height: 49px;
}

/* Conversation history */

.conversation-panel,
.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: min(720px, calc(100dvh - 236px));
  overflow: hidden;
}

.conversation-panel__header,
.chat-panel__header {
  min-height: 56px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.conversation-scroll,
.conversation-history,
.chat-history {
  min-width: 0;
  min-height: 0;
  padding: 0 13px 16px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.message,
.chat-message,
.conversation-message {
  display: grid;
  justify-items: start;
  min-width: 0;
  gap: 4px;
  margin: 14px 0;
}

.message--user,
.chat-message--user,
.conversation-message[data-role="user"] {
  justify-items: end;
}

.message-meta,
.message__meta,
.message-timestamp,
.chat-message__meta {
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.message-bubble,
.chat-bubble,
.message__bubble {
  max-width: min(72ch, 72%);
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-inset);
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message--user .message-bubble,
.message--user .chat-bubble,
.chat-message--user .message-bubble,
.chat-message--user .chat-bubble,
.message-bubble--user,
.conversation-message[data-role="user"] .message-bubble {
  border-color: color-mix(in srgb, var(--border-strong) 74%, transparent);
  border-bottom-right-radius: 4px;
  background: var(--surface-soft);
  color: var(--text);
}

.message--assistant .message-bubble,
.chat-message--assistant .chat-bubble,
.message-bubble--assistant,
.conversation-message[data-role="assistant"] .message-bubble {
  border-bottom-left-radius: 4px;
}

.message-bubble p + p,
.chat-bubble p + p {
  margin-top: 0.8em;
}

.message-bubble pre,
.chat-bubble pre {
  max-width: 100%;
  margin: 9px 0 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--canvas);
  font-size: 12px;
  white-space: pre;
}

.tool-stack,
.tool-events,
.trace-stack {
  display: grid;
  justify-items: start;
  gap: 9px;
  margin: 16px 0;
}

.tool-event,
.tool-card,
.trace-card {
  display: grid;
  max-width: min(880px, 78%);
  overflow: hidden;
  border: 1px solid var(--purple-border);
  border-radius: 8px;
  background: var(--purple-soft);
  color: var(--purple);
}

.tool-event__summary,
.tool-card__header,
.trace-card__header,
.tool-event > summary,
.tool-card > summary {
  display: flex;
  align-items: center;
  min-height: 36px;
  gap: 8px;
  padding: 7px 10px;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}

.tool-event > summary::-webkit-details-marker,
.tool-card > summary::-webkit-details-marker {
  display: none;
}

.tool-event--output,
.tool-card--output,
.trace-card--output,
.tool-event[data-kind="output"] {
  border-color: var(--green-border);
  background: var(--green-soft);
  color: var(--green);
}

.tool-event--error,
.tool-card--error,
.trace-card--error,
.tool-event[data-kind="error"] {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.tool-event__body,
.tool-card__body,
.trace-card__body {
  max-height: 300px;
  padding: 10px;
  overflow: auto;
  border-top: 1px solid currentColor;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.tool-meta,
.tool-timestamp {
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Logs */

.logs-panel,
.log-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: min(760px, calc(100dvh - 190px));
  overflow: hidden;
}

.logs-panel__header,
.log-panel__header {
  min-height: 54px;
  justify-content: flex-end;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.log-stream,
.logs-stream,
.log-list {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.log-entry,
.log-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: max-content;
  min-height: 60px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.log-entry:hover,
.log-row:hover {
  background: var(--surface-raised);
}

.log-entry__main,
.log-row__main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.log-level {
  min-width: 82px;
  justify-content: center;
  font-family: var(--font-sans);
  text-transform: uppercase;
}

.log-level--info,
.log-entry[data-level="info"] .log-level {
  border-color: var(--blue-border);
  background: var(--blue-soft);
  color: var(--blue);
}

.log-level--warning,
.log-entry[data-level="warning"] .log-level,
.log-entry[data-level="warn"] .log-level {
  border-color: var(--amber-border);
  background: var(--amber-soft);
  color: var(--amber);
}

.log-level--error,
.log-entry[data-level="error"] .log-level {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.log-level--debug,
.log-entry[data-level="debug"] .log-level {
  border-color: var(--border-strong);
  background: var(--surface-soft);
  color: var(--text-soft);
}

.log-time,
.log-entry__time {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.log-message,
.log-entry__message {
  color: var(--text);
  white-space: pre;
}

.log-entry__meta,
.log-meta {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--faint);
  font-size: 10px;
}

.log-chip {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-inset);
}

.logs-wrap .log-message,
.log-stream.is-wrapped .log-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Toggles, disclosure, dialogs */

.toggle,
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.toggle input,
.switch input {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-inset);
  outline: 0;
  transition: background var(--transition), border-color var(--transition);
}

.toggle input::after,
.switch input::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  content: "";
  transition: transform var(--transition), background var(--transition);
}

.toggle input:checked,
.switch input:checked {
  border-color: var(--green);
  background: var(--green);
}

.toggle input:checked::after,
.switch input:checked::after {
  background: #ffffff;
  transform: translateX(16px);
}

.toggle input:focus-visible,
.switch input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 80%, transparent);
  outline-offset: 2px;
}

.connection-details,
.details-card,
.disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.connection-details > summary,
.details-card > summary,
.disclosure > summary {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 8px;
  padding: 8px 11px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  list-style: none;
}

.connection-details > summary::-webkit-details-marker,
.details-card > summary::-webkit-details-marker,
.disclosure > summary::-webkit-details-marker {
  display: none;
}

.connection-details[open] > summary,
.details-card[open] > summary,
.disclosure[open] > summary {
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.connection-details > :not(summary),
.details-card > :not(summary),
.disclosure > :not(summary) {
  margin: 11px;
}

dialog,
.dialog,
.modal {
  width: min(560px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

dialog::backdrop,
.modal-backdrop {
  background: rgba(4, 5, 4, 0.7);
  backdrop-filter: blur(3px);
}

.dialog__header,
.modal__header,
.dialog__footer,
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.dialog__header,
.modal__header {
  border-bottom: 1px solid var(--border);
}

.dialog__header h2,
.modal__header h2 {
  font-size: 19px;
}

.dialog__body,
.modal__body {
  display: grid;
  gap: 14px;
  max-height: calc(100dvh - 190px);
  padding: 16px;
  overflow: auto;
}

.dialog__footer,
.modal__footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* Empty, error, and loading states */

.empty-state,
.state-panel {
  display: grid;
  justify-items: center;
  min-height: 220px;
  align-content: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state__icon,
.state-panel__icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  margin-bottom: 3px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-raised);
  color: var(--muted);
}

.empty-state strong,
.state-panel strong {
  color: var(--text);
  font-size: 15px;
}

.empty-state p,
.state-panel p {
  max-width: 48ch;
  color: var(--muted);
  font-size: 13px;
}

.state-panel {
  grid-template-columns: auto minmax(0, 1fr) auto;
  justify-items: start;
  min-height: 112px;
  text-align: left;
}

.state-panel--error {
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  background: var(--red-soft);
}

.state-panel--error .state-panel__icon {
  border-color: var(--red-border);
  color: var(--red);
}

.skeleton-stack {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.skeleton-line,
.skeleton-card {
  position: relative;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-soft);
}

.skeleton-line {
  width: 78%;
  height: 42px;
}

.skeleton-line--wide {
  width: 100%;
}

.skeleton-line--mid {
  width: 64%;
}

.skeleton-line--short {
  width: 42%;
}

.skeleton-line::after,
.skeleton-card::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 18%, color-mix(in srgb, var(--text) 8%, transparent) 48%, transparent 78%);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid color-mix(in srgb, currentColor 32%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

.loading-track {
  position: relative;
  display: block;
  width: min(300px, 70vw);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.loading-track i {
  position: absolute;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: loading-track 1.25s ease-in-out infinite;
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--canvas);
  text-align: center;
}

.boot-screen > div {
  display: grid;
  gap: 3px;
}

.boot-screen strong {
  font-size: 16px;
}

.boot-screen small {
  color: var(--muted);
}

/* Login */

.login-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: clamp(72px, 10vh, 116px) 22px 44px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 7%, color-mix(in srgb, var(--amber) 11%, transparent) 0, transparent 25rem),
    linear-gradient(180deg, color-mix(in srgb, var(--canvas) 82%, #000000) 0 68%, var(--canvas) 68% 100%);
}

.login-shell::before {
  position: absolute;
  z-index: -3;
  inset: 0 0 31%;
  background-image:
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px),
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(110deg, transparent 0 49.8%, color-mix(in srgb, var(--border) 55%, transparent) 50%, transparent 50.2%);
  background-size: min(24vw, 320px) 100%, 100% min(24vh, 220px), 100% 100%;
  content: "";
  opacity: 0.5;
}

.login-shell::after {
  position: absolute;
  z-index: -3;
  right: -12%;
  bottom: -16%;
  left: -12%;
  height: 50%;
  border-top: 1px solid var(--border);
  background:
    repeating-linear-gradient(101deg, transparent 0 9vw, var(--hairline) calc(9vw + 1px), transparent calc(9vw + 2px)),
    linear-gradient(180deg, color-mix(in srgb, var(--stage) 72%, transparent), var(--canvas));
  content: "";
  transform: perspective(500px) rotateX(52deg);
  transform-origin: top;
}

.login-warehouse {
  position: absolute;
  z-index: -2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-warehouse__beam {
  position: absolute;
  top: -12%;
  width: 36px;
  height: 100%;
  border-inline: 1px solid color-mix(in srgb, var(--border-strong) 60%, transparent);
  background:
    repeating-linear-gradient(0deg, transparent 0 62px, var(--hairline) 63px 65px),
    color-mix(in srgb, var(--surface-inset) 78%, transparent);
  box-shadow: 0 0 38px rgba(0, 0, 0, 0.26);
  opacity: 0.72;
}

.login-warehouse__beam--left {
  left: 12%;
  transform: rotate(14deg);
}

.login-warehouse__beam--right {
  right: 12%;
  transform: rotate(-14deg);
}

.login-warehouse__conduit {
  position: absolute;
  top: 19%;
  right: 0;
  left: 0;
  height: 4px;
  border-block: 1px solid color-mix(in srgb, var(--border-strong) 58%, transparent);
  background: var(--surface-inset);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
  opacity: 0.82;
}

.login-warehouse__lamp {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: clamp(54px, 9vh, 100px);
  background: var(--border-strong);
  transform: translateX(-50%);
}

.login-warehouse__lamp::before {
  position: absolute;
  bottom: -13px;
  left: 50%;
  width: 74px;
  height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 50% 50% 12% 12%;
  background: var(--surface-inset);
  content: "";
  transform: translateX(-50%);
}

.login-warehouse__lamp::after {
  position: absolute;
  bottom: -18px;
  left: 50%;
  width: 50px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--amber) 70%, var(--text));
  box-shadow: 0 8px 38px 12px color-mix(in srgb, var(--amber) 14%, transparent);
  content: "";
  transform: translateX(-50%);
}

.login-panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(430px, 100%);
  place-items: center;
}

.login-panel__theme {
  position: fixed;
  z-index: 2;
  top: 20px;
  right: 22px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(8px);
}

.login-form {
  position: relative;
  display: grid;
  width: 100%;
  gap: 16px;
  padding: clamp(22px, 4vw, 30px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-raised) 68%, transparent), transparent 42%),
    var(--surface);
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.46),
    0 0 0 5px color-mix(in srgb, var(--canvas) 50%, transparent),
    inset 0 1px rgba(255, 255, 255, 0.035);
}

.login-form::before {
  position: absolute;
  inset: 7px;
  border: 1px solid var(--hairline);
  content: "";
  pointer-events: none;
}

.login-console__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -3px -2px 5px;
  padding: 0 2px 17px;
  border-bottom: 1px solid var(--border);
}

.login-console__brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.login-console__brand .brand-orb {
  width: 32px;
  height: 32px;
}

.login-console__brand > span:last-child {
  display: grid;
  min-width: 0;
}

.login-console__brand .brand-wordmark {
  width: 88px;
}

.login-console__brand small {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.055em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.login-console__status {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid var(--amber-border);
  border-radius: 2px;
  background: var(--amber-soft);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.login-console__status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}

.login-form__heading {
  display: grid;
  gap: 4px;
  margin: 3px 0 8px;
}

.login-form__heading h1 {
  font-size: 27px;
  font-weight: 740;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.login-form__heading p,
.login-form__security {
  color: var(--muted);
  font-size: 12px;
}

.login-form .field > span {
  font-family: var(--font-mono);
  font-size: 10px;
}

.login-form .field input {
  min-height: 44px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--surface-inset) 94%, transparent);
}

.login-form .connection-details {
  border-radius: 3px;
}

.login-form .button--large {
  min-height: 44px;
  border-radius: 3px;
}

.login-form__security {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.025em;
  text-align: center;
  text-transform: uppercase;
}

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
}

.form-alert svg {
  margin-top: 1px;
}

/* Concrete view integrations */

.activity-view,
.messages-view,
.users-view,
.logs-view,
.invoices-view {
  min-height: 100%;
}

.page-heading > div:first-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.page-heading__meta {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 12px;
}

.page-heading__meta > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.page-heading__meta > span strong {
  color: var(--text);
  font-size: 14px;
}

.page-heading--compact h1 {
  font-size: clamp(26px, 2vw, 32px);
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
  gap: 16px;
  margin-bottom: 15px;
}

.panel__header > div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.panel__header h2 {
  color: var(--text);
  font-size: clamp(18px, 1.5vw, 24px);
  font-weight: 730;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.panel__header p {
  color: var(--muted);
  font-size: 12px;
}

.panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 14px;
  padding: 10px 15px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.pagination-bar .pagination {
  min-height: auto;
  padding: 0;
}

.pagination-bar .pagination > span {
  min-width: 72px;
  color: var(--muted);
  text-align: center;
}

.result-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-inset);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.filter-panel > .field {
  flex: 0 1 190px;
}

.filter-panel > .field--small {
  flex-basis: 92px;
}

.filter-panel > .field--wide {
  flex-basis: 250px;
}

.filter-panel > .field--grow {
  flex: 1 1 340px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.field--search .input-with-icon {
  min-width: 0;
}

.input-with-icon > svg {
  position: absolute;
  z-index: 1;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}

.field .input-with-icon > input,
.input-with-icon > input {
  width: 100%;
  padding-left: 36px;
}

.compact-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.compact-select select {
  min-width: 68px;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-inset);
  color: var(--text);
}

.filter-panel__summary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  gap: 8px;
  margin-left: auto;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.inline-warning {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-md);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--green-border);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 680;
  white-space: nowrap;
}

.live-indicator i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
}

.icon-button--quiet {
  width: 34px;
  height: 34px;
  border-color: transparent;
  background: transparent;
}

.is-copied {
  border-color: var(--green-border) !important;
  color: var(--green) !important;
}

/* Activity view */

.activity-filters .field--select {
  flex-basis: 220px;
}

.activity-filters .field--wide {
  flex-basis: 280px;
}

.metric-card > strong {
  color: var(--text);
  font-size: clamp(29px, 2.25vw, 36px);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1;
}

.metric-card > span:last-child:not(.metric-card__icon) {
  color: var(--muted);
  font-size: 12px;
}

.metric-card__icon {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-inset);
}

.metric-card__icon--accent {
  color: var(--accent-hover);
}

.metric-card__icon--blue {
  color: var(--blue);
}

.metric-card__icon--orange {
  color: var(--orange);
}

.metric-card__label {
  padding-right: 40px;
}

.metric-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green) !important;
  font-size: 11px !important;
  font-weight: 680;
}

.metric-card__trend.is-negative {
  color: var(--red) !important;
}

.chart-total {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 1px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-total strong {
  color: var(--text);
  font-size: 18px;
}

.chart-total small {
  color: var(--muted);
  font-size: 10px;
}

.line-chart,
.bar-chart {
  width: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
}

.line-chart svg,
.bar-chart svg {
  width: 100%;
  height: auto;
  min-height: 190px;
  overflow: visible;
}

line.chart-grid {
  stroke: var(--chart-grid);
  stroke-dasharray: 3 4;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

text.chart-label {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
}

.chart-point__marker {
  fill: var(--chart-point-color, var(--chart-primary));
  pointer-events: none;
  stroke: var(--surface-raised);
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(.78);
  transition: opacity var(--transition), transform var(--transition);
  vector-effect: non-scaling-stroke;
}

.chart-hover-layer {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.chart-point__rule {
  stroke: var(--chart-point-color, var(--chart-primary));
  stroke-dasharray: 3 4;
  stroke-opacity: .5;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-point__tooltip {
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, .24));
}

.chart-point__tooltip-bg {
  fill: var(--surface-raised);
  stroke: var(--border-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-point__tooltip-date,
.chart-point__tooltip-count {
  fill: var(--text);
  font-family: var(--font-sans);
  font-size: 11px;
}

.chart-point__tooltip-date {
  font-size: 10px;
  font-weight: 720;
}

.chart-point__tooltip-count {
  fill: var(--muted);
  font-size: 10px;
}

.chart-point__tooltip-key {
  fill: var(--chart-point-color, var(--chart-primary));
}

.chart-point__hit {
  cursor: crosshair;
  fill: transparent;
  pointer-events: all;
  stroke: none;
}

.chart-point-hover:is(:hover, [data-active="true"]) .chart-hover-layer {
  opacity: 1;
}

.chart-point-hover:is(:hover, [data-active="true"]) .chart-point__marker {
  transform: scale(1.08);
}

/* Invoicing revenue chart */

.revenue-panel:has(> .revenue-chart-header) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding-top: 8px;
}

.revenue-panel > .panel__header.revenue-chart-header {
  align-items: center;
  min-height: 24px;
  gap: 12px;
  margin-bottom: 0;
  padding-inline: 14px;
}

.revenue-panel .revenue-chart-header > .revenue-chart-header__main {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
  gap: 4px 8px;
}

.revenue-chart-header h2 {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.revenue-chart-header__period {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
}

.revenue-chart-legend {
  flex: 1 1 180px;
  gap: 7px;
  font-size: 9px;
  line-height: 1.2;
}

.revenue-chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.revenue-chart-legend > .revenue-chart-legend__item > i {
  width: 7px;
  height: 7px;
}

.revenue-chart-total {
  display: inline-flex;
  align-items: baseline;
  justify-items: normal;
  gap: 4px;
  line-height: 1.2;
}

.revenue-chart-total small {
  order: 0;
  font-size: 9px;
}

.revenue-chart-total strong {
  order: 1;
  font-size: 13px;
  font-weight: 750;
}

.revenue-grid:has(.revenue-chart-plot) > .outstanding-card {
  min-height: 0;
  align-content: start;
  gap: 8px;
  padding: 12px;
}

.revenue-grid:has(.revenue-chart-plot) > .outstanding-card > h2 {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
}

.revenue-grid:has(.revenue-chart-plot) > .outstanding-card .outstanding-card__value strong {
  font-size: 30px;
  line-height: 1.08;
}

.revenue-grid:has(.revenue-chart-plot) > .outstanding-card dl > div {
  padding: 4px 0;
  border-top: 0;
  font-size: 11px;
  line-height: 1.35;
}

.revenue-grid:has(.revenue-chart-plot) > .outstanding-card dl > div:last-child {
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--hairline);
}

.revenue-chart-plot {
  --revenue-column-highlight: color-mix(in srgb, var(--text) 76%, transparent);
  --revenue-rule-color: color-mix(in srgb, var(--canvas) 72%, transparent);
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0 10px 5px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 38%, transparent) transparent;
  overscroll-behavior-inline: contain;
}

.revenue-chart-plot .revenue-chart__svg {
  display: block;
  width: 100%;
  min-width: 760px;
  max-width: none;
  height: 126px;
  min-height: 0;
  overflow: visible;
}

.revenue-chart-plot .chart-grid {
  stroke: color-mix(in srgb, var(--chart-grid) 58%, transparent);
  stroke-dasharray: none;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.revenue-chart__label {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.revenue-chart__label--y {
  fill: var(--faint);
}

.revenue-chart__bar {
  opacity: .9;
  shape-rendering: geometricPrecision;
  transition: filter var(--transition), opacity var(--transition);
  vector-effect: non-scaling-stroke;
}

.revenue-chart__hover,
.revenue-chart__rule,
.revenue-chart__tooltip {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.revenue-chart__hover {
  fill: var(--revenue-column-highlight);
}

.revenue-chart__rule {
  stroke: var(--revenue-rule-color);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.revenue-chart__hit {
  cursor: crosshair;
  fill: transparent;
  outline: none;
  pointer-events: all;
  stroke: transparent;
}

.revenue-chart__tooltip {
  color: var(--text-soft);
  filter: drop-shadow(0 7px 15px rgba(0, 0, 0, .34));
  transition: none;
}

.revenue-chart__tooltip-bg {
  fill: color-mix(in srgb, var(--surface-raised) 96%, var(--canvas));
  stroke: var(--border-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.revenue-chart__tooltip-title,
.revenue-chart__tooltip-label,
.revenue-chart__tooltip-value,
.revenue-chart__tooltip-total {
  fill: currentColor;
  font-family: var(--font-sans);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.revenue-chart__tooltip-title {
  color: var(--text);
  font-size: 10.5px;
  font-weight: 720;
}

.revenue-chart__tooltip-row {
  color: var(--revenue-series-color, var(--text-soft));
}

.revenue-chart__tooltip-key {
  fill: var(--revenue-series-color, currentColor);
}

.revenue-chart__tooltip-value {
  font-weight: 680;
}

.revenue-chart__tooltip-total {
  color: var(--text);
  font-weight: 740;
}

.revenue-chart__month:is(:hover, :focus-within, [data-active="true"]) :is(.revenue-chart__hover, .revenue-chart__rule, .revenue-chart__tooltip) {
  opacity: 1;
}

.revenue-chart__month:is(:hover, :focus-within, [data-active="true"]) .revenue-chart__bar {
  filter: brightness(1.12) saturate(1.04);
  opacity: 1;
}

.revenue-chart__svg:has(.revenue-chart__month:is(:hover, :focus-within, [data-active="true"]))
  .revenue-chart__month:not(:hover, :focus-within, [data-active="true"])
  .revenue-chart__bar {
  opacity: .58;
}

.revenue-chart__hit:focus-visible {
  stroke: var(--focus);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

:root[data-theme="light"] .revenue-chart-plot {
  --revenue-column-highlight: color-mix(in srgb, var(--text) 14%, transparent);
  --revenue-rule-color: color-mix(in srgb, var(--text) 42%, transparent);
}

:root[data-theme="light"] .revenue-chart__tooltip {
  filter: drop-shadow(0 6px 12px rgba(62, 52, 34, .2));
}

@media (max-width: 720px) {
  .revenue-panel > .revenue-chart-header {
    align-items: flex-start;
  }

  .revenue-panel .revenue-chart-header > .revenue-chart-header__main {
    gap-block: 6px;
  }

  .revenue-chart-legend {
    flex-basis: 100%;
  }

  .revenue-chart-plot {
    padding-inline: 6px;
  }

  .revenue-chart-plot .revenue-chart__svg {
    min-width: 760px;
  }
}

.activity-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: 520px;
}

.activity-panel .activity-list {
  min-height: 0;
}

.activity-row {
  grid-template-columns: auto minmax(180px, 1fr) minmax(120px, auto);
}

.activity-row__person,
.activity-row__scope {
  display: grid;
  min-width: 0;
}

.activity-row__person > span,
.activity-row__scope > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-row__scope {
  justify-items: end;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.activity-row__scope strong {
  font-size: 12px;
}

.top-users-panel,
.user-trends-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.top-users-panel > .panel__header,
.user-trends-panel > .panel__header {
  margin-bottom: 0;
}

.top-users-panel .panel__header h2,
.user-trends-panel .panel__header h2 {
  display: flex;
  align-items: center;
  gap: 7px;
}

.top-users-panel .panel__header h2 > svg {
  color: var(--green);
}

.user-trends-panel .panel__header h2 > svg {
  color: var(--blue);
}

.top-users-chart {
  --top-users-label-width: clamp(108px, 13vw, 176px);
  display: grid;
  min-width: 0;
  gap: 5px;
  padding-top: 2px;
}

.top-user-row {
  position: relative;
  display: grid;
  grid-template-columns: var(--top-users-label-width) minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  min-height: 30px;
  gap: 10px;
}

.top-user-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-user-track {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 26px;
  border-bottom: 1px dashed color-mix(in srgb, var(--chart-grid) 72%, transparent);
  background-image: linear-gradient(
    to right,
    transparent calc(100% - 1px),
    color-mix(in srgb, var(--chart-grid) 55%, transparent) calc(100% - 1px)
  );
  background-size: calc(100% / var(--top-users-divisions, 4)) 100%;
}

.top-user-bar {
  width: var(--bar-width, 0%);
  min-width: 0;
  height: 20px;
  border-radius: 0 4px 4px 0;
  background: color-mix(in srgb, var(--chart-primary) 76%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--chart-primary) 15%, transparent) inset;
  transition: width 260ms cubic-bezier(0.2, 0.75, 0.25, 1), background var(--transition);
}

.top-user-tooltip {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: clamp(52px, var(--bar-width), calc(100% - 52px));
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-raised);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .26);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.97);
  transition: opacity var(--transition), transform var(--transition);
  white-space: nowrap;
}

.top-user-tooltip strong {
  color: var(--text);
  font-size: 11px;
}

.top-user-row:hover,
.top-user-row:focus-within,
.top-user-row[data-active="true"] {
  z-index: 2;
}

.top-user-row:hover .top-user-bar,
.top-user-row:focus-within .top-user-bar,
.top-user-row[data-active="true"] .top-user-bar {
  background: color-mix(in srgb, var(--chart-primary) 88%, transparent);
}

.top-user-row:hover .top-user-tooltip,
.top-user-row:focus-within .top-user-tooltip,
.top-user-row[data-active="true"] .top-user-tooltip {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.top-user-axis {
  display: grid;
  grid-template-columns: var(--top-users-label-width) minmax(0, 1fr);
  min-width: 0;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.top-user-axis > :last-child,
.top-user-axis__ticks {
  display: flex;
  justify-content: space-between;
  min-width: 0;
}

.user-trends-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: 14px;
}

.user-trend-column {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 7px;
}

.user-trend-column > h3,
.user-trend-column__title {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.user-trend-list {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.user-trend-empty {
  display: grid;
  min-height: 48px;
  margin: 0;
  place-items: center;
  padding: 9px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.user-trend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px auto;
  align-items: center;
  min-width: 0;
  min-height: 48px;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  transition: background var(--transition), border-color var(--transition);
}

.user-trend-row:hover {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface-hover) 58%, var(--surface-inset));
}

.user-trend-person {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.user-trend-person > strong,
.user-trend-person > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-trend-person > strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.user-trend-person > span {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.trend-sparkline {
  display: block;
  width: 84px;
  height: 30px;
  overflow: visible;
  color: var(--green);
}

.trend-sparkline.is-declining,
.user-trend-column.is-declining .trend-sparkline {
  color: var(--red);
}

.trend-sparkline :is(path, polyline) {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 21px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.trend-badge.is-growing {
  background: var(--green-soft);
  color: var(--green);
}

.trend-badge.is-declining {
  background: var(--red-soft);
  color: var(--red);
}

.activity-row.is-clickable {
  width: 100%;
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.activity-row.is-clickable:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  box-shadow: 0 7px 18px color-mix(in srgb, var(--canvas) 22%, transparent);
  transform: translateY(-1px);
}

.activity-row.is-clickable:active {
  transform: translateY(0);
}

/* Users view */

.users-panel,
.logs-panel,
.conversation-panel,
.table-panel {
  padding: 0;
}

.users-filters {
  align-items: end;
}

.users-panel > .panel__header,
.logs-panel > .panel__header,
.conversation-panel > .panel__header,
.table-panel > .panel__header {
  min-height: 64px;
  margin: 0;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
}

.users-list {
  min-height: 0;
}

.users-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: min(680px, calc(100dvh - 260px));
  overflow: hidden;
}

.users-panel .users-list {
  overflow: auto;
  overscroll-behavior-inline: contain;
}

.user-row {
  grid-template-columns: 42px minmax(220px, 1.2fr) minmax(160px, 0.8fr) minmax(190px, 0.9fr) auto;
  min-height: 86px;
  padding: 11px 16px;
}

.user-row__identity,
.user-row__details,
.user-row__id {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 3px;
}

.user-row__identity > span,
.user-row__details > span,
.user-row__details > small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row__id {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-self: stretch;
}

.user-row__id code {
  overflow: hidden;
  color: var(--accent-hover);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row.is-inactive {
  opacity: 0.64;
}

.user-status-dialog .dialog-card {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.user-status-dialog .dialog__body p {
  color: var(--text-soft);
  line-height: 1.6;
}

.switch-field {
  position: relative;
  display: flex;
  align-items: center;
  align-self: end;
  min-height: 40px;
  gap: 10px;
  margin-left: auto;
  padding: 3px 2px;
  cursor: pointer;
}

.switch-field__copy {
  display: grid;
  justify-items: end;
}

.switch-field__copy strong {
  color: var(--text-soft);
  font-size: 11px;
}

.switch-field__copy small {
  color: var(--muted);
  font-size: 10px;
}

.switch-field > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-field > .switch {
  position: relative;
  display: block;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-inset);
  transition: background var(--transition), border-color var(--transition);
}

.switch-field > .switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  content: "";
  transition: transform var(--transition), background var(--transition);
}

.switch-field > input:checked + .switch {
  border-color: var(--green);
  background: var(--green);
}

.switch-field > input:checked + .switch::after {
  background: #fff;
  transform: translateX(16px);
}

.switch-field > input:focus-visible + .switch {
  outline: 3px solid color-mix(in srgb, var(--focus) 80%, transparent);
  outline-offset: 2px;
}

/* Logs view */

.logs-filters {
  gap: 9px;
}

.logs-filters > .field {
  flex: 1 1 120px;
}

.logs-filters > .field--wide {
  flex: 1.5 1 220px;
}

.logs-filters > .field--small {
  flex: 0 1 84px;
}

.logs-filters .filter-actions {
  align-self: end;
  min-height: 40px;
}

.field--multiselect {
  position: relative;
}

.log-multiselect {
  position: relative;
  min-width: 0;
}

.log-multiselect > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  gap: 8px;
  padding: 8px 10px 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--text);
  font-size: 12px;
  list-style: none;
  outline: 0;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.log-multiselect > summary::-webkit-details-marker {
  display: none;
}

.log-multiselect > summary:hover {
  border-color: color-mix(in srgb, var(--border-strong) 72%, var(--text));
}

.log-multiselect > summary:focus-visible,
.log-multiselect[open] > summary {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.log-multiselect > summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-multiselect > summary > svg {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform var(--transition);
}

.log-multiselect[open] > summary > svg {
  transform: rotate(180deg);
}

.log-multiselect__menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  min-width: max(100%, 170px);
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.log-multiselect__option {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
}

.log-multiselect__option:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.field .log-multiselect__option > input {
  flex: 0 0 15px;
  width: 15px;
  min-width: 15px;
  height: 15px;
  min-height: 15px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
}

.logs-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: min(760px, calc(100dvh - 250px));
}

.panel__header.logs-panel__header {
  justify-content: space-between;
}

.logs-list {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.log-row {
  grid-template-columns: 3px minmax(0, 1fr);
  min-width: 0;
  width: 100%;
  padding: 0;
}

.log-row__rail {
  width: 3px;
  background: var(--border);
}

.log-row--debug .log-row__rail {
  background: var(--muted);
}

.log-row--info .log-row__rail {
  background: var(--blue);
}

.log-row--warn .log-row__rail,
.log-row--warning .log-row__rail {
  background: var(--amber);
}

.log-row--error .log-row__rail {
  background: var(--red);
}

.log-row__main {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 3px;
  padding: 7px 12px;
}

.log-row__headline {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  gap: 8px;
}

.log-row__headline time {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.log-row__message {
  min-width: 0;
  color: var(--text);
}

.log-message {
  display: grid;
  flex: 1 1 24rem;
  grid-template-areas: "message actions";
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  min-width: 0;
  gap: 6px;
  white-space: normal;
}

.log-message__text {
  display: block;
  grid-area: message;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-message--collapsible:not(.is-expanded) > .log-message__text {
  display: -webkit-box;
  max-height: 2.9em;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.log-message__full {
  display: block;
  grid-area: message;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow: visible;
  color: var(--text);
  font: inherit;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-message__full[hidden],
.log-message:not(.is-expanded) > .log-message__full {
  display: none;
}

.log-message.is-expanded > .log-message__text {
  display: none;
}

.log-message__actions {
  display: inline-flex;
  grid-area: actions;
  align-items: center;
  gap: 2px;
  opacity: 0.58;
  transition: opacity var(--transition);
}

.log-message:hover > .log-message__actions,
.log-message:focus-within > .log-message__actions,
.log-message__actions:has(.is-copied) {
  opacity: 1;
}

.log-copy-button,
.log-expand-button {
  position: relative;
  width: 28px;
  height: 28px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
}

.log-copy-button:hover,
.log-expand-button:hover,
.log-copy-button:focus-visible,
.log-expand-button:focus-visible {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.log-copy-button.is-copied {
  border-color: var(--green-border) !important;
  background: var(--green-soft);
  color: var(--green) !important;
}

.log-expand-button svg {
  transition: transform var(--transition);
}

.log-expand-button[aria-expanded="true"] svg,
.log-message.is-expanded .log-expand-button svg {
  transform: rotate(180deg);
}

.log-row__meta {
  display: flex;
  grid-column: auto;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: 6px;
  margin: 0;
  padding-left: 90px;
  color: var(--faint);
  font-size: 10px;
}

.log-row__meta > span,
.log-row__meta-item {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  gap: 3px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-inset);
}

.log-row__meta code {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-id-copy {
  width: 24px;
  height: 24px;
  margin: -1px -4px -1px 0;
  border-radius: 4px;
}

.badge--info {
  border-color: var(--blue-border);
  background: var(--blue-soft);
  color: var(--blue);
}

.badge--warn,
.badge--warning {
  border-color: var(--amber-border);
  background: var(--amber-soft);
  color: var(--amber);
}

.badge--error {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.badge--debug {
  border-color: var(--border-strong);
  background: var(--surface-soft);
  color: var(--text-soft);
}

.log-row .badge {
  min-width: 78px;
  justify-content: center;
  text-transform: uppercase;
}

.log-details {
  max-width: min(1000px, calc(100vw - 120px));
  margin: 4px 0 0 90px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-inset);
}

.log-details summary {
  padding: 5px 8px;
  color: var(--muted);
  font-size: 10px;
  list-style-position: inside;
}

.log-details pre {
  max-height: 260px;
  margin: 0;
  padding: 9px;
  overflow: auto;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 11px;
  white-space: pre-wrap;
}

/* Messages view */

.messages-filters .advanced-filters {
  align-self: end;
}

.advanced-filters {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
}

.advanced-filters > summary {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 7px;
  padding: 7px 11px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  list-style: none;
  white-space: nowrap;
}

.advanced-filters > summary::-webkit-details-marker {
  display: none;
}

.advanced-filters[open] > summary {
  border-bottom: 1px solid var(--border);
}

.advanced-filters__body {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 11px;
}

.conversation-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: min(760px, calc(100dvh - 260px));
}

.conversation-panel__header {
  align-items: center;
}

.conversation-user {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.conversation-user > div {
  display: grid;
  min-width: 0;
}

.conversation-user h2,
.conversation-user p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-panel__tools {
  display: flex;
  align-items: end;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
  margin-left: auto;
}

.conversation-tool {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.conversation-tool__label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 690;
  letter-spacing: 0.045em;
  line-height: 1.35;
  text-transform: uppercase;
  white-space: nowrap;
}

.conversation-tool__control {
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-inset);
  color: var(--text);
  outline: 0;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.conversation-tool__control:hover {
  border-color: color-mix(in srgb, var(--border-strong) 72%, var(--text));
}

.conversation-tool__control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.conversation-tool--id {
  width: 132px;
}

.conversation-tool--limit {
  width: 82px;
}

.conversation-tool--search {
  width: clamp(190px, 18vw, 270px);
}

.conversation-id {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.conversation-id code {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
}

.conversation-search {
  width: 100%;
}

.conversation-search input {
  padding-left: 35px;
}

.conversation-feed {
  min-width: 0;
  min-height: 0;
  padding: 2px 13px 18px;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.conversation-event {
  display: grid;
  justify-items: start;
  min-width: 0;
  gap: 5px;
  margin: 14px 0;
}

.conversation-event--user {
  justify-items: end;
}

.conversation-event--tool {
  justify-items: start;
}

.conversation-event > time {
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.conversation-event--user .message-bubble {
  border-color: var(--border-strong);
  border-bottom-right-radius: 4px;
  background: var(--surface-soft);
  color: var(--text);
}

.conversation-event--assistant .message-bubble,
.conversation-event--system .message-bubble {
  border-bottom-left-radius: 4px;
}

.message-bubble__role {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.message-bubble > div {
  white-space: pre-wrap;
}

.message-bubble > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.tool-call-list {
  display: grid;
  justify-items: start;
  max-width: min(900px, 78%);
  gap: 7px;
}

.tool-card {
  width: fit-content;
  max-width: min(900px, 100%);
}

.tool-card--input {
  border-color: var(--purple-border);
  background: var(--purple-soft);
  color: var(--purple);
}

.tool-card > summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-card > summary > span:not(.tool-card__actions) {
  margin-left: auto;
  color: color-mix(in srgb, currentColor 72%, var(--text));
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 650;
  text-transform: uppercase;
}

.tool-card > pre,
.tool-card > .tool-card__body {
  margin: 0;
  padding: 10px;
  border-top: 1px solid currentColor;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.5;
}

.tool-card > pre {
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
}

.tool-card > .tool-card__body {
  min-width: 0;
  max-width: 100%;
  max-height: none;
  overflow: visible;
  white-space: normal;
}

.tool-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin: -2px -2px 8px;
}

.tool-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.tool-card__action:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.tool-card__action:active {
  transform: translateY(1px);
}

.tool-card__action:disabled {
  cursor: default;
  opacity: 0.45;
  transform: none;
}

.tool-card__action--toggle {
  min-width: 68px;
}

.tool-card__action--copy {
  width: 24px;
  padding-inline: 0;
}

.tool-card__action--copy svg {
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.tool-card__action--copy.is-copied {
  background: color-mix(in srgb, var(--green) 14%, transparent);
}

.json-tree,
.json-tree * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.json-tree {
  width: 100%;
  color: var(--text-soft);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.json-tree__root-summary,
.json-tree__row,
.json-tree__branch > summary {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  padding-block: 2px;
}

.json-tree__branch > summary {
  color: inherit;
  list-style: none;
}

.json-tree__branch > summary::-webkit-details-marker {
  display: none;
}

.json-tree__branch:not(.json-tree__branch--root) > summary::before {
  content: "▸";
  flex: 0 0 1em;
  color: var(--muted);
  text-align: center;
  transition: transform 120ms ease;
}

.json-tree__branch[open] > summary::before {
  transform: rotate(90deg);
}

.json-tree__children {
  display: grid;
  min-width: 0;
  margin-left: 5px;
  padding-left: 9px;
  border-left: 1px solid color-mix(in srgb, currentColor 24%, transparent);
}

.json-tree__key {
  flex: 0 1 auto;
  color: var(--accent-hover);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.json-tree__key--index,
.json-tree__separator,
.json-tree__preview {
  color: var(--muted);
}

.json-tree__scalar {
  flex: 1 1 12ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.json-tree__scalar--string {
  color: var(--green);
}

.json-tree__scalar--number,
.json-tree__scalar--bigint {
  color: var(--purple);
}

.json-tree__scalar--boolean,
.json-tree__scalar--null,
.json-tree__scalar--undefined {
  color: var(--accent-hover);
}

.json-tree__badge {
  flex: 0 0 auto;
  padding: 1px 5px;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.json-tree__row--limit,
.json-tree__limit {
  color: var(--faint);
  font-style: italic;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: inherit;
  max-width: min(72ch, 78%);
  gap: 6px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-inset);
  color: var(--text-soft);
  font-size: 10px;
}

.attachment-chip small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact audio attachment player */

.audio-attachment {
  --audio-progress: 0%;
  --audio-wave: color-mix(in srgb, var(--muted) 52%, transparent);
  --audio-wave-active: var(--text-soft);
  position: relative;
  display: grid;
  flex: 0 1 296px;
  grid-template-areas:
    "file toggle waveform"
    "status status status";
  grid-template-columns: 20px 34px minmax(0, 1fr);
  grid-template-rows: minmax(42px, 1fr) 18px;
  align-items: center;
  width: 296px;
  max-width: 100%;
  min-width: 0;
  min-height: 88px;
  column-gap: 8px;
  row-gap: 3px;
  padding: 10px 10px 8px 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border-strong) 72%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-soft) 82%, var(--surface));
  box-shadow: inset 0 1px color-mix(in srgb, var(--text) 3%, transparent);
  color: var(--text-soft);
  isolation: isolate;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.audio-attachment:hover,
.audio-attachment:focus-within {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface-hover) 66%, var(--surface-soft));
}

.audio-attachment__media {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.audio-attachment__file-icon {
  display: grid;
  grid-area: file;
  width: 20px;
  height: 32px;
  place-items: center;
  color: var(--text-soft);
}

.audio-attachment__file-icon .icon {
  width: 17px;
  height: 17px;
}

.audio-attachment__toggle {
  display: grid;
  grid-area: toggle;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  appearance: none;
  background: var(--text-soft);
  box-shadow: 0 2px 7px color-mix(in srgb, var(--canvas) 30%, transparent);
  color: var(--surface-inset);
  transition: background var(--transition), box-shadow var(--transition), color var(--transition), transform var(--transition);
}

.audio-attachment__toggle:hover:not(:disabled) {
  background: var(--text);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--canvas) 40%, transparent);
  transform: translateY(-1px);
}

.audio-attachment__toggle:active:not(:disabled) {
  transform: translateY(0) scale(0.96);
}

.audio-attachment__toggle::before {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-block: 5px solid transparent;
  border-left: 8px solid currentColor;
  content: "";
}

.audio-attachment__toggle > :not(.spinner) {
  display: none;
}

.audio-attachment.is-playing,
.audio-attachment[data-audio-state="playing"] {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow: inset 0 1px color-mix(in srgb, var(--text) 3%, transparent), 0 0 0 1px color-mix(in srgb, var(--accent) 9%, transparent);
}

.audio-attachment.is-playing .audio-attachment__toggle,
.audio-attachment[data-audio-state="playing"] .audio-attachment__toggle {
  background: var(--accent);
  color: var(--surface-raised);
}

.audio-attachment.is-playing .audio-attachment__toggle::before,
.audio-attachment[data-audio-state="playing"] .audio-attachment__toggle::before {
  width: 9px;
  height: 11px;
  margin-left: 0;
  border: 0;
  background: linear-gradient(to right, currentColor 0 3px, transparent 3px 6px, currentColor 6px 9px);
}

.audio-attachment.is-loading .audio-attachment__toggle::before,
.audio-attachment[data-audio-state="loading"] .audio-attachment__toggle::before {
  width: 14px;
  height: 14px;
  margin-left: 0;
  border: 2px solid color-mix(in srgb, currentColor 34%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

.audio-attachment__waveform {
  position: relative;
  display: grid;
  grid-area: waveform;
  align-items: center;
  min-width: 0;
  height: 42px;
  border-radius: 5px;
}

.audio-attachment__bars {
  display: flex;
  align-items: center;
  width: 100%;
  height: 40px;
  gap: 2px;
  overflow: hidden;
  pointer-events: none;
  transition: opacity var(--transition);
}

.audio-attachment__bar {
  width: 2px;
  min-width: 1px;
  max-width: 3px;
  height: var(--audio-bar-height, 34%);
  min-height: 4px;
  max-height: 38px;
  flex: 1 1 2px;
  border-radius: 1px;
  background: var(--audio-wave);
  opacity: 0.72;
  transition: background var(--transition), opacity var(--transition);
}

.audio-attachment__bar.is-played {
  background: var(--audio-wave-active);
  opacity: 1;
}

.audio-attachment.is-playing .audio-attachment__bar.is-played,
.audio-attachment[data-audio-state="playing"] .audio-attachment__bar.is-played {
  background: color-mix(in srgb, var(--accent-hover) 76%, var(--text-soft));
}

.audio-attachment__seek {
  position: absolute;
  z-index: 2;
  inset: -3px 0;
  width: 100%;
  height: calc(100% + 6px);
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  touch-action: none;
}

.audio-attachment__seek::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}

.audio-attachment__seek::-webkit-slider-thumb {
  width: 1px;
  height: 100%;
  border: 0;
  appearance: none;
  background: transparent;
}

.audio-attachment__seek::-moz-range-track {
  height: 100%;
  border: 0;
  background: transparent;
}

.audio-attachment__seek::-moz-range-thumb {
  width: 1px;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.audio-attachment__seek:focus-visible {
  outline: 0;
}

.audio-attachment__waveform:has(.audio-attachment__seek:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--focus) 80%, transparent);
  outline-offset: 2px;
}

.audio-attachment__seek:disabled {
  cursor: not-allowed;
}

.audio-attachment__time {
  z-index: 1;
  grid-area: status;
  align-self: end;
  justify-self: end;
  color: var(--text-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.audio-attachment__status {
  grid-area: status;
  min-width: 0;
  padding-right: 46px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-attachment__status:empty {
  display: none;
}

.audio-attachment__download {
  position: absolute;
  z-index: 3;
  top: 15px;
  left: 8px;
  display: block;
  width: 28px;
  height: 30px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: transparent;
  font-size: 0;
  text-decoration: none;
}

.audio-attachment:has(.audio-attachment__download[href]:hover) .audio-attachment__file-icon,
.audio-attachment:has(.audio-attachment__download[href]:focus-visible) .audio-attachment__file-icon {
  color: var(--text);
}

.audio-attachment__download:not([href]) {
  display: none;
}

.audio-attachment.is-loading .audio-attachment__bars,
.audio-attachment[data-audio-state="loading"] .audio-attachment__bars {
  opacity: 0.45;
}

.audio-attachment.is-error,
.audio-attachment[data-audio-state="error"] {
  border-color: var(--red-border);
  background: color-mix(in srgb, var(--red-soft) 34%, var(--surface-soft));
}

.audio-attachment.is-error .audio-attachment__toggle,
.audio-attachment[data-audio-state="error"] .audio-attachment__toggle {
  background: var(--red-soft);
  color: var(--red);
}

.audio-attachment.is-error .audio-attachment__bar,
.audio-attachment[data-audio-state="error"] .audio-attachment__bar {
  background: color-mix(in srgb, var(--red) 54%, transparent);
  opacity: 0.6;
}

.audio-attachment.is-error .audio-attachment__status,
.audio-attachment[data-audio-state="error"] .audio-attachment__status {
  color: var(--red);
}

@media (max-width: 720px) {
  .attachment-list:has(> .audio-attachment) {
    max-width: 94%;
  }
}

@media (max-width: 360px) {
  .audio-attachment {
    grid-template-columns: 18px 32px minmax(0, 1fr);
    column-gap: 6px;
    padding-inline: 8px;
  }

  .audio-attachment__file-icon {
    width: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .audio-attachment.is-loading .audio-attachment__toggle::before,
  .audio-attachment[data-audio-state="loading"] .audio-attachment__toggle::before {
    animation: none;
  }
}

.conversation-pagination {
  justify-content: center;
}

.conversation-pagination > span {
  color: var(--muted);
  font-size: 11px;
}

/* Invoice view */

.invoice-filters > .field--select {
  flex: 0 1 180px;
}

.invoice-filters > .field--grow {
  flex: 1 1 420px;
}

.revenue-panel > .panel__header {
  padding-inline: 15px;
}

.chart-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--legend-color, var(--chart-primary));
}

.revenue-panel .bar-chart {
  padding: 0 10px 5px;
}

.outstanding-card__value {
  display: grid;
  gap: 1px;
}

.outstanding-card__value strong {
  color: var(--text);
  font-size: 30px;
  font-weight: 780;
  letter-spacing: -0.04em;
}

.outstanding-card__value span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.outstanding-card dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.outstanding-card dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
}

.outstanding-card dt {
  color: var(--muted);
}

.outstanding-card dd {
  margin: 0;
  color: var(--text);
  font-weight: 680;
}

.invoice-table {
  min-width: 1040px;
}

.invoice-table-panel {
  min-height: 360px;
}

.invoice-table td > strong,
.invoice-table td > small {
  display: block;
}

.invoice-table td > small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.align-right {
  text-align: right;
}

.project-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.project-cell i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.badge--paid {
  border-color: var(--green-border);
  background: var(--green-soft);
  color: var(--green);
}

.badge--sent {
  border-color: var(--blue-border);
  background: var(--blue-soft);
  color: var(--blue);
}

.badge--overdue {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.badge--draft {
  color: var(--muted);
}

.badge--cancelled {
  border-color: var(--border);
  background: var(--surface-inset);
  color: var(--muted);
}

.badge > i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.app-dialog {
  overflow: hidden;
}

.invoice-detail-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(620px, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  border-width: 0 0 0 1px;
  border-radius: 0;
  animation: invoice-panel-in 220ms cubic-bezier(0.2, 0, 0, 1) both;
}

.invoice-detail-dialog::backdrop {
  background: rgba(4, 5, 4, 0.62);
  backdrop-filter: none;
}

.dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: inherit;
}

.invoice-dialog {
  width: 100%;
  height: 100%;
}

.dialog-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}

.dialog-card__header > div {
  display: grid;
  gap: 2px;
}

.dialog-card__header h2 {
  font-size: 20px;
}

.invoice-detail-heading p,
.invoice-create-header p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-wrap: pretty;
}

.dialog-card__header > .invoice-detail-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-detail-header-actions .button,
.invoice-detail-status__controls :is(select, .button) {
  min-height: 40px;
}

.invoice-detail-header-actions .button:active,
.invoice-detail-status__controls .button:active {
  transform: scale(0.96);
}

.dialog-card__body {
  display: grid;
  gap: 16px;
  min-height: 180px;
  padding: 16px;
  overflow: auto;
}

.invoice-detail-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 24px;
  padding: 2px 0 17px;
  border-bottom: 1px solid var(--border);
}

.invoice-detail-customer,
.invoice-detail-current-status {
  display: grid;
  gap: 4px;
}

.invoice-detail-current-status {
  justify-items: start;
}

.invoice-detail-customer > span,
.invoice-detail-current-status > span,
.invoice-note > span,
.invoice-detail-meta dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.invoice-detail-customer > strong {
  font-size: 16px;
  line-height: 1.35;
  text-wrap: pretty;
}

.invoice-detail-customer small {
  color: var(--muted);
  font-size: 11px;
}

.invoice-detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.invoice-detail-status h3,
.invoice-detail-section h3,
.invoice-lines h3 {
  margin: 0;
  font-size: 14px;
  text-wrap: balance;
}

.invoice-detail-status p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-wrap: pretty;
}

.invoice-detail-status__controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  min-width: 250px;
  gap: 8px;
}

.invoice-detail-status__controls .field {
  gap: 0;
}

.invoice-detail-section {
  display: grid;
  gap: 8px;
}

.invoice-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
  margin: 0;
}

.invoice-detail-meta > div {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hairline);
}

.invoice-detail-meta dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 620;
  text-align: right;
  overflow-wrap: anywhere;
}

.invoice-detail-notice.form-alert--success {
  border-color: var(--green-border);
  background: var(--green-soft);
  color: var(--green);
}

.invoice-note {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
}

.invoice-note p {
  color: var(--text-soft);
  font-size: 12px;
}

.invoice-lines {
  display: grid;
  gap: 10px;
}

.invoice-line-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.invoice-line-table {
  width: 100%;
  min-width: 510px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.invoice-line-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-inset);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
}

.invoice-line-table td {
  padding: 10px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-soft);
  font-size: 11px;
  vertical-align: top;
}

.invoice-line-table tbody tr:last-child td {
  border-bottom: 0;
}

.invoice-line-table td:first-child {
  width: 42%;
}

.invoice-line-table td strong,
.invoice-line-table td small {
  display: block;
}

.invoice-line-table td small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.invoice-line-table :is(th, td).align-right {
  text-align: right;
}

.invoice-totals {
  display: grid;
  width: min(310px, 100%);
  gap: 6px;
  margin: 2px 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.invoice-totals > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.invoice-totals dt {
  color: var(--muted);
  font-size: 11px;
}

.invoice-totals dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.invoice-totals__grand {
  margin-top: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.invoice-totals__grand :is(dt, dd) {
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
}

/* Invoice creation */

.invoice-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-bulk-notice.form-alert--success,
.invoice-create-notice.form-alert--success {
  border-color: var(--green-border);
  background: var(--green-soft);
  color: var(--green);
}

.invoice-create-dialog {
  width: min(1040px, calc(100vw - 28px));
  max-width: 1040px;
  height: min(900px, calc(100dvh - 28px));
  max-height: min(900px, calc(100dvh - 28px));
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface);
}

.invoice-create-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
}

.invoice-create-header {
  min-height: 68px;
  padding: 16px 20px;
  background: var(--surface);
}

.invoice-create-header h2 {
  font-size: clamp(22px, 2.2vw, 28px);
  letter-spacing: -0.03em;
}

.invoice-create-fieldset {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
}

.invoice-create-scroll {
  min-width: 0;
  min-height: 0;
  padding: 0 20px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.invoice-create-section {
  display: grid;
  min-width: 0;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.invoice-create-section:last-child {
  border-bottom: 0;
}

.invoice-create-section h3 {
  color: var(--text);
  font-size: 20px;
  font-weight: 730;
  letter-spacing: -0.018em;
  line-height: 1.25;
}

.invoice-create-section__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
}

.invoice-create-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-create-tabs .button {
  min-height: 42px;
  padding-inline: 17px;
}

.invoice-create-tabs .button--active,
.invoice-create-tabs .button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--border-strong) 58%, var(--text));
  background: color-mix(in srgb, var(--surface-hover) 72%, var(--text-soft));
  color: var(--text);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent) inset;
}

.invoice-party-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  min-width: 0;
  gap: 13px;
}

.invoice-party-fields > .field {
  grid-column: span 6;
}

.invoice-party-fields > .invoice-party-company {
  grid-column: 1 / -1;
}

.invoice-party-fields > .field:nth-of-type(6),
.invoice-party-fields > .field:nth-of-type(7) {
  grid-column: span 5;
}

.invoice-party-fields > .invoice-party-zipcode {
  grid-column: span 2;
}

.invoice-party-search,
.invoice-party-selection {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.invoice-party-search-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.invoice-party-search-results {
  display: grid;
  max-height: 242px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
}

.invoice-party-search-results > .muted {
  padding: 13px;
  font-size: 12px;
}

.invoice-party-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  gap: 14px;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.invoice-party-result:last-child {
  border-bottom: 0;
}

.invoice-party-result:hover,
.invoice-party-result:focus-visible {
  background: var(--surface-hover);
}

.invoice-party-result > span,
.invoice-party-card > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.invoice-party-result strong,
.invoice-party-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-party-result small,
.invoice-party-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-party-result > svg {
  color: var(--muted);
}

.invoice-party-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--green-soft) 56%, var(--surface-inset));
}

.invoice-create-grid {
  display: grid;
  min-width: 0;
  gap: 13px;
}

.invoice-create-grid--details {
  grid-template-columns: minmax(180px, 0.72fr) repeat(2, minmax(180px, 1fr));
}

.invoice-create-grid--notes {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invoice-lines-editor {
  gap: 13px;
  padding-bottom: 20px;
}

.invoice-lines-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  scrollbar-gutter: stable;
}

.invoice-lines-grid {
  display: grid;
  grid-template-columns: minmax(230px, 1.75fr) 90px 140px 90px minmax(190px, 1.25fr) minmax(160px, 1fr) 38px;
  align-items: center;
  min-width: 1010px;
  gap: 10px;
}

.invoice-lines-header {
  min-height: 42px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 44%, var(--surface-inset));
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.invoice-line-row {
  min-height: 62px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}

.invoice-line-row:last-child {
  border-bottom: 0;
}

.invoice-line-row label {
  display: block;
  min-width: 0;
}

.invoice-line-row :where(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: 0;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.invoice-line-row :where(input, select):hover {
  border-color: color-mix(in srgb, var(--border-strong) 72%, var(--text));
}

.invoice-line-row :where(input, select):focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.invoice-line-remove {
  width: 34px;
  height: 34px;
  min-height: 34px;
  color: var(--muted);
}

.invoice-line-remove:not(:disabled):hover {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.invoice-create-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 70px;
  gap: 9px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -10px 30px color-mix(in srgb, var(--canvas) 16%, transparent);
}

.invoice-create-footer .button {
  min-height: 44px;
  padding-inline: 18px;
}

.invoice-form-error {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .invoice-heading-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .invoice-create-dialog {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
  }

  .invoice-create-header {
    min-height: 60px;
    padding: 13px 14px;
  }

  .invoice-create-scroll {
    padding-inline: 14px;
  }

  .invoice-create-section {
    padding-block: 17px;
  }

  .invoice-create-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .invoice-create-tabs .button {
    width: 100%;
    padding-inline: 10px;
  }

  .invoice-party-fields > .field,
  .invoice-party-fields > .field:nth-of-type(6),
  .invoice-party-fields > .field:nth-of-type(7),
  .invoice-party-fields > .invoice-party-company,
  .invoice-party-fields > .invoice-party-zipcode {
    grid-column: 1 / -1;
  }

  .invoice-create-grid--details,
  .invoice-create-grid--notes {
    grid-template-columns: minmax(0, 1fr);
  }

  .invoice-lines-grid {
    min-width: 930px;
  }

  .invoice-create-footer {
    min-height: 64px;
    padding: 10px 14px;
  }
}

@media (max-width: 430px) {
  .invoice-heading-actions .button {
    flex: 1 1 auto;
  }

  .invoice-create-section__heading {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-create-section__heading .button {
    width: 100%;
  }

  .invoice-create-footer .button {
    flex: 1 1 0;
    padding-inline: 10px;
  }
}

/* Helper utilities */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.muted {
  color: var(--muted) !important;
}

.mono {
  font-family: var(--font-mono) !important;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-success {
  color: var(--green) !important;
}

.text-warning {
  color: var(--amber) !important;
}

.text-danger {
  color: var(--red) !important;
}

[hidden] {
  display: none !important;
}

[aria-busy="true"] {
  cursor: progress;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes invoice-panel-in {
  from {
    opacity: 0.72;
    transform: translateX(24px);
  }
}

@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.985);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loading-track {
  0% {
    left: -42%;
  }
  55%,
  100% {
    left: 106%;
  }
}

/* Compact labelled rail */

@media (max-width: 1180px) and (min-width: 721px) {
  :root {
    --sidebar-width: 76px;
  }

  .sidebar {
    padding-inline: 10px;
  }

  .sidebar__brand {
    justify-content: center;
    padding-inline: 0;
  }

  .brand-copy,
  .sidebar__scope > span:last-child,
  .nav-item__copy,
  .profile-button__copy,
  .profile-button > svg {
    display: none;
  }

  .sidebar__scope {
    justify-content: center;
    min-height: 44px;
    margin-inline: 0;
    padding: 8px;
  }

  .nav-item {
    justify-content: center;
    min-height: 48px;
    padding: 7px;
  }

  .nav-item__icon {
    width: 32px;
  }

  .profile-button {
    justify-content: center;
    padding: 6px;
  }

  .metrics-grid,
  .metric-grid,
  .summary-grid,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics-grid > :last-child:nth-child(odd),
  .metric-grid > :last-child:nth-child(odd),
  .summary-grid > :last-child:nth-child(odd),
  .kpi-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .filter-panel,
  .filter-bar,
  .toolbar-panel {
    align-items: stretch;
  }

  .filter-actions,
  .toolbar-actions {
    justify-content: flex-end;
    flex: 1 1 100%;
  }

  .invoice-toolbar,
  .revenue-grid,
  .billing-summary {
    grid-template-columns: 1fr;
  }

  .invoice-toolbar .search-field,
  .invoice-toolbar .search-box {
    grid-column: 1 / -1;
  }

  .outstanding-card {
    min-height: auto;
  }

  .top-users-chart {
    --top-users-label-width: 128px;
  }

}

/* Mobile navigation drawer */

@media (max-width: 720px) {
  :root {
    --sidebar-width: 0px;
    --topbar-height: 60px;
    --page-gutter: 14px;
  }

  .app-shell {
    display: block;
  }

  app-sidebar {
    position: fixed;
    z-index: 100;
    inset: 0;
    width: auto;
    height: auto;
    pointer-events: none;
  }

  .sidebar {
    position: relative;
    z-index: 2;
    width: min(310px, 86vw);
    padding: 14px;
    border-right: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    transform: translateX(-104%);
    transition: transform 220ms cubic-bezier(0.2, 0.75, 0.25, 1);
  }

  app-sidebar.is-open {
    pointer-events: auto;
  }

  app-sidebar.is-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(4, 5, 4, 0.72);
    opacity: 0;
    transition: opacity 220ms ease;
  }

  app-sidebar.is-open .sidebar-scrim {
    opacity: 1;
  }

  .icon-button.sidebar__close {
    display: inline-grid;
  }

  .app-stage {
    min-height: calc(100dvh - 8px);
    margin: 4px;
    border-radius: 17px;
  }

  .icon-button.topbar__menu {
    display: inline-grid;
  }

  .connection-pill {
    display: none;
  }

  .page-stage {
    padding-top: 17px;
  }

  .page-view,
  .view-shell,
  .dashboard-view,
  .page-content {
    gap: 14px;
  }

  .page-header,
  .page-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .page-heading:has(.page-refresh) > div:first-child {
    padding-right: 48px;
  }

  .page-refresh {
    position: absolute;
    top: -4px;
    right: 0;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .page-heading__meta {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .filter-grid,
  .filters-grid,
  .metrics-grid,
  .metric-grid,
  .summary-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .filter-panel > .field,
  .filter-panel > .field--small,
  .filter-panel > .field--wide,
  .filter-panel > .field--grow,
  .logs-filters > .field,
  .logs-filters > .field--small,
  .logs-filters > .field--wide,
  .invoice-filters > .field--select,
  .invoice-filters > .field--grow {
    flex: 1 1 100%;
  }

  .filter-actions,
  .toolbar-actions {
    width: 100%;
  }

  .metrics-grid > :last-child:nth-child(odd),
  .metric-grid > :last-child:nth-child(odd),
  .summary-grid > :last-child:nth-child(odd),
  .kpi-grid > :last-child:nth-child(odd) {
    grid-column: auto;
  }

  .metric-card,
  .kpi-card {
    min-height: 116px;
  }

  .chart-card,
  .chart-panel {
    min-height: 280px;
    padding: 14px;
  }

  .chart-wrap,
  .chart-container,
  .chart-canvas,
  .chart-wrap svg,
  .chart-container > svg,
  .chart-svg {
    min-height: 210px;
  }

  .table-scroll,
  .table-wrap,
  .data-table-wrap {
    border-radius: inherit;
  }

  table,
  .data-table {
    min-width: 680px;
  }

  th:first-child,
  td:first-child {
    position: sticky;
    z-index: 1;
    left: 0;
    background: var(--surface);
  }

  tbody tr:hover td:first-child {
    background: var(--surface-hover);
  }

  .users-toolbar,
  .list-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .user-row,
  .user-item {
    grid-template-columns: 32px minmax(0, 1fr);
    min-height: 92px;
    padding-inline: 12px;
  }

  .user-row__actions,
  .user-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .user-row__details,
  .user-row__id {
    grid-column: 2;
  }

  .switch-field {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  .switch-field__copy {
    justify-items: start;
  }

  .message-bubble,
  .chat-bubble,
  .message__bubble,
  .tool-event,
  .tool-card,
  .trace-card {
    max-width: 94%;
  }

  .advanced-filters {
    width: 100%;
  }

  .advanced-filters__body {
    grid-template-columns: 1fr;
  }

  .conversation-panel__header {
    align-items: stretch;
    flex-direction: column;
  }

  .panel__header,
  .panel__footer {
    flex-wrap: wrap;
  }

  .conversation-panel__tools {
    flex-wrap: wrap;
    width: 100%;
    margin-left: 0;
  }

  .conversation-tool--search {
    width: auto;
    flex: 1 1 180px;
  }

  .tool-call-list {
    max-width: 94%;
  }

  .conversation-panel,
  .chat-panel,
  .logs-panel,
  .log-panel {
    min-height: calc(100dvh - 190px);
  }

  .log-row__headline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .log-row__headline time {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .log-message {
    grid-column: 1 / -1;
    width: 100%;
  }

  .log-message__actions {
    opacity: 1;
  }

  .log-row__meta {
    padding-left: 0;
  }

  .log-details {
    max-width: 100%;
    margin-left: 0;
  }

  .activity-row,
  .activity-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .activity-row {
    grid-template-columns: 32px minmax(0, 1fr) minmax(86px, auto);
    column-gap: 10px;
    row-gap: 2px;
  }

  .activity-row__scope {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-items: end;
    text-align: right;
  }

  .top-users-panel,
  .user-trends-panel {
    padding: 14px;
  }

  .top-users-chart {
    --top-users-label-width: clamp(76px, 27vw, 112px);
  }

  .top-user-row,
  .top-user-axis {
    gap: 7px;
  }

  .top-user-label {
    font-size: 10px;
  }

  .user-trends-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .user-trend-row {
    grid-template-columns: minmax(0, 1fr) 72px auto;
    gap: 7px;
  }

  .trend-sparkline {
    width: 72px;
  }

  .activity-row__meta,
  .activity-item__meta {
    justify-items: start;
  }

  .state-panel {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .login-shell {
    padding: 72px 16px 28px;
  }

  .login-panel {
    min-height: auto;
  }

  .login-panel__theme {
    top: 16px;
    right: 16px;
  }

  .account-popover {
    top: 55px;
    right: 10px;
  }

  .dialog__footer,
  .modal__footer {
    flex-wrap: wrap;
  }

  .dialog__footer .button,
  .modal__footer .button {
    flex: 1 1 auto;
  }

  .invoice-detail-summary,
  .invoice-detail-meta {
    grid-template-columns: 1fr;
  }

  .invoice-detail-status {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-detail-status__controls {
    width: 100%;
    min-width: 0;
  }

  .invoice-detail-status__controls .button {
    width: 100%;
  }

  .invoice-table {
    min-width: 900px;
  }
}

@media (max-width: 430px) {
  .invoice-detail-dialog .dialog-card__header {
    align-items: flex-start;
  }

  .invoice-detail-header-actions .button {
    width: 40px;
    padding-inline: 0;
    gap: 0;
    font-size: 0;
  }

  .invoice-detail-header-actions .button .icon {
    flex: 0 0 auto;
    margin: auto;
  }

  .invoice-detail-status__controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .login-form {
    padding: 22px 19px;
  }

  .login-console__status {
    padding-inline: 5px;
  }

  .topbar__title span {
    display: none;
  }

  .topbar__actions {
    gap: 6px;
  }

  .theme-button,
  .avatar-button,
  .topbar .icon-button {
    width: 38px;
    height: 38px;
  }

  .filter-panel,
  .filter-bar,
  .toolbar-panel,
  .panel,
  .card,
  .surface-card,
  .dashboard-card {
    padding: 12px;
  }

  .users-panel,
  .logs-panel,
  .conversation-panel,
  .table-panel {
    padding: 0;
  }

  .filter-actions .button,
  .toolbar-actions .button,
  .page-actions .button {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  :root {
    color-scheme: light;
    --canvas: #ffffff;
    --stage: #ffffff;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-inset: #ffffff;
    --text: #161616;
    --text-soft: #303030;
    --muted: #555555;
    --border: #cccccc;
    --hairline: #dddddd;
  }

  app-sidebar,
  .topbar,
  .page-actions,
  .filter-actions,
  .toolbar-actions,
  .pagination,
  .pager {
    display: none !important;
  }

  .app-shell,
  .app-stage {
    display: block;
    min-height: auto;
    margin: 0;
    overflow: visible;
    border: 0;
    box-shadow: none;
  }

  .page-stage,
  .table-scroll,
  .conversation-scroll,
  .log-stream,
  .activity-list {
    overflow: visible;
  }
}

/* Invoice selection and bulk actions */
.invoice-bulk-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-border);
}

.invoice-bulk-toolbar > strong {
  font-variant-numeric: tabular-nums;
}

.invoice-bulk-toolbar .field {
  margin-left: auto;
}

.invoice-table .invoice-selection-cell {
  width: 56px;
  padding: 0 8px;
}

.invoice-select-control {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 44px;
  cursor: pointer;
}

.invoice-select-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.invoice-table [data-invoice-row] {
  cursor: pointer;
}

.invoice-table [data-invoice-row].is-selected {
  background: var(--accent-soft);
}

.invoice-table [data-invoice-row]:hover {
  background: var(--surface-hover);
}

.invoice-table [data-invoice-row]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

@media (max-width: 640px) {
  .invoice-bulk-toolbar .field {
    margin-left: 0;
    flex: 1 1 100%;
  }
}
