:root {
  /* brand */
  --orange: #f49d2b;
  --orange-hover: #e0881a;
  --orange-active: #c86a12;
  --on-orange: #1a1a1e;
  --white: #ffffff;

  /* dark surfaces */
  --bg: #0b0b0d;
  --bg-1: #101013;
  --bg-2: #15151a;
  --bg-3: #1b1b21;
  --bg-4: #23232b;
  --line: #26262e;
  --line-soft: #1e1e25;

  /* text */
  --text: #ececf1;
  --text-dim: #a4a4b0;
  --text-mute: #71717f;

  /* state */
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 18px 50px -12px rgb(0 0 0 / 0.7);
  --shadow-sm: 0 4px 14px -4px rgb(0 0 0 / 0.5);

  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

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

/*
 * The `hidden` attribute must win over every component `display` rule below.
 * Without this, invisible panels (modal backdrop, drawers, buttons) keep their
 * box and swallow clicks meant for the UI underneath.
 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.55;
}

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

a {
  color: var(--orange);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

::selection {
  background: color-mix(in srgb, var(--orange) 40%, transparent);
}

/* ------------------------------------------------------------------ */
/* scrollbars                                                          */
/* ------------------------------------------------------------------ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-4) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: #33333f;
  background-clip: content-box;
}

/* ------------------------------------------------------------------ */
/* buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  --btn-bg: var(--bg-3);
  --btn-fg: var(--text);
  --btn-line: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 550;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    transform 0.08s ease,
    opacity 0.14s ease;
  user-select: none;
}
.btn:hover:not(:disabled) {
  background: var(--bg-4);
  border-color: #33333f;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.btn-primary {
  --btn-bg: var(--orange);
  --btn-fg: var(--on-orange);
  --btn-line: transparent;
  font-weight: 650;
}
.btn-primary:hover:not(:disabled) {
  background: var(--orange-hover);
  border-color: transparent;
}
.btn-primary:active:not(:disabled) {
  background: var(--orange-active);
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-line: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-3);
  color: var(--text);
  border-color: transparent;
}

.btn-danger {
  --btn-bg: transparent;
  --btn-line: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border-color: var(--danger);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 7px;
}
.btn-icon {
  width: 38px;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 30px;
}

/* ------------------------------------------------------------------ */
/* form controls                                                       */
/* ------------------------------------------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > label,
.label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.hint {
  font-size: 12.5px;
  color: var(--text-mute);
  line-height: 1.5;
}

.input,
.textarea,
.select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  outline: none;
  transition:
    border-color 0.14s ease,
    box-shadow 0.14s ease;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 22%, transparent);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-mute);
}
.textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.6;
  font-family: inherit;
}
.textarea.mono {
  font-family: var(--mono);
  font-size: 13px;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2371717f' d='M1.4 1.7 6 6.3l4.6-4.6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
.select option {
  background: var(--bg-2);
  color: var(--text);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .track {
  width: 40px;
  height: 23px;
  border-radius: 99px;
  background: var(--bg-4);
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.16s ease;
  flex: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  inset: 2px auto 2px 2px;
  width: 17px;
  border-radius: 99px;
  background: var(--text-dim);
  transition:
    transform 0.16s ease,
    background 0.16s ease;
}
.switch input:checked + .track {
  background: var(--orange);
  border-color: transparent;
}
.switch input:checked + .track::after {
  transform: translateX(17px);
  background: var(--on-orange);
}
.switch input:focus-visible + .track {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  transition:
    background 0.14s ease,
    color 0.14s ease;
}
.segmented button:hover {
  color: var(--text);
}
.segmented button[aria-pressed="true"] {
  background: var(--orange);
  color: var(--on-orange);
  font-weight: 650;
}

/* ------------------------------------------------------------------ */
/* badges + misc                                                       */
/* ------------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}
.badge-warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}
.badge-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.badge-info {
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 35%, transparent);
  background: color-mix(in srgb, var(--info) 12%, transparent);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: currentColor;
  flex: none;
}
.dot-pulse {
  animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 99px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  flex: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

code,
pre,
kbd {
  font-family: var(--mono);
}
kbd {
  font-size: 11px;
  padding: 1.5px 5px;
  border-radius: 5px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  color: var(--text-dim);
}