/* Tuliplink — shared foundation */
:root {
  --bg: #07080b;
  --bg-soft: #0a0c11;
  --surface: #0f1218;
  --surface-2: #151922;
  --surface-3: #1c2130;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --brand: #2f6bff;
  --accent: #2f6bff;
  --accent-bright: color-mix(in srgb, var(--accent) 62%, white);
  --accent-deep: color-mix(in srgb, var(--accent) 68%, black);
  --accent-ink: #ffffff;
  --accent-text: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --ink: #f4f6fa;
  --muted: #9aa3b3;
  --faint: #626b7c;
  --ok: #5fd39a;
  --danger: #f07a6d;
  --display: "DM Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  --maxw: 1160px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

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

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

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: #fff;
}

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

.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;
}

.hidden,
[hidden] {
  display: none !important;
}

.brandmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.brandmark-mark {
  width: 27px;
  height: 27px;
  flex: none;
}

.brandmark-word {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
}

.brandmark-word .bm-link {
  color: var(--brand);
}

.brandmark-mark .bm-dot {
  fill: var(--brand);
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--accent-text);
  font-weight: 500;
}

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

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.02em;
}

/* ---------- buttons ---------- */
.btn {
  --btn-bg: transparent;
  --btn-border: var(--line-strong);
  --btn-ink: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    transform 0.15s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--accent-text);
  color: var(--accent-bright);
}

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

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

.btn-accent {
  --btn-bg: var(--accent);
  --btn-border: var(--accent);
  --btn-ink: var(--accent-ink);
  font-weight: 600;
}

.btn-accent:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: var(--accent-ink);
}

.btn-ghost {
  min-height: 38px;
  padding: 0 14px;
  border-color: var(--line);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 13px;
}

.btn-ghost:hover {
  color: var(--ink);
}

.btn-sm {
  min-height: 34px;
  padding: 0 13px;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  --btn-border: color-mix(in srgb, var(--danger) 50%, transparent);
  --btn-ink: var(--danger);
}

.btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.icon-btn:hover {
  color: var(--accent-text);
  border-color: var(--line-strong);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.field > span,
.field > label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.field .help {
  font-size: 11.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--faint);
  line-height: 1.45;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-text);
  background: #0b0e15;
}

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

textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 1px),
    calc(100% - 12px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-error {
  color: var(--danger);
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.form-success {
  color: var(--ok);
  font-size: 12.5px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  appearance: none;
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex: none;
}

.check input:checked {
  background: var(--accent);
  border-color: var(--accent-text);
}

.check input:checked::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.8px solid var(--accent-ink);
  border-bottom: 1.8px solid var(--accent-ink);
  transform: rotate(-45deg) translate(0.5px, -1px);
}

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--accent-text);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}

.badge-solid {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent-text);
  font-weight: 600;
}

/* ---------- dialog ---------- */
dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(4, 5, 8, 0.74);
  backdrop-filter: blur(3px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.1;
}

.dialog-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  max-height: calc(86vh - 150px);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.dialog-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  padding: 4px 6px;
}

.dialog-close:hover {
  color: var(--accent-text);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 90;
  transform: translate(-50%, 16px);
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(21, 25, 34, 0.97);
  color: var(--ink);
  font-size: 13px;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(8px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
  color: #ffd8d3;
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: #2a3040;
  border-radius: 99px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: #3a4256;
}

@media (max-width: 560px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
