/* ==========================================================================
   BLACK LIST - typography, tokens and base primitives
   ========================================================================== */

@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Space Grotesk";
    src: url("../fonts/SpaceGrotesk-latin.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #050506;
    --bg-elevated: #08080b;
    --surface: #0c0c10;
    --surface-2: #111116;
    --surface-3: #17171e;
    --surface-4: #1d1d25;
    --line: rgba(255, 255, 255, 0.072);
    --line-strong: rgba(255, 255, 255, 0.13);
    --line-red: rgba(225, 29, 46, 0.3);
    --red: #e11d2e;
    --red-hot: #ff3347;
    --red-deep: #8d0e1a;
    --red-soft: rgba(225, 29, 46, 0.12);
    --red-glow: rgba(225, 29, 46, 0.22);
    --text: #f5f3f6;
    --text-soft: #d5d1da;
    --muted: #918e9b;
    --muted-2: #686572;
    --green: #35d07f;
    --green-soft: rgba(53, 208, 127, 0.12);
    --amber: #f0aa3c;
    --amber-soft: rgba(240, 170, 60, 0.13);
    --blue: #7891ff;
    --blue-soft: rgba(120, 145, 255, 0.13);
    --purple: #b878ff;
    --purple-soft: rgba(184, 120, 255, 0.13);
    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 13px;
    --radius-sm: 9px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --display: "Space Grotesk", "Inter", "Segoe UI", sans-serif;
    --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.55);
    --shadow-md: 0 16px 42px rgba(0, 0, 0, 0.35);
    --shadow-red: 0 16px 42px rgba(225, 29, 46, 0.2);
    --header-h: 84px;
    --sidebar-w: 272px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(900px 480px at 8% -8%, rgba(225, 29, 46, 0.09), transparent 60%),
        radial-gradient(800px 480px at 92% 8%, rgba(90, 35, 50, 0.08), transparent 60%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 32%);
}

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

h1, h2, h3, h4 {
    font-family: var(--display);
    letter-spacing: -0.035em;
    font-weight: 600;
}

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

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

button {
    cursor: pointer;
}

img,
svg {
    display: block;
}

::selection {
    background: rgba(225, 29, 46, 0.42);
    color: #fff;
}

:focus-visible {
    outline: 2px solid rgba(255, 51, 71, 0.75);
    outline-offset: 3px;
}

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

::-webkit-scrollbar-track {
    background: #08080a;
}

::-webkit-scrollbar-thumb {
    background: #262630;
    border: 2px solid #08080a;
    border-radius: 999px;
}

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

.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.icon-sm {
    width: 15px;
    height: 15px;
}

.icon-lg {
    width: 22px;
    height: 22px;
}

.mono {
    font-family: var(--mono);
    font-variant-ligatures: none;
}

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

.text-green { color: var(--green); }
.text-red { color: var(--red-hot); }
.text-amber { color: var(--amber); }
.text-blue { color: var(--blue); }

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

/* Shared button primitives */
.btn {
    --btn-bg: var(--surface-2);
    --btn-border: var(--line);
    --btn-color: var(--text);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 17px;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius-sm);
    background: var(--btn-bg);
    color: var(--btn-color);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: transform 0.18s var(--ease), border-color 0.18s, background 0.18s, box-shadow 0.18s, color 0.18s;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.btn:active {
    transform: translateY(0);
}

.btn[disabled],
.btn.is-loading {
    pointer-events: none;
    opacity: 0.55;
}

.btn-primary {
    --btn-bg: linear-gradient(135deg, #f3263b 0%, #c51122 48%, #8f0d19 100%);
    --btn-border: rgba(255, 99, 115, 0.26);
    --btn-color: #fff;
    box-shadow: 0 8px 28px rgba(225, 29, 46, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-primary:hover {
    box-shadow: 0 12px 34px rgba(225, 29, 46, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 120, 135, 0.38);
}

.btn-ghost {
    --btn-bg: transparent;
    --btn-border: var(--line);
    --btn-color: var(--text-soft);
}

.btn-ghost:hover {
    --btn-bg: rgba(255, 255, 255, 0.035);
}

.btn-danger {
    --btn-bg: rgba(225, 29, 46, 0.1);
    --btn-border: rgba(225, 29, 46, 0.32);
    --btn-color: #ff8793;
}

.btn-danger:hover {
    --btn-bg: rgba(225, 29, 46, 0.17);
    --btn-border: rgba(225, 29, 46, 0.55);
}

.btn-sm {
    min-height: 32px;
    padding: 0 11px;
    border-radius: 8px;
    font-size: 11.5px;
}

.btn-icon {
    width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 8px;
}

.btn .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

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

.input,
.select,
.textarea {
    width: 100%;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #09090c;
    color: var(--text);
    font-size: 13px;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.input::placeholder,
.textarea::placeholder {
    color: #55525e;
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: var(--line-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: rgba(225, 29, 46, 0.55);
    box-shadow: 0 0 0 3px rgba(225, 29, 46, 0.1);
    background: #0b0b0f;
}

.select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23918e9b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.field-hint {
    color: var(--muted-2);
    font-size: 11.5px;
    line-height: 1.5;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text-soft);
    font-size: 12.5px;
    cursor: pointer;
    user-select: none;
}

.checkbox input {
    appearance: none;
    width: 17px;
    height: 17px;
    margin: 0;
    border: 1px solid #3a3844;
    border-radius: 5px;
    background: #0b0b0f;
    display: grid;
    place-content: center;
    transition: background 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.checkbox input::before {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0);
    transition: transform 0.14s var(--ease);
    margin-top: -2px;
}

.checkbox input:checked {
    background: linear-gradient(135deg, var(--red-hot), var(--red-deep));
    border-color: rgba(255, 99, 115, 0.6);
    box-shadow: 0 0 16px rgba(225, 29, 46, 0.25);
}

.checkbox input:checked::before {
    transform: rotate(-45deg) scale(1);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.badge-success {
    border-color: rgba(53, 208, 127, 0.24);
    background: var(--green-soft);
    color: var(--green);
}

.badge-danger {
    border-color: rgba(225, 29, 46, 0.28);
    background: var(--red-soft);
    color: #ff8793;
}

.badge-warning {
    border-color: rgba(240, 170, 60, 0.25);
    background: var(--amber-soft);
    color: var(--amber);
}

.badge-info {
    border-color: rgba(120, 145, 255, 0.24);
    background: var(--blue-soft);
    color: var(--blue);
}

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

.badge-purple {
    border-color: rgba(184, 120, 255, 0.24);
    background: var(--purple-soft);
    color: var(--purple);
}

.panel {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 36%),
        var(--surface);
    box-shadow: var(--shadow-md);
}

.panel::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 24%);
    mask: linear-gradient(#000, transparent 38%);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px 0;
}

.panel-title {
    font-size: 15px;
    letter-spacing: -0.02em;
}

.panel-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11.5px;
}

.panel-body {
    padding: 18px 22px 22px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 180px;
    padding: 28px;
    color: var(--muted-2);
    text-align: center;
}

.empty-state .icon {
    width: 28px;
    height: 28px;
    margin-bottom: 3px;
    color: #3b3945;
}

.empty-state strong {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

.empty-state span {
    max-width: 300px;
    font-size: 11.5px;
    line-height: 1.55;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: #101015;
    border-radius: 8px;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.045), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

.skeleton-line {
    height: 12px;
    margin-bottom: 9px;
}

.skeleton-line:last-child {
    width: 64%;
    margin-bottom: 0;
}
