:root {
    color-scheme: light;
}

.dark {
    color-scheme: dark;
    --color-primary: #7ed1c5;
    --color-primary-strong: #98ded4;
    --color-primary-soft: #17302c;
    --color-page: #0c0e0d;
    --color-surface: #111413;
    --color-surface-raised: #171a19;
    --color-surface-muted: #1c201e;
    --color-text: #e9ecea;
    --color-text-secondary: #a7ada9;
    --color-text-muted: #747b77;
    --color-border: #282d2a;
    --color-border-strong: #363c38;
    --color-danger: #ff817a;
    --shadow-float: 0 18px 54px rgba(0, 0, 0, 0.34);
    --shadow-menu: 0 10px 30px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--color-page);
}

body {
    margin: 0;
    background: var(--color-page);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

button,
a {
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

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

.app-shell {
    min-height: 100dvh;
}

.page-column {
    min-height: 100dvh;
    background: var(--color-surface);
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.login-card {
    background: var(--color-surface);
}

.field-input {
    width: 100%;
    min-height: 44px;
    appearance: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--color-surface-muted);
    color: var(--color-text);
    line-height: 1.4;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.field-input::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

.field-input:hover {
    border-color: var(--color-border-strong);
}

.field-input:focus {
    border-color: var(--color-primary);
    background: var(--color-surface);
    outline: none;
}

.field-input:disabled,
button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

select.field-input[multiple] {
    padding: 6px;
}

select.field-input[multiple] option {
    padding: 8px;
}

.primary-button,
.secondary-button {
    border: 0;
    cursor: pointer;
    transition: filter 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.primary-button {
    background: var(--color-primary);
    color: #fff;
}

.secondary-button {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.primary-button:hover,
.secondary-button:hover {
    filter: brightness(0.97);
}

.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 84px;
    z-index: 90;
    max-width: min(360px, calc(100vw - 36px));
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-raised);
    color: var(--color-text);
    box-shadow: var(--shadow-menu);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

html.is-booting {
    overflow: hidden;
}

html.is-booting::before,
html.is-booting::after {
    position: fixed;
    z-index: 10000;
    content: "";
}

html.is-booting::before {
    inset: 0;
    background: var(--color-page);
}

html.is-booting::after {
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 2px solid var(--color-border-strong);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: relations-spin 700ms linear infinite;
}

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

@media (min-width: 681px) {
    .page-column,
    header,
    nav[data-primary-nav] {
        border-right: 1px solid var(--color-border);
        border-left: 1px solid var(--color-border);
    }
}

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