@font-face {
    font-family: "Vazirmatn";
    src: url("/assets/fonts/Vazirmatn-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Yekan";
    src: url("/assets/fonts/Yekan.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-body: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
    --font-display: "Yekan", "Vazirmatn", Tahoma, sans-serif;
    --bg: #f4f5fb;
    --bg-glow: rgba(108, 92, 231, .12);
    --surface: #ffffff;
    --surface-2: #f9faff;
    --surface-3: #f1f3fb;
    --text: #171a2b;
    --text-soft: #3e435d;
    --muted: #7d839c;
    --border: #e7e9f3;
    --border-strong: #d9dcea;
    --primary: #6c5ce7;
    --primary-2: #8d7ef7;
    --primary-soft: #eeebff;
    --primary-ink: #4a3fc4;
    --teal: #00b894;
    --teal-soft: #e2fbf4;
    --blue: #2f80ed;
    --blue-soft: #e8f2ff;
    --pink: #e84393;
    --pink-soft: #ffecf6;
    --gold: #f0a500;
    --gold-soft: #fff5dc;
    --danger: #e74c5e;
    --danger-soft: #fff0f2;
    --success: #18a874;
    --success-soft: #e8faf3;
    --sidebar: #101323;
    --sidebar-2: #181c33;
    --sidebar-text: #f5f6ff;
    --sidebar-muted: #9aa0be;
    --shadow-xs: 0 1px 2px rgba(20, 24, 48, .05);
    --shadow-sm: 0 4px 14px rgba(20, 24, 48, .05);
    --shadow-md: 0 14px 34px rgba(25, 28, 58, .08);
    --shadow-lg: 0 24px 60px rgba(25, 28, 58, .13);
    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 24px;
    --sidebar-w: 268px;
    --transition: .22s cubic-bezier(.2, .7, .3, 1);
}

[data-theme="dark"] {
    --bg: #0a0d17;
    --bg-glow: rgba(108, 92, 231, .18);
    --surface: #121627;
    --surface-2: #171b2e;
    --surface-3: #1c2138;
    --text: #eef0fa;
    --text-soft: #c7cbe0;
    --muted: #9097b2;
    --border: #242a43;
    --border-strong: #303753;
    --primary-soft: #211e45;
    --primary-ink: #b9b0ff;
    --teal-soft: #0d2e2a;
    --blue-soft: #11243d;
    --pink-soft: #321528;
    --gold-soft: #2f2711;
    --danger-soft: #361620;
    --success-soft: #0d2f26;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, .22);
    --shadow-md: 0 14px 34px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .4);
}

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

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

@supports not (overflow: clip) {
    html, body {
        overflow-x: hidden;
    }
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: clip;
    background:
        radial-gradient(1100px 500px at 85% -10%, var(--bg-glow), transparent 60%),
        radial-gradient(900px 500px at 5% 0%, rgba(0, 184, 148, .06), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

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

button {
    cursor: pointer;
}

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

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

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.5;
    letter-spacing: -.2px;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

code {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: .88em;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.icon {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset-inline-start: 0;
    top: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    height: 100vh;
    padding: 26px 18px 18px;
    color: var(--sidebar-text);
    background:
        radial-gradient(500px 300px at 100% 0%, rgba(108, 92, 231, .32), transparent 60%),
        radial-gradient(400px 300px at 0% 100%, rgba(0, 184, 148, .14), transparent 60%),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    border-inline-end: 1px solid rgba(255, 255, 255, .06);
    overflow: hidden;
}

.sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .35;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

.brand {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 22px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(145deg, #7b6cf6, #5243d8);
    box-shadow: 0 10px 24px rgba(108, 92, 231, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.brand-icon {
    width: 23px;
    height: 23px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.brand-text strong {
    font-family: var(--font-display);
    font-size: 19px;
    letter-spacing: .2px;
}

.brand-text small {
    color: var(--sidebar-muted);
    font-size: 11px;
}

.sidebar-nav {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.nav-label {
    padding: 0 12px 8px;
    color: var(--sidebar-muted);
    font-size: 10px;
    letter-spacing: .8px;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--sidebar-muted);
    font-size: 14px;
    transition: var(--transition);
}

.nav-item .icon {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
}

.nav-item.is-active {
    color: #fff;
    background: linear-gradient(90deg, rgba(108, 92, 231, .26), rgba(108, 92, 231, .08));
    box-shadow: inset 2px 0 0 #8d7ef7;
}

.nav-item.is-active::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    width: 3px;
    height: 22px;
    border-radius: 4px;
    background: linear-gradient(#a99dff, #6c5ce7);
    box-shadow: 0 0 16px rgba(141, 126, 247, .9);
}

.sidebar-card {
    position: relative;
    margin-top: auto;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 18px;
    background: rgba(255, 255, 255, .045);
    backdrop-filter: blur(10px);
}

.sidebar-card-kicker {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #b9b0ff;
    font-size: 10px;
    letter-spacing: .4px;
}

.sidebar-card-kicker .icon {
    width: 13px;
    height: 13px;
}

.sidebar-card strong {
    display: block;
    margin: 8px 0 4px;
    font-family: var(--font-display);
    font-size: 14px;
}

.sidebar-card p {
    color: var(--sidebar-muted);
    font-size: 11px;
    line-height: 1.85;
}

.sidebar-card a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    color: #cfc9ff;
    font-size: 11px;
}

.sidebar-card a .icon {
    width: 13px;
    height: 13px;
    transition: transform var(--transition);
}

.sidebar-card a:hover .icon {
    transform: translateX(-3px);
}

.sidebar-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 2px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
    color: #fff;
    font-family: var(--font-display);
    font-size: 16px;
    background: linear-gradient(145deg, #7b6cf6, #00b894);
}

.avatar.large {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    font-size: 22px;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.sidebar-user-info strong {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info small {
    color: var(--sidebar-muted);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .icon-btn {
    color: var(--sidebar-muted);
    border-color: transparent;
    background: transparent;
}

.sidebar-user .icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.main-shell {
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-w));
    min-height: 100vh;
    margin-inline-start: var(--sidebar-w);
}


.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 80px;
    padding: 14px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(18px);
}

.menu-toggle {
    display: none;
}

.topbar-title {
    display: flex;
    flex-direction: column;
    line-height: 1.45;
    min-width: 120px;
}

.topbar-title .eyebrow {
    font-size: 9px;
    letter-spacing: .7px;
}

.topbar-title strong {
    font-family: var(--font-display);
    font-size: 16px;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 9px;
    width: min(360px, 32vw);
    margin-inline-start: auto;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--muted);
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}

.topbar-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.topbar-search .icon {
    width: 17px;
    height: 17px;
}

.topbar-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 12px;
}

.topbar-search input::placeholder {
    color: var(--muted);
}

.topbar-search kbd {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 11px;
    background: var(--surface-3);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-inline-start: 4px;
    border-radius: 13px;
    color: #fff;
    font-family: var(--font-display);
    font-size: 16px;
    background: linear-gradient(145deg, #7b6cf6, #00b894);
    box-shadow: 0 6px 16px rgba(108, 92, 231, .25);
}

[data-theme="dark"] .theme-icon-dark,
[data-theme="light"] .theme-icon-light {
    display: none;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 30px 32px 44px;
}

.footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px 22px;
    color: var(--muted);
    font-size: 10px;
}

.footer-divider {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border-strong);
}

.footer-spacer {
    flex: 1;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    animation: fadeUp .45s both;
}

.page-head h1 {
    margin: 4px 0 2px;
    font-size: clamp(26px, 2.6vw, 34px);
    font-weight: 700;
}

.page-head p {
    color: var(--muted);
    font-size: 12px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.page-actions.center {
    justify-content: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
}

.eyebrow.light {
    color: #b9b0ff;
}

.eyebrow .icon {
    width: 14px;
    height: 14px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .icon {
    width: 12px;
    height: 12px;
}


.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: var(--transition);
}

.btn .icon {
    width: 17px;
    height: 17px;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #7667ed, #5b4ada);
    box-shadow: 0 8px 20px rgba(108, 92, 231, .28), inset 0 1px 0 rgba(255, 255, 255, .2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(108, 92, 231, .36);
}

.btn-ghost {
    color: var(--text-soft);
    border-color: var(--border);
    background: var(--surface);
}

.btn-ghost:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.btn-soft {
    color: var(--primary-ink);
    background: var(--primary-soft);
}

.btn-soft:hover {
    background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%);
}

.btn-danger {
    color: #fff;
    background: linear-gradient(135deg, #f06070, #d93c50);
    box-shadow: 0 8px 18px rgba(231, 76, 94, .25);
}

.btn-danger-ghost {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
    background: var(--danger-soft);
}

.btn-lg {
    min-height: 48px;
    border-radius: 14px;
    font-size: 13px;
}

.btn.full {
    width: 100%;
}

.btn-sm {
    min-height: 32px;
    padding: 5px 10px;
    border-radius: 9px;
    font-size: 10px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-soft);
    background: var(--surface);
    transition: var(--transition);
}

.icon-btn .icon {
    width: 17px;
    height: 17px;
}

.icon-btn:hover {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
    background: var(--primary-soft);
}

.icon-btn.danger:hover {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, var(--border));
    background: var(--danger-soft);
}

.icon-btn.sm {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

.icon-btn.sm .icon {
    width: 14px;
    height: 14px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.badge .icon {
    width: 12px;
    height: 12px;
}

.badge-success {
    color: var(--success);
    background: var(--success-soft);
}

.badge-muted {
    color: var(--muted);
    background: var(--surface-3);
}

.badge-gold {
    color: #a46d00;
    background: var(--gold-soft);
}

.badge-soft {
    color: var(--primary-ink);
    background: var(--primary-soft);
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-soft);
    background: var(--surface-2);
    font-size: 9px;
}

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

.genre-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
}

.text-link .icon {
    width: 13px;
    height: 13px;
    transition: transform var(--transition);
}

.text-link:hover .icon {
    transform: translateX(-3px);
}

.text-link.full {
    width: 100%;
    justify-content: space-between;
    margin-top: 8px;
}

.text-success {
    color: var(--success) !important;
}

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

.small {
    font-size: 11px;
}

.block {
    display: block;
}


.panel {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    animation: fadeUp .5s both;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.panel-head h2,
.panel-head h3 {
    font-size: 17px;
}

.panel-head h3 {
    font-size: 15px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.field > span:first-child {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.field em {
    color: var(--danger);
    font-style: normal;
}

.field small {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.7;
}

.input {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: 0;
    color: var(--text);
    background: var(--surface-2);
    font-size: 12px;
    transition: var(--transition);
}

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

.input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.input::placeholder {
    color: color-mix(in srgb, var(--muted) 75%, transparent);
}

.textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.95;
}

.select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(0% + 16px) 50%, calc(0% + 11px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-inline-end: 32px;
}

.input-with-icon {
    position: relative;
    display: block;
}

.input-with-icon > .icon {
    position: absolute;
    inset-inline-start: 13px;
    top: 50%;
    width: 17px;
    height: 17px;
    color: var(--muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.input-with-icon .input {
    padding-inline-start: 40px;
}

.password-toggle {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    transform: translateY(-50%);
}

.password-toggle:hover {
    background: var(--surface-3);
}

.form-card {
    padding: 24px;
}

.form-card > .field + .field,
.form-card > .field + .form-grid,
.form-card > .form-grid + .field {
    margin-top: 16px;
}

.form-layout,
.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 20px;
    align-items: start;
}

.form-main,
.form-side,
.settings-main,
.settings-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-main .panel:nth-child(2) {
    animation-delay: .05s;
}

.form-side .panel:nth-child(2),
.settings-side .panel:nth-child(2) {
    animation-delay: .08s;
}

.form-side .panel:nth-child(3),
.settings-side .panel:nth-child(3) {
    animation-delay: .14s;
}


.filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px;
    margin-bottom: 20px;
}

.filter-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 220px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-2);
}

.filter-search .icon {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

.filter-search input {
    width: 100%;
    min-height: 40px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 11px;
}

.filters > .select {
    width: auto;
    min-width: 150px;
    min-height: 40px;
    font-size: 11px;
}

.cover-drop {
    position: relative;
    display: block;
    border: 1.5px dashed var(--border-strong);
    border-radius: 16px;
    background: var(--surface-2);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.cover-drop:hover,
.cover-drop.is-dragging {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.cover-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.cover-preview {
    display: block;
    aspect-ratio: 2 / 3;
    overflow: hidden;
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 230px;
    color: var(--muted);
    text-align: center;
}

.cover-preview-empty .icon {
    width: 34px;
    height: 34px;
    color: var(--primary);
}

.cover-preview-empty strong {
    color: var(--text-soft);
    font-size: 12px;
}

.cover-preview-empty small {
    font-size: 9px;
}

.cover-drop-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 9px;
}

.cover-drop-hint .icon {
    width: 13px;
    height: 13px;
}

.cover-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, .92);
}

.cover-fallback .icon {
    width: 34px;
    height: 34px;
}

.cover-fallback span {
    font-family: var(--font-display);
    font-size: 30px;
    opacity: .85;
}

.genre-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.genre-choice {
    position: relative;
    cursor: pointer;
}

.genre-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.genre-choice span {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-soft);
    background: var(--surface-2);
    font-size: 11px;
    transition: var(--transition);
}

.genre-choice:hover span {
    border-color: var(--primary);
}

.genre-choice input:checked + span {
    color: var(--primary-ink);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px var(--primary-soft);
}


.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.switch-row:last-of-type {
    border-bottom: 0;
}

.switch-row span:first-child {
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

.switch-row strong {
    font-size: 11px;
}

.switch-row small {
    color: var(--muted);
    font-size: 9px;
}

.switch {
    position: relative;
    flex: 0 0 auto;
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-track {
    position: relative;
    display: block;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: var(--border-strong);
    transition: var(--transition);
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(20, 24, 48, .2);
    transition: var(--transition);
}

.switch input:checked + .switch-track {
    background: linear-gradient(135deg, #7667ed, #5b4ada);
}

.switch input:checked + .switch-track::after {
    transform: translateX(-18px);
}

.check-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
    cursor: pointer;
}

.check-line input {
    width: 15px;
    height: 15px;
    margin-top: 3px;
    accent-color: var(--primary);
}

.info-box {
    display: flex;
    gap: 9px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--border));
    border-radius: 12px;
    color: var(--text-soft);
    background: var(--primary-soft);
    font-size: 10px;
    line-height: 1.9;
}

.info-box .icon {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    color: var(--primary);
}

.info-box.warning {
    border-color: color-mix(in srgb, var(--gold) 20%, var(--border));
    background: var(--gold-soft);
}

.info-box.warning .icon {
    color: var(--gold);
}

.info-box code {
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(0, 0, 0, .06);
}

.meta-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 10px;
}

.meta-row:last-of-type {
    border-bottom: 0;
}

.meta-row span {
    color: var(--muted);
}

.meta-row strong {
    color: var(--text-soft);
    font-size: 10px;
    text-align: end;
}


.empty-mini {
    padding: 18px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 46px 24px;
    text-align: center;
}

.empty-state.compact {
    padding: 30px 18px;
    box-shadow: none;
    border: 0;
    background: transparent;
}

.empty-state h1,
.empty-state h2,
.empty-state h3 {
    font-size: 20px;
}

.empty-state p {
    max-width: 360px;
    color: var(--muted);
    font-size: 11px;
}

.empty-art {
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    border-radius: 22px;
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 10px 26px rgba(108, 92, 231, .16);
}

.empty-art .icon {
    width: 30px;
    height: 30px;
}

.error-code {
    font-family: var(--font-display);
    font-size: 64px;
    line-height: 1;
    color: var(--primary);
    opacity: .18;
}

.error-state {
    min-height: 55vh;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 22px;
    font-size: 11px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-soft);
    background: var(--surface);
    transition: var(--transition);
}

.page-link:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.page-link.disabled {
    color: var(--muted);
    opacity: .55;
    pointer-events: none;
}

.page-link .icon {
    width: 13px;
    height: 13px;
}

.page-link:last-child .icon {
    transform: rotate(180deg);
}

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

.toast-stack {
    position: fixed;
    top: 22px;
    inset-inline-end: 26px;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-width: min(380px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    font-size: 11px;
    animation: slideIn .35s both;
}

.toast-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 9px;
}

.toast-success .toast-icon {
    color: var(--success);
    background: var(--success-soft);
}

.toast-error .toast-icon {
    color: var(--danger);
    background: var(--danger-soft);
}

.toast-info .toast-icon {
    color: var(--blue);
    background: var(--blue-soft);
}

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

.toast-close {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-inline-start: auto;
    border: 0;
    border-radius: 7px;
    color: var(--muted);
    background: transparent;
}

.toast-close:hover {
    color: var(--text);
    background: var(--surface-3);
}

.toast-close .icon {
    width: 12px;
    height: 12px;
}

.confirm-dialog {
    width: min(380px, calc(100vw - 32px));
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 22px;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.confirm-dialog::backdrop {
    background: rgba(10, 13, 23, .55);
    backdrop-filter: blur(4px);
}

.confirm-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 16px;
    color: var(--danger);
    background: var(--danger-soft);
}

.confirm-icon .icon {
    width: 24px;
    height: 24px;
}

.confirm-dialog h3 {
    font-size: 18px;
}

.confirm-dialog p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}


.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    position: relative;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        radial-gradient(180px 100px at 100% 0%, var(--stat-soft), transparent 70%),
        var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    animation: fadeUp .5s both;
}

.stat-card:nth-child(2) {
    animation-delay: .05s;
}

.stat-card:nth-child(3) {
    animation-delay: .1s;
}

.stat-card:nth-child(4) {
    animation-delay: .15s;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset-inline-end: -20px;
    bottom: -34px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--stat-soft);
    opacity: .7;
}

.stat-violet {
    --stat: #6c5ce7;
    --stat-soft: rgba(108, 92, 231, .12);
}

.stat-teal {
    --stat: #00b894;
    --stat-soft: rgba(0, 184, 148, .12);
}

.stat-blue {
    --stat: #2f80ed;
    --stat-soft: rgba(47, 128, 237, .12);
}

.stat-pink {
    --stat: #e84393;
    --stat-soft: rgba(232, 67, 147, .12);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    color: var(--stat);
    background: var(--stat-soft);
}

.stat-icon .icon {
    width: 21px;
    height: 21px;
}

.stat-trend {
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--stat);
    background: var(--stat-soft);
    font-size: 8px;
    font-weight: 700;
}

.stat-card > strong {
    display: block;
    position: relative;
    z-index: 1;
    font-family: var(--font-display);
    font-size: 30px;
    line-height: 1.3;
}

.stat-card > span {
    position: relative;
    z-index: 1;
    color: var(--muted);
    font-size: 11px;
}

.stat-foot {
    position: relative;
    z-index: 1;
    margin-top: 12px;
    padding-top: 9px;
    border-top: 1px dashed var(--border);
    color: var(--muted);
    font-size: 9px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-grid.lower {
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
}

.chart-panel {
    min-width: 0;
}

.chart-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.4;
}

.chart-total strong {
    font-family: var(--font-display);
    font-size: 22px;
}

.chart-total span {
    color: var(--muted);
    font-size: 9px;
}

.chart-wrap {
    padding: 4px 0 0;
}

.chart-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-grid-line {
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 4 6;
}

.chart-dot {
    fill: var(--surface);
    stroke: var(--primary);
    stroke-width: 3;
    filter: drop-shadow(0 3px 5px rgba(108, 92, 231, .35));
}

.chart-label {
    fill: var(--muted);
    font-family: var(--font-body);
    font-size: 10px;
}

.top-books {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.top-book {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 13px;
    transition: var(--transition);
}

.top-book:hover {
    background: var(--surface-2);
}

.rank {
    width: 20px;
    flex: 0 0 auto;
    color: var(--muted);
    font-family: var(--font-display);
    font-size: 12px;
    text-align: center;
}

.top-book:nth-child(1) .rank {
    color: var(--gold);
}

.top-book:nth-child(2) .rank {
    color: #9aa3b7;
}

.top-book:nth-child(3) .rank {
    color: #c18452;
}

.mini-cover {
    width: 38px;
    height: 54px;
    flex: 0 0 auto;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(20, 24, 48, .16);
}

.mini-cover.placeholder {
    display: grid;
    place-items: center;
    color: #fff;
}

.mini-cover.placeholder .icon {
    width: 17px;
    height: 17px;
}

.top-book-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    gap: 2px;
}

.top-book-info strong {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-book-info > span {
    color: var(--muted);
    font-size: 9px;
}

.progress {
    display: block;
    width: 100%;
    height: 4px;
    margin-top: 4px;
    border-radius: 99px;
    background: var(--surface-3);
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--teal));
}


.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 580px;
    border-collapse: collapse;
    font-size: 11px;
}

.data-table th {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 9px;
    font-weight: 400;
    text-align: start;
    white-space: nowrap;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--surface-2);
}

.table-book {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
}

.table-book img,
.table-cover-placeholder {
    width: 34px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 7px;
    object-fit: cover;
    box-shadow: 0 3px 8px rgba(20, 24, 48, .13);
}

.table-cover-placeholder {
    display: grid;
    place-items: center;
    color: #fff;
}

.table-cover-placeholder .icon {
    width: 15px;
    height: 15px;
}

.table-book > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.table-book strong {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-book small {
    color: var(--muted);
    font-size: 9px;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.table-actions .icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

.table-actions .icon-btn .icon {
    width: 14px;
    height: 14px;
}

.table-actions form {
    display: flex;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px;
    border-radius: 12px;
    transition: var(--transition);
}

.activity-item:hover {
    background: var(--surface-2);
}

.activity-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 9px;
    color: var(--primary);
    background: var(--primary-soft);
}

.activity-icon.chapter_read {
    color: var(--teal);
    background: var(--teal-soft);
}

.activity-icon.bundle_download {
    color: var(--blue);
    background: var(--blue-soft);
}

.activity-icon .icon {
    width: 14px;
    height: 14px;
}

.activity-text {
    display: flex;
    flex-direction: column;
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1.8;
}

.activity-text small {
    color: var(--muted);
    font-size: 8px;
}


.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.book-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    animation: fadeUp .45s both;
}

.book-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
    box-shadow: var(--shadow-md);
}

.book-card-cover {
    position: relative;
    height: 210px;
    background: var(--surface-3);
    overflow: hidden;
}

.book-card-cover > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}

.book-card:hover .book-card-cover > img {
    transform: scale(1.045);
}

.book-card-cover .cover-fallback {
    height: 100%;
    background: linear-gradient(145deg, #6c5ce7, #a29bfe);
}

.book-card-badges {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.book-card-badges .badge {
    box-shadow: 0 3px 10px rgba(20, 24, 48, .12);
}

.book-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.book-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.book-card-top h3 {
    font-size: 15px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card-top .muted {
    font-size: 9px;
}

.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    margin-top: 8px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 0 4px var(--teal-soft);
}

.status-dot.completed {
    background: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.book-metrics {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 9px;
}

.book-metrics span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.book-metrics .icon {
    width: 13px;
    height: 13px;
}

.book-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.book-card-actions .btn {
    flex: 1;
    min-height: 34px;
    font-size: 10px;
}

.book-card-actions .icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.book-card-actions form {
    display: flex;
}

.book-hero {
    position: relative;
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    overflow: hidden;
}

.book-hero-cover {
    width: 116px;
}

.book-hero-cover img,
.book-hero-cover .cover-fallback {
    width: 116px;
    aspect-ratio: 2 / 3;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 12px 28px rgba(20, 24, 48, .22);
}

.book-hero-info {
    min-width: 0;
}

.book-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 6px;
}

.book-hero-info h2 {
    font-size: 22px;
    margin-bottom: 2px;
}

.book-hero-info > .muted {
    font-size: 10px;
}

.book-hero-info .genre-chips {
    margin: 8px 0;
}

.book-hero-desc {
    max-width: 720px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.9;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-hero-stats {
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
}

.book-hero-stats > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 6px 10px;
    border-inline-end: 1px solid var(--border);
}

.book-hero-stats > div:last-child {
    border-inline-end: 0;
}

.book-hero-stats strong {
    font-family: var(--font-display);
    font-size: 16px;
    line-height: 1.4;
}

.book-hero-stats span {
    color: var(--muted);
    font-size: 8px;
}

.chapters-panel {
    padding: 24px;
}

.chapters-table {
    min-width: 660px;
}

.chapter-number {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    color: var(--primary-ink);
    background: var(--primary-soft);
    font-family: var(--font-display);
    font-size: 10px;
}

.chapter-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    max-width: 360px;
}

.chapter-title strong {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.api-key-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.api-key-box code {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--primary-ink);
    font-size: 9px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.account-card h3 {
    font-size: 18px;
}

.account-card p {
    color: var(--muted);
    font-size: 10px;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 20px;
    align-items: start;
}

.editor-main,
.editor-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.editor-card {
    padding: 24px;
}

.editor-meta {
    margin-bottom: 18px;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 2px;
    color: var(--muted);
    font-size: 9px;
}

.editor-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.editor-hint .icon {
    width: 13px;
    height: 13px;
}

.word-counter {
    padding: 3px 9px;
    border-radius: 999px;
    color: var(--primary-ink);
    background: var(--primary-soft);
    font-size: 9px;
}

.chapter-editor {
    min-height: 58vh;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    font-size: 13px;
    line-height: 2.15;
    resize: vertical;
}

.chapter-editor:focus {
    background: var(--surface);
}

.book-mini-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.book-mini-card > div {
    flex: 1;
    min-width: 0;
}

.book-mini-card h3 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-mini-card p {
    color: var(--muted);
    font-size: 9px;
}

.book-mini-cover {
    width: 52px;
    height: 76px;
    flex: 0 0 auto;
    border-radius: 9px;
    object-fit: cover;
    box-shadow: 0 6px 14px rgba(20, 24, 48, .2);
}

.book-mini-cover.placeholder {
    display: grid;
    place-items: center;
    color: #fff;
}

.book-mini-cover.placeholder .icon {
    width: 20px;
    height: 20px;
}

.api-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 1fr);
    gap: 28px;
    align-items: center;
    margin-bottom: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius-lg);
    color: #f5f6ff;
    background:
        radial-gradient(500px 260px at 100% 0%, rgba(0, 184, 148, .24), transparent 60%),
        radial-gradient(420px 280px at 0% 100%, rgba(108, 92, 231, .4), transparent 60%),
        linear-gradient(135deg, #171b33, #0f1222);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.api-hero h2 {
    margin: 6px 0;
    font-size: 25px;
}

.api-hero-copy > p {
    max-width: 460px;
    color: #aeb4d0;
    font-size: 11px;
}

.api-base {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
}

.api-base > span {
    color: #aeb4d0;
    font-size: 8px;
    white-space: nowrap;
}

.api-base code {
    flex: 1;
    overflow: hidden;
    color: #d8d4ff;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-hero .icon-btn {
    color: #c7cbe0;
    border-color: rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .05);
}

.api-hero .icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

.api-hero-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
}


.api-key-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
}

.api-key-chip > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #aeb4d0;
    font-size: 8px;
    white-space: nowrap;
}

.api-key-chip .icon {
    width: 12px;
    height: 12px;
}

.api-key-chip code {
    flex: 1;
    overflow: hidden;
    color: #d8d4ff;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.code-block {
    margin: 0;
    padding: 16px 18px;
    border: 1px solid #242a43;
    border-radius: 14px;
    background: #0f1222;
    color: #e3e0ff;
    font-size: 10px;
    line-height: 1.95;
    direction: ltr;
    text-align: left;
    overflow-x: auto;
}

.api-endpoints {
    padding: 6px 0 20px;
}

.endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.endpoint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    transition: var(--transition);
}

.endpoint:hover {
    border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
    box-shadow: var(--shadow-sm);
}

.method {
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--success);
    background: var(--success-soft);
    font-family: monospace;
    font-size: 9px;
    font-weight: 700;
}

.endpoint-main {
    flex: 1;
    min-width: 0;
}

.endpoint-main code {
    color: var(--primary-ink);
    font-size: 10px;
}

.endpoint-main p {
    color: var(--text-soft);
    font-size: 10px;
}

.endpoint-main small {
    color: var(--muted);
    font-size: 8px;
}

.api-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 20px;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.steps li {
    display: flex;
    gap: 10px;
}

.steps li > span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border-radius: 8px;
    color: var(--primary-ink);
    background: var(--primary-soft);
    font-family: var(--font-display);
    font-size: 11px;
}

.steps strong {
    font-size: 11px;
}

.steps p {
    color: var(--muted);
    font-size: 10px;
}

.steps code {
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--surface-3);
}


.auth-body {
    background: #080b14;
}

.auth-page {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr);
    min-height: 100vh;
}

.auth-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 34px 44px;
    color: #fff;
    background:
        radial-gradient(700px 500px at 90% 10%, rgba(108, 92, 231, .45), transparent 60%),
        radial-gradient(600px 420px at 5% 90%, rgba(0, 184, 148, .2), transparent 60%),
        linear-gradient(145deg, #101323, #1a1e3a 65%, #15182c);
    overflow: hidden;
}

.auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: radial-gradient(circle at 50% 40%, #000, transparent 78%);
    pointer-events: none;
}

.auth-visual::after {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    inset-inline-start: 50%;
    top: 42%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(141, 126, 247, .3), transparent 66%);
    filter: blur(30px);
    transform: translate(-50%, -50%);
    animation: pulseGlow 7s ease-in-out infinite;
    pointer-events: none;
}

.auth-brand {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
}

.auth-visual .brand-mark {
    background: linear-gradient(145deg, #8d7ef7, #5b4ada);
}

.auth-visual-copy {
    position: relative;
    z-index: 2;
    max-width: 520px;
    margin: auto 0;
    padding: 40px 0;
}

.auth-visual-copy h1 {
    margin: 14px 0;
    font-size: clamp(36px, 4.4vw, 58px);
    line-height: 1.4;
    letter-spacing: -1px;
}

.auth-visual-copy h1 span {
    color: transparent;
    background: linear-gradient(90deg, #a99dff, #55efc4);
    -webkit-background-clip: text;
    background-clip: text;
}

.auth-visual-copy > p {
    max-width: 430px;
    color: #b3b9d4;
    font-size: 13px;
    line-height: 2;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #d9dcef;
    font-size: 11px;
}

.auth-features .icon {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 3px;
    border-radius: 50%;
    color: #55efc4;
    background: rgba(85, 239, 196, .12);
}

.auth-float-card {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 14px;
    background: rgba(20, 24, 45, .6);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
    backdrop-filter: blur(14px);
    animation: floatY 6s ease-in-out infinite;
}

.auth-float-card > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

.auth-float-card strong {
    font-size: 10px;
}

.auth-float-card small {
    color: #aeb4d0;
    font-size: 8px;
}

.float-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    color: #b9b0ff;
    background: rgba(108, 92, 231, .2);
}

.float-icon.teal {
    color: #55efc4;
    background: rgba(0, 184, 148, .18);
}

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

.float-one {
    inset-inline-end: 9%;
    top: 22%;
}

.float-two {
    inset-inline-start: 8%;
    bottom: 20%;
    animation-delay: -3s;
}

.auth-visual-foot {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    color: #8b91b0;
    font-size: 9px;
}


.auth-form-side {
    display: grid;
    place-items: center;
    padding: 40px;
    background:
        radial-gradient(600px 400px at 50% 0%, rgba(108, 92, 231, .12), transparent 65%),
        #0c0f1c;
}

.auth-form-wrap {
    width: min(400px, 100%);
}

.auth-form-head {
    margin-bottom: 22px;
}

.auth-form-head h2 {
    margin: 6px 0 3px;
    font-size: 28px;
    color: #fff;
}

.auth-form-head p {
    color: #8f96b3;
    font-size: 11px;
}

.auth-mobile-brand {
    display: none;
}

.auth-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(231, 76, 94, .22);
    border-radius: 12px;
    color: #ffb3bc;
    background: rgba(231, 76, 94, .1);
    font-size: 10px;
}

.auth-alert.success {
    border-color: rgba(0, 184, 148, .22);
    color: #8ff0d4;
    background: rgba(0, 184, 148, .1);
}

.auth-alert .icon {
    width: 15px;
    height: 15px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-form .field > span:first-child {
    color: #b9bed5;
}

.auth-form .input {
    min-height: 48px;
    border-color: #252b45;
    background: #14182a;
    color: #f2f3fb;
}

.auth-form .input:focus {
    border-color: #7b6cf6;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, .16);
}

.auth-form .input::placeholder {
    color: #626987;
}

.auth-form .btn-primary {
    margin-top: 4px;
}

.demo-card {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    padding: 12px;
    border: 1px dashed rgba(141, 126, 247, .35);
    border-radius: 13px;
    background: rgba(108, 92, 231, .07);
}

.demo-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 9px;
    color: #b9b0ff;
    background: rgba(108, 92, 231, .18);
}

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

.demo-card strong {
    color: #d8d4ff;
    font-size: 10px;
}

.demo-card p {
    color: #9299b6;
    font-size: 9px;
    line-height: 1.9;
}

.demo-card code {
    color: #c8c3ff;
}

.auth-form-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 22px;
    color: #717896;
    font-size: 9px;
}

.auth-form-foot a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.auth-form-foot a:hover {
    color: #b9b0ff;
}

.auth-form-foot .icon {
    width: 12px;
    height: 12px;
}


.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(8, 11, 20, .5);
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(3px);
    transition: var(--transition);
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

.book-hero {
    position: relative;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes floatY {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: .7;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.12);
    }
}

@media (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .dashboard-grid.lower {
        grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    }

    .form-layout,
    .settings-grid {
        grid-template-columns: minmax(0, 1fr) 320px;
    }

    .editor-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
}

@media (max-width: 1120px) {
    .dashboard-grid,
    .dashboard-grid.lower {
        grid-template-columns: 1fr;
    }

    .top-books {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform .3s cubic-bezier(.2, .7, .3, 1);
        box-shadow: -20px 0 60px rgba(0, 0, 0, .3);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-shell {
        width: 100%;
        margin-inline-start: 0;
    }

    .menu-toggle {
        display: inline-grid;
    }

    .topbar {
        padding: 12px 22px;
    }

    .main-content {
        padding: 24px 22px 36px;
    }

    .topbar-search {
        width: min(300px, 34vw);
    }

    .api-hero {
        grid-template-columns: 1fr;
    }

    .api-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        display: none;
    }

    .auth-form-side {
        min-height: 100vh;
        padding: 28px;
        background:
            radial-gradient(700px 500px at 80% 0%, rgba(108, 92, 231, .22), transparent 60%),
            radial-gradient(500px 400px at 0% 100%, rgba(0, 184, 148, .12), transparent 60%),
            #0c0f1c;
    }

    .auth-mobile-brand {
        display: flex;
        align-items: center;
        gap: 6px;
        width: fit-content;
        margin-bottom: 24px;
        color: #fff;
        font-family: var(--font-display);
        font-size: 18px;
    }

    .auth-mobile-brand .icon {
        width: 22px;
        height: 22px;
        color: #a99dff;
    }

    .form-layout,
    .settings-grid,
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .form-side,
    .settings-side,
    .editor-side {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .form-side > form,
    .settings-side > form,
    .editor-side > form {
        grid-column: 1 / -1;
    }

    .book-hero {
        grid-template-columns: 92px minmax(0, 1fr);
    }

    .book-hero-cover,
    .book-hero-cover img,
    .book-hero-cover .cover-fallback {
        width: 92px;
    }

    .book-hero-stats {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: space-around;
    }

    .book-hero-stats > div {
        flex: 1;
    }
}


@media (max-width: 768px) {
    .topbar-search {
        display: none;
    }

    .topbar {
        gap: 10px;
        min-height: 70px;
    }

    .topbar-title strong {
        font-size: 14px;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .page-actions {
        width: 100%;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card > strong {
        font-size: 26px;
    }

    .form-side,
    .settings-side,
    .editor-side {
        grid-template-columns: 1fr;
    }

    .books-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .book-card-cover {
        height: 220px;
    }

    .book-card-actions .btn {
        font-size: 9px;
    }

    .filters > .select {
        flex: 1;
    }

    .top-books {
        grid-template-columns: 1fr;
    }

    .form-grid.two,
    .form-grid.three {
        grid-template-columns: 1fr;
    }

    .book-hero {
        gap: 14px;
    }

    .book-hero-info h2 {
        font-size: 18px;
    }

    .toast-stack {
        top: auto;
        bottom: 16px;
        inset-inline: 14px;
        max-width: none;
    }

    .auth-form-side {
        padding: 22px;
    }

    .footer {
        flex-wrap: wrap;
        padding: 14px 22px 18px;
    }
}

@media (max-width: 560px) {
    .main-content {
        padding: 18px 14px 28px;
    }

    .topbar {
        padding: 10px 14px;
    }

    .topbar-title {
        min-width: 0;
    }

    .topbar-title .eyebrow {
        display: none;
    }

    .topbar-actions .icon-btn:nth-of-type(2) {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }

    .book-card-cover {
        height: 280px;
    }

    .page-head h1 {
        font-size: 25px;
    }

    .filters {
        padding: 10px;
    }

    .filters > * {
        width: 100%;
    }

    .filters > .btn {
        flex: 1;
        width: auto;
    }

    .book-hero {
        grid-template-columns: 80px minmax(0, 1fr);
        padding: 16px;
    }

    .book-hero-cover,
    .book-hero-cover img,
    .book-hero-cover .cover-fallback {
        width: 80px;
    }

    .book-hero-info h2 {
        font-size: 17px;
    }

    .book-hero-desc {
        -webkit-line-clamp: 3;
    }

    .book-hero-stats {
        flex-wrap: wrap;
    }

    .book-hero-stats > div {
        min-width: 45%;
    }

    .chapters-panel {
        padding: 16px;
    }

    .api-hero {
        padding: 20px;
    }

    .api-hero h2 {
        font-size: 21px;
    }

    .endpoint {
        align-items: flex-start;
        padding: 10px;
    }

    .endpoint-main small {
        display: none;
    }

    .endpoint .icon-btn {
        width: 30px;
        height: 30px;
    }

    .api-key-chip code,
    .api-base code {
        font-size: 8px;
    }

    .auth-form-side {
        padding: 20px;
    }

    .auth-form-head h2 {
        font-size: 24px;
    }

    .auth-form-foot {
        flex-wrap: wrap;
    }

    .editor-card {
        padding: 16px;
    }

    .chapter-editor {
        min-height: 48vh;
        font-size: 12px;
    }

    .form-card {
        padding: 18px;
    }

    .panel {
        padding: 16px;
    }

    .page-actions .btn {
        flex: 1;
    }

    .pagination {
        flex-wrap: wrap;
    }
}

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


.icon-btn.copied {
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 30%, var(--border));
    background: var(--success-soft);
}

.password-toggle.is-visible {
    color: var(--primary);
}

body.sidebar-open {
    overflow: hidden;
}

.sidebar-close {
    display: none;
}

@media (max-width: 1024px) {
    .sidebar-close {
        position: absolute;
        top: 20px;
        inset-inline-end: 16px;
        z-index: 2;
        display: inline-grid;
        width: 34px;
        height: 34px;
        color: #d9dcef;
        border-color: rgba(255, 255, 255, .1);
        background: rgba(255, 255, 255, .06);
    }
}

.api-key-label {
    margin: 12px 0 5px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .4px;
}

.api-key-label:first-of-type {
    margin-top: 0;
}

.check-line + .check-line {
    margin-top: 8px;
}

.security-panel {
    margin-bottom: 20px;
}

.security-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.header-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.header-chips code {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--primary-ink);
    background: var(--surface-2);
    font-size: 9px;
}

.security-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.security-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
}

.security-list .icon {
    width: 14px;
    height: 14px;
    color: var(--primary);
}

@media (max-width: 900px) {
    .security-grid {
        grid-template-columns: 1fr;
    }
}
