:root,
:host {
  --color-bg: #f4f4f5;
  --color-surface: #ffffff;
  --color-text: #111111;
  --color-text-muted: #525252;
  --color-border: #e4e4e7;
  --color-button: #111111;
  --color-button-text: #ffffff;
  --color-user-bubble: #111111;
  --color-user-bubble-text: #ffffff;
  --color-focus: #111111;
  --font-size: 16px;
  --font-small: 13px;
  --font-title: 20px;
  --radius-card: 12px;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 6%);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-body: 14px;
  --font-small: 12px;
  --font-menu: 14px;
  --font-title: 22px;
  --font-section: 16px;
  --font-kpi: 22px;
  --font-table: 12px;
  --icon-size: 16px;
  --touch-min: 44px;
  --sidebar-width: 220px;
  --line: 1.5;
}

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

html {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-body);
  line-height: var(--line);
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
}

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

a {
  color: inherit;
}

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

.shell {
  --sidebar-bg: #f2f2f2;
  --sidebar-active: #e7e7e7;
  --tabs-top: 60px;
  --color-focus: #005fcc;
  background: var(--color-surface);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--color-border);
  bottom: 0;
  display: flex;
  flex-direction: column;
  left: 0;
  max-width: 100%;
  position: fixed;
  top: 0;
  transform: translateX(-100%);
  visibility: hidden;
  width: min(var(--sidebar-width), 100%);
  z-index: 4;
}

.sidebar.is-open {
  box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--color-text) 40%, transparent);
  transform: none;
  visibility: visible;
}

.nav-close {
  margin: 0 var(--space-3) var(--space-2);
}

.brand {
  align-items: center;
  display: flex;
  font-weight: 650;
  gap: var(--space-2);
  min-height: var(--touch-min);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
}

.nav-label {
  color: var(--color-text-muted);
  display: none;
  font-size: var(--font-small);
  letter-spacing: 0.04em;
  margin: var(--space-4) 0 var(--space-1);
  padding: 0 var(--space-3);
  text-transform: uppercase;
}

.nav-list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0 var(--space-2) var(--space-4);
}

.sidebar.is-open .nav-label,
.sidebar.is-open .nav-list {
  display: block;
}

.nav-list li + li {
  margin-top: 4px;
}

.nav-list a {
  align-items: center;
  border-radius: 999px;
  display: flex;
  font-size: var(--font-menu);
  gap: var(--space-2);
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
}

.nav-list a:hover,
.nav-list a[aria-current="page"] {
  background: var(--sidebar-active);
}

.nav-list a[aria-current="page"] {
  font-weight: 650;
}

.icon {
  flex: 0 0 auto;
  height: var(--icon-size);
  width: var(--icon-size);
}

.topbar {
  align-items: center;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-2);
  min-height: 60px;
  padding: var(--space-2) var(--space-3);
  position: sticky;
  top: 0;
  z-index: 3;
}

.account {
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  padding: var(--space-2);
  position: relative;
}

button.account-button {
  background: transparent;
  border-color: transparent;
  color: var(--color-text);
  gap: var(--space-2);
  justify-content: flex-start;
  padding: var(--space-2);
  text-align: left;
  width: 100%;
}

button.account-button:hover {
  background: var(--sidebar-active);
}

.avatar {
  align-items: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  display: inline-flex;
  flex: none;
  font-size: var(--font-small);
  font-weight: 650;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.account-copy {
  display: grid;
  flex: 1;
  line-height: 1.3;
  min-width: 0;
}

.account-name,
.account-copy .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy .muted {
  font-size: var(--font-small);
}

.account-chevron {
  flex: none;
  opacity: 0.6;
}

.account-menu {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  bottom: calc(100% + 8px);
  box-shadow: 0 8px 28px rgb(17 17 17 / 18%);
  display: grid;
  left: var(--space-2);
  max-height: calc(100dvh - 84px);
  overflow-y: auto;
  padding: var(--space-2);
  position: absolute;
  right: var(--space-2);
  z-index: 6;
}

.account-menu[hidden] {
  display: none;
}

.account-id {
  display: grid;
  margin: var(--space-2) var(--space-3) var(--space-1);
}

.account-lang {
  padding: 0 var(--space-2) var(--space-2);
}

.account-lang div {
  background: var(--color-bg);
  border-radius: 999px;
  display: flex;
  gap: 2px;
  padding: 2px;
}

.account-lang button {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
  flex: 1;
  min-height: 32px;
  padding: 0 var(--space-3);
}

.account-lang button[aria-pressed="true"] {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
  font-weight: 650;
}

.account-menu a,
.account-menu button[role="menuitem"] {
  align-items: center;
  background: transparent;
  border-color: transparent;
  color: var(--color-text);
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  font-weight: 500;
  gap: var(--space-3);
  justify-content: flex-start;
  min-height: 36px;
  padding: 0 var(--space-3);
  text-decoration: none;
  width: 100%;
}

.account-menu form {
  margin: 0;
}

.account-menu a:hover,
.account-menu button[role="menuitem"]:hover,
.account-menu a:focus-visible,
.account-menu button[role="menuitem"]:focus-visible {
  background: var(--color-bg);
}

.account-menu :focus-visible {
  outline-offset: -3px;
}

.account-menu hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-1) var(--space-2);
}

.content {
  min-width: 0;
  padding: var(--space-4);
}

.sheet {
  max-width: none;
}

label.field:has(:required) > span:first-child::after,
.field.required > span:first-child::after {
  color: var(--color-required, #d92d20);
  content: " *";
}

.card,
.sheet-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-5);
  padding: var(--space-5);
}

.sheet-card .form-section + .form-section,
.sheet-card > form + form {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
}

.form-section > h2 {
  margin-bottom: var(--space-4);
}

h1,
h2 {
  font-size: var(--font-title);
  font-weight: 650;
  line-height: var(--line);
  margin: 0 0 var(--space-4);
}

h2 {
  font-size: var(--font-section);
}

p {
  margin: 0 0 var(--space-4);
}

.muted {
  color: var(--color-text-muted);
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.button,
button,
.topbar a.button {
  align-items: center;
  background: var(--color-button);
  border: 1px solid var(--color-button);
  border-radius: var(--radius-card);
  color: var(--color-button-text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  justify-content: center;
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
}

.button.secondary,
button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.button.destructive,
button.destructive {
  background: var(--color-surface);
  border-color: var(--color-text);
  color: var(--color-text);
  font-weight: 700;
}

.page-actions {
  margin-bottom: var(--space-4);
}

.page-actions .spacer {
  flex: 1;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--font-kpi);
  line-height: 1.2;
  margin: var(--space-2) 0;
}

.form-grid {
  display: grid;
  align-items: start;
  gap: var(--space-4) var(--space-5);
}

.form-grid > button,
.form-grid > .button,
.card > form > button,
.card > button,
.form-section > button {
  justify-self: start;
  margin-top: var(--space-2);
  width: auto;
}

.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.actions h1 {
  margin: 0;
}

label.field {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.form-grid > .field,
.grid > label.field {
  min-width: 0;
}

.form-grid > .field {
  margin: 0;
}

label.field > span:first-child {
  font-weight: 600;
  line-height: 1.4;
}

label.field input[type="file"]::file-selector-button {
  background: var(--color-bg);
  border: 0;
  border-radius: var(--space-1);
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  margin-inline-end: var(--space-2);
  padding: var(--space-1) var(--space-2);
}

label.field > .muted {
  font-size: var(--font-small);
  font-weight: 400;
  line-height: 1.4;
}

input,
select,
textarea {
  accent-color: var(--color-button);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  color: var(--color-text);
  font: inherit;
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-3);
  width: 100%;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input[data-secret],
textarea[data-secret] {
  background: var(--color-surface);
}

.picker {
  position: relative;
  width: 100%;
}

.picker-native {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  left: 0;
  min-height: 0;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  position: absolute;
  bottom: 0;
  width: 1px;
}

.picker-trigger {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-weight: 400;
  gap: var(--space-2);
  justify-content: space-between;
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.picker-trigger:hover {
  background: var(--color-surface);
  border-color: #d0d5dd;
}

.picker-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.picker-trigger::after {
  border-bottom: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  content: "";
  flex: none;
  height: 7px;
  margin: -4px 2px 0 0;
  opacity: 0.5;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  width: 7px;
}

.picker-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker.is-empty .picker-value {
  color: var(--color-text-muted);
}

.picker.is-open .picker-trigger {
  border-color: var(--color-text-muted);
  box-shadow: 0 0 0 3px rgb(16 24 40 / 6%);
}

.picker.is-open .picker-trigger::after {
  margin-top: 4px;
  transform: rotate(-135deg);
}

.picker.is-invalid .picker-trigger {
  border-color: #fda29b;
  box-shadow: 0 0 0 3px rgb(240 68 56 / 10%);
}

.picker-list {
  animation: picker-in 0.12s ease-out;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgb(16 24 40 / 14%), 0 2px 6px rgb(16 24 40 / 6%);
  display: grid;
  gap: 2px;
  left: 0;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
}

.picker-list[hidden] {
  display: none;
}

.picker-search {
  background: var(--color-surface);
  border-radius: 9px;
  margin-bottom: 4px;
  min-height: 36px;
  padding: 6px 10px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.picker-option {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-weight: 400;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 12px;
  text-align: left;
  width: 100%;
}

.picker-option[hidden] {
  display: none;
}

.picker-option:hover,
.picker-option:focus-visible {
  background: var(--color-bg, #f4f4f5);
  outline: none;
}

.picker-option:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.picker-option[aria-selected="true"] {
  font-weight: 600;
}

.picker-option[aria-selected="true"]::after {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  flex: none;
  height: 10px;
  margin-right: 4px;
  transform: rotate(45deg) translateY(-2px);
  width: 5px;
}

.picker-empty {
  color: var(--color-text-muted);
  margin: 0;
  padding: 8px 12px;
}

@keyframes picker-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.error {
  color: var(--color-text);
  font-weight: 650;
}

input[type="file"],
.color-pair input {
  min-width: 0;
}

.color-pair {
  display: flex;
  gap: var(--space-2);
}

.color-pair input[type="color"] {
  flex: 0 0 var(--touch-min);
  padding: var(--space-1);
  width: var(--touch-min);
}

.widget-preview {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  color: var(--color-text);
  font-size: var(--font-size);
  margin-bottom: var(--space-4);
  max-width: 320px;
  padding: var(--space-3);
}

.widget-preview .preview-bar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  margin: calc(var(--space-3) * -1) calc(var(--space-3) * -1) var(--space-3);
  padding: var(--space-3);
}

.widget-preview .preview-name {
  font-size: var(--font-size, var(--font-title));
}

.widget-preview .preview-user,
.widget-preview .preview-assistant {
  border-radius: var(--radius-card);
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
}

.widget-preview .preview-launcher {
  align-items: center;
  background: var(--color-launcher, var(--color-button));
  border-radius: 50%;
  color: var(--color-launcher-text, var(--color-button-text));
  display: inline-flex;
  font-weight: 600;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.widget-preview .preview-user {
  background: var(--color-user-bubble);
  color: var(--color-user-bubble-text);
  margin-left: var(--space-5);
}

.widget-preview .preview-assistant {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: var(--font-small, var(--font-table));
  margin-right: var(--space-5);
}

.editor.is-invalid {
  box-shadow: inset 0 0 0 2px var(--color-required, #d92d20);
}

.page-head {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.page-head h1,
.page-head p {
  margin: 0;
}

.page-head .muted {
  margin-top: var(--space-1);
}

.page-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
}

.page-actions-main {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.page-actions-danger {
  margin-left: var(--space-3);
  padding-left: var(--space-3);
  border-left: 1px solid var(--color-border);
}

.page-actions form,
.button-row form {
  display: flex;
}

.button-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.save-bar {
  display: none;
}

.page-notice,
.form-banner {
  align-items: center;
  border: 1px solid;
  border-radius: var(--radius-card);
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.page-notice {
  --notice-icon: url("/static/vendor/lucide/circle-check.svg");
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}

.page-notice.is-danger,
.form-banner {
  --notice-icon: url("/static/vendor/lucide/circle-alert.svg");
  background: #fef3f2;
  border-color: #fecdca;
  color: #b42318;
}

.page-notice.is-info {
  --notice-icon: url("/static/vendor/lucide/info.svg");
  background: #eff8ff;
  border-color: #b2ddff;
  color: #175cd3;
}

.page-notice[hidden],
.form-banner[hidden] {
  display: none;
}

.page-notice::before,
.form-banner::before {
  background: currentColor;
  content: "";
  flex: none;
  height: 18px;
  mask: var(--notice-icon) center / contain no-repeat;
  width: 18px;
}

.page-notice p,
.form-banner p {
  margin: 0;
}

.form-banner p {
  font-weight: 650;
}

.page-notice .icon-button {
  color: inherit;
  margin-inline-start: auto;
  min-height: 32px;
  min-width: 32px;
}

.page-notice .icon-button::before {
  background: currentColor;
  content: "";
  height: 16px;
  mask: url("/static/vendor/lucide/x.svg") center / contain no-repeat;
  width: 16px;
}

.side-tool {
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-card);
  margin-top: var(--space-4);
}

.side-tool summary {
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--font-small);
  font-weight: 600;
  padding: var(--space-3) var(--space-4);
}

.side-tool form,
.side-tool #test-result {
  padding: 0 var(--space-4) var(--space-4);
}

.side-tool .field {
  margin-bottom: var(--space-3);
}

.scope-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.scope-tags .badge {
  white-space: normal;
  overflow-wrap: anywhere;
}

.badge {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: var(--font-small);
  font-weight: 600;
  gap: var(--space-1);
  line-height: 1;
  padding: 5px 10px;
  white-space: nowrap;
}

.badge.is-success {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}

.badge.is-info {
  background: #eff8ff;
  border-color: #b2ddff;
  color: #175cd3;
}

.badge.is-danger {
  background: #fef3f2;
  border-color: #fecdca;
  color: #b42318;
}

.badge.is-neutral {
  background: #f4f4f5;
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

.content,
td,
th,
p {
  overflow-wrap: break-word;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--color-text-muted);
  font-size: var(--font-table);
  font-weight: 500;
}

tbody tr {
  min-height: 42px;
}

td.num,
th.num {
  font-family: var(--font-mono);
  text-align: right;
}

td.num:first-child,
th.num:first-child {
  text-align: left;
  white-space: nowrap;
  width: 1%;
}

.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

td.row-actions,
th.row-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

td.row-select,
th.row-select {
  width: 1%;
}

.bulk-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-bottom: 12px;
}

.row-select input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
}

.tabs {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-1);
  height: var(--touch-min);
  margin: 0 0 var(--space-5);
  overflow-x: auto;
  position: sticky;
  top: var(--tabs-top);
  z-index: 2;
}

.tabs a[hidden] {
  display: none;
}

.tabs a {
  align-items: center;
  background: transparent;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--color-text-muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 600;
  height: var(--touch-min);
  padding: 0 var(--space-3);
  text-decoration: none;
  white-space: nowrap;
}

.tabs a:focus-visible {
  outline-offset: -3px;
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--color-text);
  color: var(--color-text);
}

.dialog {
  background: color-mix(in srgb, var(--color-text) 40%, transparent);
  inset: 0;
  position: fixed;
  z-index: 5;
}

.dialog[hidden] {
  display: none;
}

.dialog .card {
  margin: var(--space-6) auto;
  max-width: 520px;
}

.editor {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  height: 200px;
  margin-bottom: 0;
  overflow: auto;
  width: 100%;
}

.status {
  font-weight: 650;
}

.login {
  margin: var(--space-6) auto;
  max-width: 420px;
}

.login-step-heading {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 1.125rem;
}

.login-code,
.login-code.is-enhanced {
  position: relative;
  display: block;
}

.login-code.is-enhanced input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: text;
}

.login-code-slots {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
}

.login-code-slots > span {
  display: grid;
  place-items: center;
  min-height: 3rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.login-code:focus-within .is-current {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.login-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.login-back {
  margin-inline-start: auto;
  color: #6b6b70;
  font-size: var(--font-small);
  text-decoration: none;
}

.login-back:hover {
  color: var(--color-text);
}

.login-language {
  display: flex;
  justify-content: center;
  margin-top: var(--space-5);
}

.login-recovery {
  margin-top: var(--space-4);
}

.login-recovery summary {
  cursor: pointer;
}

.login-recovery form {
  margin-top: var(--space-3);
}

.qr {
  display: flex;
  justify-content: center;
  margin: var(--space-3) 0;
}

.qr svg {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
  display: block;
  height: auto;
  max-width: 220px;
  padding: 8px;
  width: 100%;
}

@media (max-width: 1023px) {
  .save-bar {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    bottom: 0;
    display: flex;
    margin: 0 calc(var(--space-4) * -1);
    padding: var(--space-3) var(--space-4);
    position: sticky;
    z-index: 2;
  }

  .primary-save {
    display: none;
  }

  table.stack thead {
    display: none;
  }

  table.stack.has-bulk-selection thead {
    display: block;
  }

  table.has-bulk-selection thead tr {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding-block: 0;
  }

  table.has-bulk-selection thead th:not(.row-select) {
    display: none;
  }

  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack td {
    display: block;
    width: 100%;
  }

  table.stack tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-3);
    padding: var(--space-3);
  }

  table.stack td {
    display: flex;
    gap: var(--space-3);
    justify-content: space-between;
    padding: var(--space-2) 0;
  }

  table.stack td::before {
    color: var(--color-text-muted);
    content: attr(data-label);
    flex: 1 1 auto;
    min-width: 0;
  }
}

@media (max-width: 719px) {
  .shell {
    overflow-x: hidden;
  }

  #nav-collapse {
    display: none;
  }

}

@media (min-width: 720px) {
  .shell {
    --tabs-top: 0px;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .sidebar {
    border-bottom: 0;
    box-shadow: none;
    align-self: start;
    height: 100vh;
    height: 100dvh;
    position: sticky;
    top: 0;
    transform: none;
    visibility: visible;
    width: auto;
  }

  .topbar,
  .nav-close {
    display: none;
  }

  .nav-label,
  .nav-list {
    display: block;
  }

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

  .form-grid .wide {
    grid-column: 1 / -1;
  }

  .content {
    padding: var(--space-6);
  }

  .grid.stats {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .shell.is-collapsed {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .shell.is-collapsed .sidebar-search span,
  .shell.is-collapsed .nav-label,
  .shell.is-collapsed .brand span,
  .shell.is-collapsed .nav-list span,
  .shell.is-collapsed .account-copy,
  .shell.is-collapsed .account-chevron,
  .shell.is-collapsed .brand {
    display: none;
  }

  .shell.is-collapsed .account-menu {
    bottom: 0;
    left: calc(100% + 8px);
    right: auto;
    width: 240px;
  }

  .shell.is-collapsed button.account-button {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .shell.is-collapsed .brand-row {
    justify-content: center;
    padding: var(--space-3) 0 var(--space-2);
  }

  .shell.is-collapsed .sidebar-search {
    justify-content: center;
    padding-inline: 0;
  }

}

@media (min-width: 1024px) {
  :root {
    --touch-min: 36px;
  }

  .grid.stats {
    grid-template-columns: repeat(5, 1fr);
  }
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.sidebar-scroll::-webkit-scrollbar {
  display: none;
}

.sidebar-top {
  flex: none;
}

.brand-row {
  align-items: flex-start;
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
  padding: var(--space-3) var(--space-3) var(--space-2) 0;
}

.brand {
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  min-width: 0;
  padding-right: 0;
}

.brand-logo {
  display: block;
  max-height: 48px;
  max-width: 100%;
  object-fit: contain;
}

.brand-name {
  overflow-wrap: anywhere;
}

.brand.has-logo .brand-name {
  color: var(--color-text-muted);
  font-size: var(--font-small);
  font-weight: 500;
}

.nav-toggle {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  flex: none;
  height: 32px;
  justify-content: center;
  min-height: 32px;
  padding: 0;
  transition: background-color 0.15s ease;
  width: 32px;
}

.nav-toggle:hover {
  background: var(--color-bg);
}

.nav-toggle .icon {
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.login-brand {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
}

.login-logo {
  max-height: 64px;
  max-width: 240px;
  object-fit: contain;
}

.logo-preview img {
  background: var(--color-bg);
  border-radius: var(--radius-card);
  max-height: 64px;
  max-width: 240px;
  object-fit: contain;
  padding: var(--space-2);
}


[data-pane] {
  scroll-margin-top: calc(var(--tabs-top) + var(--touch-min) + var(--space-2));
}

.settings-card {
  max-width: 660px;
}

.settings-card:not(:has([data-pane]:not([hidden]))),
.search-rules-card:not([hidden]) + .settings-company-brand {
  display: none;
}

.search-rules-card {
  max-width: 1200px;
  padding: 0;
}

.search-rules-panel {
  min-width: 0;
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
}

.search-rules-panel legend {
  padding: 0 var(--space-2);
  font-weight: 650;
}

.search-rules-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
}

.search-rules-panel pre {
  overflow: auto;
}

.settings-card [data-pane]:not([hidden]) ~ [data-pane]:not([hidden]) {
  margin-top: var(--space-4);
}

.narrow {
  max-width: 480px;
}

.field.is-invalid input,
.field.is-invalid textarea,
.field.is-invalid select,
.field.is-invalid .picker-trigger {
  border-color: var(--color-required, #d92d20);
  box-shadow: inset 0 0 0 1px var(--color-required, #d92d20);
}

.field.is-hidden,
.form-section.is-hidden,
.check.is-hidden {
  display: none;
}

.field-error {
  align-items: flex-start;
  color: var(--color-required, #d92d20);
  display: flex;
  font-size: var(--font-small);
  font-weight: 500;
  gap: var(--space-2);
  line-height: 1.4;
  margin: 0;
}

.field-error img {
  flex: none;
  margin-top: 2px;
}

.add-row {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.add-row .field {
  flex: 1 1 160px;
  margin: 0;
  min-width: 140px;
}

.add-row .check {
  margin: 0 0 10px;
}

.add-row > button {
  flex: 0 0 auto;
}

.member-list,
.search-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.member-list > li {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--space-2);
  padding: var(--space-3);
}

.member-row {
  align-items: center;
  display: flex;
  gap: var(--space-3);
}

.member-row[hidden] {
  display: none;
}

.member-copy {
  flex: 1;
  min-width: 0;
}

.member-copy p {
  margin: 0;
}

.member-review {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
}

button.ghost,
.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
  font-weight: 500;
  min-height: 32px;
  padding: 0 var(--space-3);
}

button.ghost:hover,
.button.ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

button.icon-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
  min-height: 32px;
  min-width: 32px;
  padding: 0;
  width: 32px;
}

button.icon-ghost:hover {
  background: transparent;
  color: var(--color-required, #d92d20);
}

.empty-line {
  margin: 0;
}

.narrow .form-grid {
  grid-template-columns: 1fr;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--font-table);
}

.status {
  align-items: center;
  display: inline-flex;
  font-weight: 450;
  gap: var(--space-2);
}

.dot {
  background: var(--color-text);
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.dot.is-hollow {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--color-text);
}

.icon-button {
  background: transparent;
  border-color: transparent;
  color: var(--color-text);
  min-width: var(--touch-min);
  padding: 0;
}

.period-filter {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-3);
}

.segment {
  background: color-mix(in srgb, var(--color-text) 8%, var(--color-surface));
  border-radius: 999px;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
}

.segment a {
  align-items: center;
  border-radius: inherit;
  color: var(--color-text-muted);
  display: inline-flex;
  font-weight: 600;
  min-height: 28px;
  padding: 0 var(--space-3);
  text-decoration: none;
}

.segment a:hover,
.segment a[aria-current="page"] {
  color: var(--color-text);
}

.segment a[aria-current="page"] {
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.dashboard {
  --dashboard-blue: #2563d4;
  --dashboard-green: #16824d;
  --dashboard-red: #ce3c3c;
  --dashboard-accent: var(--dashboard-blue);
}

.dashboard-green {
  --dashboard-accent: var(--dashboard-green);
}

.dashboard-red {
  --dashboard-accent: var(--dashboard-red);
}

.dashboard .stat {
  display: grid;
  grid-template-rows: 1fr auto auto;
  min-width: 0;
  padding: var(--space-4);
}

.dashboard-label {
  align-items: center;
  display: flex;
  gap: var(--space-2);
}

.stat .dashboard-label {
  color: var(--color-text-muted);
}

.dashboard-icon {
  align-items: center;
  background: color-mix(in srgb, var(--dashboard-accent) 9%, var(--color-surface));
  border-radius: var(--space-2);
  display: inline-flex;
  flex: none;
  height: var(--space-6);
  justify-content: center;
  width: var(--space-6);
}

.dashboard .stat-value {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  margin: var(--space-3) 0 var(--space-2);
  overflow-wrap: anywhere;
}

.spark {
  border-bottom: 1px solid var(--color-border);
  display: block;
  height: 34px;
  width: 100%;
}

.spark polyline {
  fill: none;
  stroke: var(--dashboard-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.bar-row,
.budget-line {
  align-items: center;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: var(--space-2);
}

.bar,
.budget-track {
  background: color-mix(in srgb, var(--dashboard-accent) 9%, var(--color-surface));
  border-radius: 999px;
  grid-column: 1 / -1;
  grid-row: 2;
  height: 8px;
  overflow: hidden;
}

.bar span,
.budget-track span {
  background: var(--dashboard-accent);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.budget-track .has-spend {
  min-width: 3px;
}

.dashboard-warning {
  color: var(--dashboard-red);
}

@media (min-width: 550px) {
  .bar-row,
  .budget-line {
    grid-template-columns: minmax(88px, auto) minmax(0, 1fr) auto;
  }

  .bar,
  .budget-track {
    grid-column: auto;
    grid-row: auto;
  }
}

label.field input[type="checkbox"],
label.check input[type="checkbox"] {
  appearance: none;
  background:
    radial-gradient(circle at 10px 50%, #fff 0 7px, transparent 7.5px),
    #d4d4d8;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  flex: none;
  height: 20px;
  margin: 0;
  min-height: 20px;
  padding: 0;
  transition: background-color 0.15s ease;
  width: 34px;
}

label.field input[type="checkbox"]:hover,
label.check input[type="checkbox"]:hover {
  background-color: #c4c4c9;
}

label.field input[type="checkbox"]:checked,
label.check input[type="checkbox"]:checked {
  background:
    radial-gradient(circle at 24px 50%, #fff 0 7px, transparent 7.5px),
    #2f6feb;
}

label.field input[type="checkbox"]:focus-visible,
label.check input[type="checkbox"]:focus-visible {
  outline: 2px solid #2f6feb;
  outline-offset: 2px;
}

label.check {
  align-items: center;
  display: inline-flex;
  gap: var(--space-2);
}

.field.checks {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.check-grid {
  display: grid;
  gap: var(--space-2) var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.filters {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.filters > .field {
  margin: 0;
}

.filters input {
  max-width: 280px;
}

button.danger,
.button.danger {
  background: var(--color-surface);
  border-color: var(--color-text);
  color: var(--color-text);
  font-weight: 700;
}

button.danger:hover,
.button.danger:hover {
  background: var(--color-bg);
}

.report {
  background: var(--color-success-bg, #ecfdf3);
  border: 1px solid var(--color-success-border, #abefc6);
  border-radius: var(--radius-card);
  color: var(--color-success-text, #067647);
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
}


.sidebar-search {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-muted);
  gap: var(--space-2);
  justify-content: flex-start;
  margin: 0 var(--space-2) var(--space-2);
  padding-inline: var(--space-3);
  width: calc(100% - 2 * var(--space-2));
}


.search-dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  color: var(--color-text);
  max-height: min(75dvh, 520px);
  padding: 0;
  width: min(680px, calc(100% - 2 * var(--space-4)));
}

.search-dialog::backdrop {
  background: rgb(0 0 0 / 32%);
}

.search {
  align-items: center;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  position: sticky;
  top: 0;
}

.search input {
  flex: 1;
  min-width: 0;
}

.search-results {
  padding: var(--space-3);
}

.search-links a {
  align-items: center;
  border-radius: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2);
  text-decoration: none;
}

.search-links a:hover,
.resource-link:hover {
  background: var(--color-bg);
}

.dashboard-resources {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.dashboard-resources .card {
  margin-bottom: 0;
}

.dashboard-resources h2 {
  margin-bottom: var(--space-2);
}

.dashboard-conversations h2 a {
  text-decoration: none;
}

.dashboard-conversations h2 a:hover {
  text-decoration: underline;
}

.resource-link {
  align-content: start;
  display: grid;
  gap: var(--space-2);
  text-decoration: none;
}

.dashboard-conversations time {
  margin-left: auto;
}

.list-card {
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

@media (min-width: 1024px) {
  table.stack thead {
    background: var(--color-bg);
  }

  table.stack tbody tr + tr td {
    border-top: 1px solid var(--color-border);
  }

  table.stack tbody tr:hover {
    background: color-mix(in srgb, var(--color-bg) 50%, var(--color-surface));
  }

  .dashboard-resources {
    grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 2fr);
  }

  .dashboard-resources.without-connections {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
}

@media (max-width: 1023px) {
  .list-card {
    border: 0;
  }
}

.search-rules-layout {
  display: grid;
  grid-template-columns: minmax(200px, 245px) minmax(0, 1fr);
}

.search-rules-sidebar {
  padding: var(--space-4) var(--space-3);
  border-inline-end: 1px solid var(--color-border);
}

.search-rules-navigation summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}

.search-rules-navigation summary::-webkit-details-marker {
  display: none;
}

.search-rules-navigation summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.search-rules-navigation[open] summary::after {
  transform: rotate(225deg);
}

.search-rules-nav {
  display: grid;
  gap: 6px;
}

.search-rules-content {
  min-width: 0;
  padding: var(--space-5);
}

.search-rules-header,
.search-rule-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.search-rules-header :is(h2, p) {
  margin-bottom: var(--space-1);
}

.search-rules-nav button,
.search-rules-card .search-rule-delete {
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid transparent;
  min-height: 36px;
  padding: var(--space-1) var(--space-2);
}

.search-rules-nav button {
  width: 100%;
  color: var(--color-text);
  justify-content: flex-start;
  text-align: start;
  padding-inline: var(--space-3);
}

.search-rules-nav button[aria-pressed="false"]:hover {
  background: var(--color-bg);
}

.search-rules-nav button[aria-pressed="true"] {
  background: var(--sidebar-active);
  font-weight: 400;
}

.search-rules-nav button:focus-visible {
  outline-offset: -2px;
}

.search-rule-group {
  margin-bottom: var(--space-4);
}

.search-rule-group-head h3 {
  font-size: var(--font-body);
  margin: 0;
}

.search-rule-options {
  margin-bottom: var(--space-2);
}
.search-rule-options summary {
  color: var(--color-text-muted);
  cursor: pointer;
}
.search-rule-options[open] summary {
  margin-bottom: var(--space-2);
}

.search-rule-table-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow-x: auto;
}

.search-rule-table {
  width: 100%;
  min-width: 340px;
}

.search-rule-table th {
  background: var(--color-bg);
}

.search-rule-table :is(th, td) {
  padding: var(--space-2) var(--space-3);
}

.search-rule-table td :is(input:not([type="checkbox"]), select) {
  width: 100%;
  min-width: 0;
  min-height: 34px;
}

.search-rule-table :is(.search-entry-state, .search-entry-actions) {
  width: 1%;
  white-space: nowrap;
  text-align: center;
}

input.search-entry-switch {
  appearance: none;
  display: inline-grid;
  align-items: center;
  width: 34px;
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-border);
  vertical-align: middle;
  cursor: pointer;
}

input.search-entry-switch::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

input.search-entry-switch:checked {
  background: var(--color-button);
  border-color: var(--color-button);
}

input.search-entry-switch:checked::before {
  justify-self: end;
  background: var(--color-button-text);
}

input.search-entry-switch:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.search-rules-card .search-rule-delete {
  color: var(--color-danger, #a12c2c);
  padding-inline: 0;
  text-decoration: underline;
}

.search-rule-group-footer {
  margin-top: var(--space-2);
}

.search-rules-card [hidden] {
  display: none;
}

@media (max-width: 780px) {
  .search-rules-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-rules-sidebar {
    border-inline-end: 0;
    border-bottom: 1px solid var(--color-border);
  }

}

.search-rules-grid > .field {
  min-width: 0;
}

.search-rules-grid :is(input, select) {
  min-width: 0;
  max-width: 100%;
}

.search-rules-preview-grid {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.search-rules-preview-grid .picker,
.search-rules-preview-grid .picker-trigger {
  width: 100%;
  min-width: 0;
}

@media (max-width: 600px) {
  .search-rules-preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.search-rule-help {
  color: var(--color-text-muted);
  font-size: var(--font-small);
}

.search-rule-help ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  list-style: none;
  padding: 0;
}


.sidebar-product-name {
  flex: none;
  margin: 0;
  padding: 12px 16px 16px;
  color: #cccccc;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.shell.is-collapsed .sidebar-product-name {
  display: none;
}
