*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  color: var(--text-1);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text-0); }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

::selection { background: var(--brand-1); color: white; }

/* Scrollbars (Firefox + WebKit) */
* { 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: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* Icons inside buttons/links should inherit colour and stay aligned. */
i.fas, i.far, i.fa-solid, i.fa-regular { line-height: 1; display: inline-block; }
.btn i.fas, .btn i.far, .btn i.fa-solid, .btn i.fa-regular { font-size: 13px; }
.btn--icon i.fas, .btn--icon i.far, .btn--icon i.fa-solid, .btn--icon i.fa-regular { font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-2);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: var(--fs-md);
  transition: all var(--t-fast);
  background: var(--bg-3);
  color: var(--text-0);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-4); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--brand-1);
  color: white;
  box-shadow: 0 4px 14px rgba(255, 90, 54, .35);
}
.btn--primary:hover { background: var(--brand-1-h); color: white; }
.btn--ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--text-1);
}
.btn--ghost:hover { background: var(--bg-2); }
.btn--ai {
  background: var(--gradient-ai);
  color: white;
  border: 0;
}
.btn--icon {
  padding: 7px;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--text-2);
}
.btn--icon:hover { background: var(--bg-3); color: var(--text-0); }

.input, .select, .textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-2);
  color: var(--text-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
  font: inherit;
  outline: none;
  color-scheme: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-1) 22%, transparent);
}

.kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--text-2);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-3);
  color: var(--text-2);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 500;
}
.tag--ai { background: var(--gradient-ai); color: white; }
.tag--ok { background: rgba(0, 212, 168, .15); color: var(--brand-3); }
.tag--warn { background: rgba(255, 180, 59, .15); color: var(--brand-warn); }
.tag--err { background: rgba(255, 88, 118, .15); color: var(--brand-error); }

/* Layout helpers */
.row { display: flex; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.grow { flex: 1; }

.section-title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  font-weight: 600;
  padding: 6px 12px;
}
