/* Страница входа в стиле дашборда роя: токены Hive из DESIGN.md
   (apps/ui/src/styles/globals.css), шрифты — локальные копии apps/ui/public/fonts. */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/space-grotesk-normal-300-700-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/space-grotesk-normal-300-700-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/manrope-normal-300-700-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/manrope-normal-300-700-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/space-mono-normal-400-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/jetbrains-mono-normal-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Hive dark — тема дашборда по умолчанию. */
:root {
  color-scheme: dark;
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885);
  --card-foreground: oklch(0.985 0 0);
  --primary: oklch(0.769 0.188 70.08);
  --primary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --accent: oklch(0.274 0.006 286.033);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --input-fill: oklch(1 0 0 / 4.5%);
  --ring: oklch(0.769 0.188 70.08);
  --radius-md: 0.5rem;
  --radius-lg: 0.625rem;
  --font-sans: "Space Grotesk", sans-serif;
  --font-mono: "Space Mono", monospace;
  --snappy: cubic-bezier(0.2, 0, 0, 1);
}

/* Hive light — если в дашборде выбрана светлая тема (agent-swarm-mode). */
:root.light {
  color-scheme: light;
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.555 0.163 48.998);
  --primary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.943 0.003 286.375);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --input-fill: transparent;
  --ring: oklch(0.555 0.163 48.998);
}

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

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

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* main.flex.min-h-svh.items-center.justify-center.bg-background.p-6 */
main {
  display: flex;
  min-height: 100svh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* Card: w-full max-w-md, rounded-xl, border, shadow-sm, py-6, gap-6 */
.card {
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 0;
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 3px 0 rgb(0 0 0 / 0.1),
    0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.card-header,
.card-content,
.card-footer {
  padding: 0 1.5rem;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* mb-2 flex size-10 items-center justify-center rounded-lg border bg-muted */
/* Шапка как в сайдбаре дашборда: логотип и название организации (цвет — SWARM_BRAND_COLOR). */
.brand-row {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}
.brand-name {
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--foreground);
}
.brand.org {
  border: 0;
  background: none;
}
.brand.org img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
}
.brand {
  flex-shrink: 0;
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--muted);
}

.brand img {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  text-wrap: balance;
}

.card-description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-wrap: pretty;
}

.card-content form,
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
}

/* Input: h-9 rounded-md border bg-transparent px-3 py-1 shadow-xs, dark:bg-input/30 */
input[type="text"],
input[type="password"] {
  width: 100%;
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--foreground);
  background: var(--input-fill);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  outline: none;
  transition:
    border-color 150ms var(--snappy),
    box-shadow 150ms var(--snappy);
}

input::placeholder {
  color: var(--muted-foreground);
}

input:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

/* Автозаполнение браузера красит поле своим цветом (в Chrome — синим): оставляем цвета темы. */
input:-webkit-autofill {
  -webkit-text-fill-color: var(--foreground);
  caret-color: var(--foreground);
  box-shadow: 0 0 0 1000px color-mix(in oklab, var(--card), white 4.5%) inset;
  transition: background-color 600000s 0s;
}
input:-webkit-autofill:focus-visible {
  box-shadow:
    0 0 0 1000px color-mix(in oklab, var(--card), white 4.5%) inset,
    0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}
:root.light input:-webkit-autofill {
  box-shadow: 0 0 0 1000px var(--card) inset;
}
:root.light input:-webkit-autofill:focus-visible {
  box-shadow:
    0 0 0 1000px var(--card) inset,
    0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

input[aria-invalid="true"] {
  border-color: var(--destructive);
}

input.code {
  height: 2.75rem;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  letter-spacing: 0.5em;
  text-align: center;
  padding-left: calc(0.75rem + 0.25em);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted-foreground);
  cursor: pointer;
}

.check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
}

/* Button default: h-9 px-4 rounded-md bg-primary text-primary-foreground font-medium */
.button {
  display: inline-flex;
  width: 100%;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary-foreground);
  background: var(--primary);
  border: 0;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition:
    opacity 200ms var(--snappy),
    transform 200ms var(--snappy);
}

.button:hover {
  opacity: 0.9;
}

.button:active {
  transform: scale(0.98);
  transition-duration: 100ms;
}

.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.button[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.button.outline {
  color: var(--foreground);
  background: transparent;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.button.outline:hover {
  opacity: 1;
  background: var(--accent);
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

.error {
  margin: 0;
  font-size: 0.875rem;
  color: var(--destructive);
}

.hint {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted-foreground);
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
}

a.link {
  color: var(--muted-foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.link:hover {
  color: var(--foreground);
}

.footnote {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-align: center;
}

/* Атрибут hidden сильнее display у .stack, .button и форм: специфичность (0,2,0). */
.card [hidden] {
  display: none;
}
