/* Fraus tokens. Every colour below resolves from one of these; add new ones as a light and dark pair. */
:root {
  --base-primary: #009db2;
  --base-primary-hover: #00778a;
  --base-primary-border: #005d6e;
  --base-primary-foreground: #ffffff;
  --base-foreground: #040d23;
  --base-muted-foreground: #5e7171;
  --base-card: #ffffff;
  --base-sidebar-background: #f3f7f7;
  --base-muted: #f3f7f7;
  --base-border: #e7eeee;
  --base-input-border: #d3dfdf;
  --base-ring: #00e8f5;
  --base-focus: #00f8fe;
  --switch-off: #d3dfdf;
  --status-success: #14b8a6;
  --status-warning: #f97316;
  --status-danger: #ef4444;
  --status-destructive: #e11d48;
  --status-success-text: #0b7d71;
  --status-warning-text: #b84d06;
  --status-danger-text: #c42626;
  --tint-alpha: 9%;
  --title-from: #040d23;
  --title-to: #009db2;
  --code-key: #00778a;
  --code-string: #0b7d71;
  --code-number: #b84d06;
  --code-literal: #7c3aed;
  --shadow-panel: 0 1px 2px rgba(4, 13, 35, 0.04), 0 8px 24px rgba(4, 13, 35, 0.05);
  --shadow-lift: 0 6px 18px rgba(4, 13, 35, 0.08);
  --shadow-pop: 0 20px 25px -5px rgba(4, 13, 35, 0.12), 0 8px 10px -6px rgba(4, 13, 35, 0.08);
  --backdrop: rgba(0, 11, 13, 0.55);
}

:root.dark {
  --base-primary: #00c4d8;
  --base-primary-hover: #00e8f5;
  --base-primary-border: #00e8f5;
  --base-primary-foreground: #000618;
  --base-foreground: #e9f5f7;
  --base-muted-foreground: #8ea6b3;
  --base-card: #001229;
  --base-sidebar-background: #000618;
  --base-muted: #021a36;
  --base-border: rgba(0, 232, 245, 0.14);
  --base-input-border: rgba(0, 232, 245, 0.26);
  --base-ring: #00f8fe;
  --base-focus: #00f8fe;
  --switch-off: rgba(255, 255, 255, 0.12);
  --status-destructive: #fb7185;
  --status-success-text: #4fe0cf;
  --status-warning-text: #ffa35c;
  --status-danger-text: #ff8a8a;
  --tint-alpha: 30%;
  --title-from: #ffffff;
  --title-to: #00c4d8;
  --code-key: #5fe3f0;
  --code-string: #7ef0c8;
  --code-number: #ffb27a;
  --code-literal: #c4a8ff;
  --shadow-panel: 0 0 0 1px rgba(0, 232, 245, 0.06), 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-lift: 0 0 22px rgba(0, 232, 245, 0.14);
  --shadow-pop: 0 0 0 1px rgba(0, 232, 245, 0.1), 0 20px 40px rgba(0, 0, 0, 0.6);
  --backdrop: rgba(0, 3, 12, 0.7);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--base-sidebar-background);
  color: var(--base-foreground);
  font: 400 14px/1.5 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--base-primary);
}

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

.muted {
  color: var(--base-muted-foreground);
}

.small {
  font-size: 13px;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* Icons: lucide paths injected by app.js into [data-icon] */
[data-icon] {
  display: inline-flex;
  flex: none;
}

[data-icon] svg {
  width: 16px;
  height: 16px;
}

/* Shell: a floating panel over the rail-coloured page. */
.shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0 8px 8px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  flex: none;
  padding-inline: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--base-primary), var(--base-ring));
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: auto;
}

.panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--base-card);
  border: 1px solid var(--base-border);
  border-radius: 16px;
  box-shadow: var(--shadow-panel);
}

.panel > * + * {
  margin-top: 18px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
}

.title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(90deg, var(--title-from), var(--title-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
}

.page-head p {
  margin-top: 2px;
  font-size: 14px;
  max-width: 720px;
}

h2 {
  font-size: 17px;
  font-weight: 700;
}

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding-inline: 14px;
  border: 1px solid var(--base-input-border);
  border-radius: 8px;
  background: var(--base-card);
  color: var(--base-foreground);
  font: 600 14px/1 'Manrope', system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.btn:hover:not(:disabled) {
  background: var(--base-muted);
  border-color: var(--base-primary);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--base-primary);
  border-color: var(--base-primary-border);
  border-radius: 9px;
  color: var(--base-primary-foreground);
}

.btn-primary:hover:not(:disabled) {
  background: var(--base-primary-hover);
  border-color: var(--base-primary-border);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover:not(:disabled) {
  border-color: transparent;
}

.btn-danger {
  color: var(--status-danger-text);
}

.btn-danger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--status-danger) 50%, transparent);
  background: color-mix(in srgb, var(--status-danger) var(--tint-alpha), transparent);
}

.btn-destructive {
  background: var(--status-destructive);
  border-color: var(--status-destructive);
  color: #ffffff;
}

.btn-destructive:hover:not(:disabled) {
  background: var(--status-danger-text);
  border-color: var(--status-danger-text);
}

.btn-link {
  height: auto;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--base-primary);
  font-size: 13px;
}

.btn-link:hover:not(:disabled) {
  border: 0;
  background: none;
  text-decoration: underline;
}

.btn-link.btn-danger {
  color: var(--status-danger-text);
}

.btn-sm {
  height: 32px;
  padding-inline: 10px;
  font-size: 13px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
}

.btn-icon:not(.btn-ghost) {
  border-color: var(--base-border);
}

.btn {
  --spin-color: var(--base-foreground);
}

.btn-primary {
  --spin-color: var(--base-primary-foreground);
}

.btn.is-loading {
  color: transparent !important;
  cursor: wait;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--spin-color);
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span:first-child,
.field-head > span {
  font-weight: 600;
  font-size: 13px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-error {
  display: flex;
  gap: 6px;
  color: var(--status-danger-text);
  font-size: 13px;
  font-weight: 500;
}

.hint {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--base-primary) 35%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--base-primary) var(--tint-alpha), transparent);
  font-size: 13px;
}

input[type='text'],
input[type='url'],
input[type='number'],
input[type='password'],
input[type='search'],
select,
textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--base-input-border);
  border-radius: 8px;
  background: var(--base-card);
  color: var(--base-foreground);
  font: 400 14px/1.4 'Manrope', system-ui, sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--base-muted-foreground);
  opacity: 0.8;
}

textarea {
  height: auto;
  min-height: 132px;
  padding: 10px 12px;
  resize: vertical;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--base-primary);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--base-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--base-ring) 28%, transparent);
}

input:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[aria-invalid='true'] {
  border-color: var(--status-danger);
}

.input-unit {
  position: relative;
  display: block;
}

.input-unit input {
  padding-inline-end: 72px;
}

.input-unit em {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 12px;
  display: flex;
  align-items: center;
  color: var(--base-muted-foreground);
  font-size: 13px;
  font-style: normal;
  pointer-events: none;
}

/* Switch: a checkbox with role="switch" */
.switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  margin: 0;
  padding: 2px;
  border-radius: 999px;
  background: var(--switch-off);
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch::after {
  content: '';
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(4, 13, 35, 0.2);
  transition: transform 0.2s ease;
}

.switch:checked {
  background: var(--base-primary);
}

.switch:checked::after {
  transform: translateX(16px);
}

[dir='rtl'] .switch:checked::after {
  transform: translateX(-16px);
}

/* Segmented control with a sliding pointer */
.segmented {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--base-border);
  border-radius: 10px;
  background: var(--base-muted);
}

.segmented-full {
  display: flex;
}

.segmented-full button {
  flex: 1;
}

.seg-pointer {
  position: absolute;
  inset-block: 3px;
  left: 0;
  width: 0;
  border: 1px solid color-mix(in srgb, var(--base-primary) 35%, transparent);
  border-radius: 7px;
  background: var(--base-card);
  box-shadow: 0 0 0 2px rgba(0, 189, 203, 0.12);
  transition: left 0.3s ease, width 0.3s ease;
}

.segmented button {
  position: relative;
  height: 30px;
  padding-inline: 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--base-muted-foreground);
  font: 600 13px/1 'Manrope', system-ui, sans-serif;
  cursor: pointer;
  transition: color 0.2s ease;
}

.segmented-lg button {
  height: 34px;
  padding-inline: 16px;
  font-size: 14px;
}

.segmented button:hover,
.segmented button[aria-pressed='true'] {
  color: var(--base-foreground);
}

.segmented button[aria-pressed='true'] {
  color: var(--base-primary);
}

/* Stats strip: small, secondary to the work area */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.stats > div {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  height: 28px;
  padding: 5px 12px;
  border: 1px solid var(--base-border);
  border-radius: 999px;
  font-size: 12px;
}

.stats dt {
  color: var(--base-muted-foreground);
  font-weight: 600;
}

.stats dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stats .stat-success dd {
  color: var(--status-success-text);
}

.stats .stat-danger.has-value {
  border-color: color-mix(in srgb, var(--status-danger) 50%, transparent);
  background: color-mix(in srgb, var(--status-danger) var(--tint-alpha), transparent);
}

.stats .stat-danger.has-value dd {
  color: var(--status-danger-text);
}

/* Layout */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 1fr);
  gap: 20px;
  align-items: start;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.side > .card {
  flex: none;
}

.card {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--base-border);
  border-radius: 14px;
}

.card > * + * {
  margin-top: 14px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.card-head p {
  margin-top: 2px;
}

.card-head .end,
.toolbar .end {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: auto;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 160px;
  max-width: 260px;
}

.search [data-icon] {
  position: absolute;
  inset-inline-start: 12px;
  color: var(--base-muted-foreground);
  pointer-events: none;
}

.search input {
  height: 38px;
  padding-inline-start: 36px;
}

.row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.actions .end-btn {
  margin-inline-start: auto;
}

.dirty {
  color: var(--status-warning-text);
  font-size: 12px;
  font-weight: 600;
}

.stack > * + * {
  margin-top: 16px;
}

/* Alert list */
.list-legend {
  padding-inline: 6px;
  font-weight: 600;
  font-size: 12px;
}

.list-legend + .alert-list {
  margin-top: 6px;
}

.alert-list {
  display: flex;
  flex-direction: column;
}

.alert-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px;
  border-top: 1px solid var(--base-border);
  border-radius: 10px;
  transition: background 0.2s ease;
}

.alert-row:hover {
  background: var(--base-muted);
}

.alert-row:hover + .alert-row {
  border-top-color: transparent;
}

.alert-row .switch {
  margin-inline: 6px 8px;
}

.alert-row.is-off .alert-main {
  opacity: 0.5;
}

.alert-main {
  flex: 1;
  min-width: 0;
  transition: opacity 0.2s ease;
}

.alert-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.alert-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--base-muted-foreground);
}

.alert-meta .badge {
  height: 20px;
  padding-inline: 8px;
}

.alert-count {
  min-width: 52px;
  text-align: end;
  font-size: 12px;
  color: var(--base-muted-foreground);
  font-variant-numeric: tabular-nums;
}

.alert-count strong {
  display: block;
  font-size: 16px;
  color: var(--base-foreground);
}

.alert-count .failed {
  color: var(--status-danger-text);
}

.alert-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.alert-actions .btn-icon {
  width: 32px;
  height: 32px;
  color: var(--base-muted-foreground);
}

.alert-actions .btn-icon:hover:not(:disabled) {
  color: var(--base-primary);
}

.alert-actions .btn-send {
  margin-inline-start: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding-inline: 9px;
  border: 1px solid var(--base-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  color: var(--base-muted-foreground);
  white-space: nowrap;
}

.badge-primary {
  border-color: color-mix(in srgb, var(--base-primary) 45%, transparent);
  background: color-mix(in srgb, var(--base-primary) var(--tint-alpha), transparent);
  color: var(--base-primary);
}

.badge-success {
  border-color: color-mix(in srgb, var(--status-success) 50%, transparent);
  background: color-mix(in srgb, var(--status-success) var(--tint-alpha), transparent);
  color: var(--status-success-text);
}

.badge-warning {
  border-color: color-mix(in srgb, var(--status-warning) 50%, transparent);
  background: color-mix(in srgb, var(--status-warning) var(--tint-alpha), transparent);
  color: var(--status-warning-text);
}

.badge-danger {
  border-color: color-mix(in srgb, var(--status-danger) 50%, transparent);
  background: color-mix(in srgb, var(--status-danger) var(--tint-alpha), transparent);
  color: var(--status-danger-text);
}

.badge [data-icon] svg {
  width: 12px;
  height: 12px;
}

/* Header editor */
.header-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 8px;
}

.header-row .btn-icon {
  width: 44px;
  height: 44px;
  color: var(--base-muted-foreground);
}

.field > .btn-link {
  align-self: flex-start;
}

/* Advanced / collapsible sections */
details.advanced > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
}

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

details.advanced > summary [data-icon] {
  color: var(--base-muted-foreground);
  transform: rotate(-90deg);
  transition: transform 0.2s ease;
}

[dir='rtl'] details.advanced > summary [data-icon] {
  transform: rotate(90deg);
}

details.advanced[open] > summary [data-icon] {
  transform: none;
}

details.advanced[open] > summary {
  margin-bottom: 16px;
}

/* Auto-send */
.run-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--base-border);
  border-radius: 12px;
  background: var(--base-muted);
}

.run-box .btn {
  margin-inline-start: auto;
}

.run-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  font-size: 13px;
  font-weight: 600;
}

.dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--base-input-border);
}

.dot.is-on {
  background: var(--status-success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-success) 22%, transparent);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--status-success) 8%, transparent);
  }
}

/* Employees */
.email-add {
  display: flex;
  gap: 8px;
}

.email-add .btn {
  height: 44px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 136px;
  overflow-y: auto;
}

.chips:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  height: 30px;
  padding-inline: 12px 4px;
  border: 1px solid color-mix(in srgb, var(--base-primary) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--base-primary) var(--tint-alpha), transparent);
  font-size: 13px;
  font-weight: 500;
  animation: chip-in 0.2s ease;
}

.chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--base-muted-foreground);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chip button:hover {
  background: color-mix(in srgb, var(--status-danger) var(--tint-alpha), transparent);
  color: var(--status-danger-text);
}

.chip button svg {
  width: 14px;
  height: 14px;
}

@keyframes chip-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}

.chips-foot {
  display: flex;
  justify-content: flex-end;
}

/* Activity log */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 10px 12px;
  background: var(--base-muted);
  text-align: start;
  font-size: 12px;
  font-weight: 600;
  color: var(--base-muted-foreground);
  white-space: nowrap;
}

th:first-child {
  border-start-start-radius: 8px;
  border-end-start-radius: 8px;
}

th:last-child {
  border-start-end-radius: 8px;
  border-end-end-radius: 8px;
}

th.num-h,
td.num-h {
  text-align: end;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--base-border);
  white-space: nowrap;
}

td.wrap {
  white-space: normal;
  min-width: 220px;
  font-weight: 600;
}

tbody tr {
  cursor: pointer;
  transition: background 0.2s ease;
}

tbody tr:hover,
tbody tr:focus-visible {
  background: var(--base-muted);
}

tbody tr:focus-visible {
  outline-offset: -2px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 24px;
  border: 1px dashed var(--base-border);
  border-radius: 12px;
  text-align: center;
  color: var(--base-muted-foreground);
}

.empty strong {
  color: var(--base-foreground);
}

.empty em {
  font-style: normal;
  font-weight: 600;
  color: var(--base-foreground);
}

.empty-sm {
  flex-direction: row;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  font-size: 13px;
}

/* Dialogs */
dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--base-border);
  border-radius: 16px;
  background: var(--base-card);
  color: var(--base-foreground);
  box-shadow: var(--shadow-pop);
}

dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.2s ease;
}

dialog > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

dialog::backdrop {
  background: var(--backdrop);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

.dialog-sm {
  width: min(420px, calc(100vw - 32px));
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 0 24px;
}

.dialog-head > div {
  flex: 1;
  min-width: 0;
}

.dialog-head h2 {
  font-size: 18px;
}

.dialog-head p {
  margin-top: 2px;
}

.dialog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.dialog-meta .url {
  font: 12px ui-monospace, 'Cascadia Code', Consolas, monospace;
  color: var(--base-muted-foreground);
  overflow-wrap: anywhere;
}

.dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 24px 20px;
}

.dialog-body > * + * {
  margin-top: 16px;
}

.dialog-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--base-border);
}

.dialog-foot > p {
  flex: 1;
  min-width: 200px;
}

.dialog-foot .spacer {
  flex: 1;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.section-title .muted {
  font-weight: 500;
}

.dialog-body details.advanced > summary {
  font-size: 13px;
  font-weight: 700;
}

.dialog-body details.advanced[open] > summary {
  margin-bottom: 8px;
}

pre {
  margin: 8px 0 0;
  padding: 14px;
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--base-border);
  border-radius: 10px;
  background: var(--base-muted);
  font: 12.5px/1.6 ui-monospace, 'Cascadia Code', Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.json-key {
  color: var(--code-key);
}

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

.json-number {
  color: var(--code-number);
}

.json-literal {
  color: var(--code-literal);
}

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--base-muted);
  font: 0.92em ui-monospace, 'Cascadia Code', Consolas, monospace;
}

pre code {
  padding: 0;
  background: none;
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 16px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--base-border);
  border-radius: 10px;
  font: 12px/1.6 ui-monospace, 'Cascadia Code', Consolas, monospace;
}

.kv dt {
  color: var(--base-muted-foreground);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Confirm */
.confirm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 24px 20px;
  text-align: center;
}

.confirm-icon {
  justify-content: center;
  align-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border: 1px solid color-mix(in srgb, var(--status-destructive) 40%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--status-destructive) var(--tint-alpha), transparent);
  color: var(--status-destructive);
}

.confirm-icon svg {
  width: 26px;
  height: 26px;
}

#confirm .dialog-foot {
  justify-content: center;
}

#confirm .dialog-foot .btn {
  flex: 1;
}

/* Toasts */
.toasts {
  position: fixed;
  inset-block-start: 20px;
  inset-inline-end: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(370px, calc(100vw - 20px));
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 20px;
  overflow: hidden;
  border: 1px solid var(--base-border);
  border-radius: 10px;
  background: var(--base-card);
  box-shadow: var(--shadow-pop);
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 0.3s ease-out;
}

.toast::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 6px;
  background: var(--status-success);
}

.toast.is-error::before {
  background: var(--status-destructive);
}

.toast > [data-icon] {
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--status-success) 50%, transparent);
  border-radius: 50%;
  color: var(--status-success-text);
}

.toast.is-error > [data-icon] {
  border-color: color-mix(in srgb, var(--status-destructive) 50%, transparent);
  color: var(--status-destructive);
}

.toast-text {
  flex: 1;
  padding-top: 3px;
  overflow-wrap: anywhere;
}

.toast .btn-link {
  margin-top: 4px;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* Guide page */
.doc {
  max-width: 820px;
  margin-inline: auto;
  font-size: 15px;
  line-height: 1.65;
}

.doc > * + * {
  margin-top: 16px;
}

.doc h2 {
  margin-top: 32px;
  font-size: 22px;
}

.doc h3 {
  margin-top: 24px;
  font-size: 18px;
  font-weight: 600;
}

.doc ol,
.doc ul {
  margin: 0;
  padding-inline-start: 22px;
}

.doc li + li {
  margin-top: 6px;
}

.doc table {
  font-size: 14px;
}

.doc td {
  white-space: normal;
  vertical-align: top;
}

.doc tbody tr {
  cursor: default;
}

.doc tbody tr:hover {
  background: none;
}

.note {
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--base-primary) 40%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--base-primary) var(--tint-alpha), transparent);
}

/* Custom alert editor */
.editor-body {
  min-height: 300px;
  tab-size: 2;
}

#editor-start {
  height: 38px;
  font-size: 13px;
}

.placeholder-help code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
}

.placeholder-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px;
}

.placeholder-list button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--base-border);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.placeholder-list button:hover {
  border-color: var(--base-primary);
  background: var(--base-muted);
}

.placeholder-list code {
  color: var(--base-primary);
}

.placeholder-list span {
  color: var(--base-muted-foreground);
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

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

  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding-block: 12px;
  }
}

@media (max-width: 760px) {
  .panel {
    padding: 16px;
  }

  .title {
    font-size: 22px;
  }

  .topbar-end .btn-ghost {
    font-size: 0;
    gap: 0;
  }

  #variant {
    order: 3;
    width: 100%;
  }

  #variant button {
    flex: 1;
    padding-inline: 6px;
    font-size: 12px;
    line-height: 1.15;
  }

  .alert-row {
    flex-wrap: wrap;
  }

  .alert-main {
    flex-basis: calc(100% - 80px);
  }

  .alert-actions {
    margin-inline-start: auto;
  }

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

  .search {
    max-width: none;
  }

  .list-legend {
    display: none;
  }
}

.card > .email-add + p,
.card > #employee-error {
  margin-top: 8px;
}

/* Destination summary */
.url-peek {
  min-width: 0;
  margin-inline-start: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 12px ui-monospace, 'Cascadia Code', Consolas, monospace;
}

details[open] > summary .url-peek {
  display: none;
}

/* Auto-send fields side by side */
.sched-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sched-random:not([hidden]) {
  display: contents;
}

/* Wide screens: the work area fills the window; the alert list and the side column scroll inside it. */
@media (min-width: 1181px) and (min-height: 640px) {
  .grid {
    height: calc(100vh - 196px);
    min-height: 460px;
    align-items: stretch;
  }

  .grid > .card {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .grid > .card > .alert-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-inline-end: -10px;
    padding-inline-end: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--base-input-border) transparent;
  }

  .side {
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
    margin-inline-end: -10px;
    padding-inline-end: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--base-input-border) transparent;
  }
}
