/* The Way — minimal, futuristic. Dark by default. */
:root {
  --bg: #07080b;
  --bg-2: #0c0e13;
  --surface: #11141a;
  --surface-2: #171b23;
  --line: #1f2430;
  --line-2: #2a3140;
  --text: #eef1f6;
  --muted: #8b93a5;
  --faint: #5a6273;
  --lime: #c6ff3d;
  --cyan: #3cf0ff;
  --accent: var(--lime);
  --accent-ink: #0a0c05;
  --danger: #ff5d6c;
  --warn: #ffb547;
  --ok: #4ade80;
  --grad: linear-gradient(120deg, var(--cyan), var(--lime));
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 60px -30px rgba(0, 0, 0, .8);
  --font: "Space Grotesk", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-2: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --line: #e3e6ec;
  --line-2: #d3d8e1;
  --text: #0b0d12;
  --muted: #5b6474;
  --faint: #8a93a3;
  --lime: #6fa300;
  --cyan: #0098b0;
  --accent: #0b0d12;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(10, 12, 20, .05), 0 12px 40px -24px rgba(10, 12, 20, .25);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 var(--font); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
[dir="rtl"] body, body[dir="rtl"] { font-family: var(--font-ar); }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--lime); color: #000; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hidden { display: none !important; }

/* grid backdrop */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(60, 240, 255, .10), transparent 60%),
    radial-gradient(700px 500px at 0% 10%, rgba(198, 255, 61, .07), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
}
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; opacity: .35;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 10%, transparent 70%);
}
:root[data-theme="light"] .backdrop::after { opacity: .6; }

/* layout */
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.wordmark { direction: ltr; unicode-bidi: isolate; font-family: "Space Grotesk", sans-serif; font-size: 19px; letter-spacing: -.03em; font-weight: 500; }
.wordmark b { font-weight: 700; }
.wordmark i { font-style: normal; color: var(--lime); }
.spacer { flex: 1; }
.nav { display: flex; gap: 6px; align-items: center; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text); text-decoration: none; cursor: pointer;
  font-weight: 500; font-size: 14px; white-space: nowrap; transition: .15s ease;
}
.btn:hover { border-color: var(--muted); background: var(--surface); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.lg { height: 50px; padding: 0 24px; font-size: 15px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* cards & surfaces */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow);
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; color: var(--muted);
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.eyebrow { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; color: var(--muted); }

/* forms */
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--faint); }
.input, .textarea, .select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; outline: none; transition: .15s; font-size: 15px;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 18%, transparent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 999px; cursor: pointer; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--surface-2); color: var(--text); }

.toast {
  position: fixed; inset-inline: 0; bottom: 24px; margin: auto; width: max-content; max-width: calc(100% - 32px);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 16px;
  z-index: 100; box-shadow: var(--shadow); font-size: 14px;
}
.toast.err { border-color: var(--danger); }

/* spinner */
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--lime); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001s !important; transition: none !important; } }
[dir="rtl"] .eyebrow { letter-spacing: 0; font-family: var(--font-ar); }
