:root {
    color-scheme: light;
    --bg: #f3f7fb;
    --panel: #ffffff;
    --ink: #102033;
    --muted: #60748c;
    --line: #d6e3f1;
    --accent: #1167d8;
    --accent-dark: #0b3f8a;
    --accent-soft: #e8f2ff;
    --danger: #b42318;
    --ok: #087443;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #edf6ff 0, var(--bg) 260px);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.auth-page {
    background:
        radial-gradient(circle at 8% 96%, rgba(255, 214, 224, .78) 0 110px, transparent 112px),
        radial-gradient(circle at 99% 4%, rgba(120, 188, 243, .42) 0 108px, transparent 110px),
        linear-gradient(115deg, #f4edff 0%, #edf8ff 48%, #ffe9f1 100%);
}

body.auth-page .footer {
    margin-top: -52px;
    position: relative;
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: #0e57b8;
    --bs-btn-hover-border-color: #0e57b8;
    --bs-btn-active-bg: var(--accent-dark);
    --bs-btn-active-border-color: var(--accent-dark);
    font-weight: 800;
}

.login-submit.btn-primary {
    --bs-btn-bg: #6d5dfc;
    --bs-btn-border-color: #6d5dfc;
    --bs-btn-hover-bg: #5a49ee;
    --bs-btn-hover-border-color: #5a49ee;
    --bs-btn-active-bg: #4939d4;
    --bs-btn-active-border-color: #4939d4;
}

a {
    color: inherit;
}

.topbar {
    align-items: center;
    background: #0a2342;
    color: #fff;
    display: grid;
    gap: 18px;
    grid-template-columns: auto 1fr auto;
    min-height: 72px;
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    align-items: center;
    display: flex;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    white-space: nowrap;
}

.logo-mark {
    align-items: center;
    background: linear-gradient(135deg, #ffffff, #9fd0ff);
    border-radius: 8px;
    color: #0a3f86;
    display: inline-grid;
    font-size: 13px;
    font-weight: 950;
    height: 34px;
    letter-spacing: .4px;
    place-items: center;
    width: 34px;
}

.topnav {
    align-items: center;
    display: flex;
    gap: 8px;
    min-width: 0;
    overflow: visible;
}

.nav-link,
.nav-group summary,
.nav-group a,
.profile a {
    color: #e8edf3;
    text-decoration: none;
}

.nav-link,
.nav-group summary {
    border-radius: 7px;
    cursor: pointer;
    display: block;
    font-weight: 800;
    list-style: none;
    padding: 10px 12px;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary::after {
    content: "▾";
    font-size: 10px;
    margin-left: 8px;
}

.nav-group[open] summary,
.nav-link:hover,
.nav-group summary:hover,
.profile a:hover {
    background: #123a68;
}

.nav-group {
    position: relative;
}

.nav-group > div {
    background: #0f3159;
    border: 1px solid #24527f;
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .24);
    display: grid;
    gap: 4px;
    min-width: 190px;
    padding: 8px;
    position: absolute;
    top: calc(100% + 8px);
}

.nav-group a {
    border-radius: 7px;
    padding: 10px 11px;
}

.nav-group a:hover {
    background: #174c84;
}

.nav-section-label {
    color: #9fb6ce;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .08em;
    padding: 8px 11px 2px;
    text-transform: uppercase;
}

.compact-input {
    max-width: 88px;
}

.profile {
    align-items: center;
    display: grid;
    gap: 2px 10px;
    grid-template-columns: auto auto;
    color: #cbd5e1;
    font-size: 13px;
}

.profile strong {
    color: #fff;
}

.profile span {
    grid-column: 1 / -1;
}

.profile a {
    border-radius: 7px;
    font-weight: 800;
    padding: 5px 8px;
}

.main {
    padding: 28px;
    max-width: 100%;
}

.auth-main {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-shell {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(300px, 430px);
    max-width: 900px;
    width: min(100%, 900px);
}

.login-shell-bs {
    display: block;
    max-width: 1120px;
    width: min(100%, 1120px);
}

.login-frame {
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 24px;
    display: grid;
    grid-template-columns: minmax(360px, .82fr) minmax(460px, 1fr);
    overflow: hidden;
    width: 100%;
}

.login-hero {
    background: linear-gradient(160deg, #6d5dfc 0%, #8270ed 50%, #54bad9 100%);
    border-radius: 10px 0 0 10px;
    color: #fff;
    display: grid;
    gap: 32px;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    padding: 42px 48px;
}

.login-shell-bs .login-hero {
    border-radius: 0;
    min-height: 520px;
    position: relative;
}

.login-shell-bs .login-hero::after {
    background:
        radial-gradient(circle at 91% 6%, rgba(255, 255, 255, .15) 0 132px, transparent 134px),
        radial-gradient(circle at 5% 101%, rgba(255, 255, 255, .16) 0 82px, transparent 84px),
        linear-gradient(90deg, rgba(255, 255, 255, .08), transparent);
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.login-shell-bs .login-hero > * {
    position: relative;
    z-index: 1;
}

.logo-mark-large {
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 14px;
    color: #fff;
    font-size: 18px;
    height: 48px;
    width: 48px;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: 14px;
}

.login-brand strong {
    font-size: 30px;
    font-weight: 950;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.login-hero-copy {
    align-self: center;
    display: grid;
    gap: 18px;
}

.login-hero h1 {
    font-size: 40px;
    font-weight: 950;
    line-height: 1.12;
    margin: 0;
    max-width: 370px;
}

.login-hero p {
    color: rgba(255, 255, 255, .9);
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    max-width: 390px;
}

.login-hero ul {
    display: grid;
    gap: 14px;
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
}

.login-hero li {
    color: rgba(255, 255, 255, .92);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    padding-left: 30px;
    position: relative;
}

.login-hero li::before {
    align-items: center;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 8px;
    content: "✓";
    display: inline-grid;
    font-size: 11px;
    height: 18px;
    left: 0;
    place-items: center;
    position: absolute;
    top: 1px;
    width: 18px;
}

.login-hero small {
    color: rgba(255, 255, 255, .78);
    font-weight: 700;
}

.login-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.login-card {
    border-left: 0;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 18px 50px rgba(10, 35, 66, .16);
    justify-content: center;
    padding: 52px;
    width: 100%;
}

.login-shell-bs .login-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 520px;
    align-content: center;
    gap: 24px;
}

.login-card h2 {
    font-size: 32px;
    font-weight: 950;
    margin: 10px 0 4px;
}

.login-card-head p {
    color: #66758a;
    margin: 0;
}

.login-eyebrow {
    background: #ece8ff;
    border-radius: 999px;
    color: #5a48ee;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    padding: 6px 12px;
    text-transform: uppercase;
}

.telegram-link {
    align-items: center;
    background: #edf6ff;
    border: 1px solid #cfe6fb;
    border-radius: 16px;
    color: #2d4b67;
    display: inline-flex;
    gap: 14px;
    justify-content: space-between;
    padding: 14px 16px;
    text-decoration: none;
}

.telegram-link:hover {
    background: #e5f1ff;
    color: #20364c;
}

.telegram-link span:nth-child(2) {
    display: grid;
    flex: 1;
    gap: 2px;
}

.telegram-link strong {
    color: #2c4c68;
    font-size: 14px;
}

.telegram-link small {
    color: #60748c;
    font-size: 12px;
}

.telegram-icon {
    align-items: center;
    background: #3ca4eb;
    border-radius: 12px;
    color: #fff;
    display: inline-grid;
    font-size: 20px;
    font-weight: 900;
    height: 42px;
    place-items: center;
    width: 42px;
}

.login-input {
    align-items: center;
    background: #fbfdff;
    border: 1px solid #dbe5f0;
    border-radius: 14px;
    display: flex;
    gap: 10px;
    min-height: 52px;
    padding: 0 14px;
}

.login-input:focus-within {
    border-color: #8cb9f2;
    box-shadow: 0 0 0 4px rgba(17, 103, 216, .10);
}

.login-input i {
    color: #90a0b6;
    font-style: normal;
    font-weight: 900;
}

.login-input .form-control {
    background: transparent;
    border: 0;
    box-shadow: none;
    min-height: 50px;
    padding: 0;
}

.login-input .input-action {
    background: transparent;
    border: 0;
    color: #53657c;
    min-height: 36px;
    padding: 0 6px;
    width: auto;
}

.login-submit {
    border-radius: 14px;
    box-shadow: 0 16px 24px rgba(111, 88, 238, .22);
    min-height: 54px;
}

.login-footnote {
    color: #8794a7;
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.recaptcha-wrap {
    display: flex;
    justify-content: center;
    overflow-x: auto;
}

.page-head {
    margin-bottom: 18px;
}

.page-head h1,
.panel h2,
.login-card h1 {
    margin: 0 0 8px;
}

.page-head h1 {
    font-size: clamp(26px, 2.4vw, 36px);
    font-weight: 950;
    letter-spacing: 0;
}

.page-head p {
    color: var(--muted);
    margin: 0;
}

.muted-copy {
    color: var(--muted);
    margin: 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
}

.stats article {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.stats strong {
    display: block;
    font-size: 30px;
}

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

.overview-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    margin-bottom: 16px;
}

.overview-grid article {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.overview-grid strong {
    display: block;
    font-size: 28px;
}

.overview-grid span,
.server-card footer {
    color: var(--muted);
    font-size: 13px;
}

.server-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.server-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.server-card header {
    background: #2fb1a1;
    color: #fff;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 16px;
}

.server-card header strong {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.server-card header strong small {
    flex-basis: 100%;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    opacity: .82;
    padding-left: 32px;
}

.server-tool {
    align-items: center;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 6px;
    color: #fff;
    display: inline-grid;
    font-size: 13px;
    height: 24px;
    place-items: center;
    text-decoration: none;
    width: 24px;
}

.server-tool:hover {
    background: rgba(255, 255, 255, .28);
}

.server-state {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    padding: 4px 9px;
}

.server-state.connected {
    background: rgba(220, 250, 230, .25);
}

.server-state.down {
    background: rgba(254, 228, 226, .35);
}

.server-alert {
    background: #fee4e2;
    color: var(--danger);
    font-size: 13px;
    font-weight: 800;
    padding: 10px 16px;
}

.server-card.main-server header {
    background: #6554c0;
}

.server-metrics {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, 1fr);
    padding: 18px 16px;
    text-align: center;
}

.server-metrics span {
    color: var(--muted);
    font-size: 12px;
}

.server-metrics b {
    color: var(--ink);
    display: block;
    font-size: 14px;
}

.resource-bars {
    display: grid;
    gap: 8px;
    padding: 8px 16px 18px;
}

.resource-bars div {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 86px minmax(120px, 1fr);
}

.resource-bars span {
    color: var(--ink);
    font-size: 12px;
    white-space: nowrap;
}

.resource-bars b {
    font-variant-numeric: tabular-nums;
}

.resource-bars i {
    background: #e5e9ee;
    display: block;
    height: 14px;
    overflow: hidden;
    position: relative;
}

.resource-bars i::before {
    background: #26c281;
    content: "";
    inset: 0 auto 0 0;
    position: absolute;
    width: calc(var(--value) * 1%);
}

.server-card footer {
    border-top: 1px solid var(--line);
    padding: 10px 16px;
}

.panel {
    --bs-card-border-color: var(--line);
    --bs-card-border-radius: 10px;
    --bs-card-spacer-x: 22px;
    --bs-card-spacer-y: 22px;
    margin-bottom: 18px;
}

.panel.card {
    padding: 22px;
}

.panel h2 {
    font-size: 19px;
    font-weight: 950;
}

.form,
.grid-form {
    display: grid;
    gap: 14px;
}

.grid-form {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    align-items: end;
}

.form-fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    grid-column: 1 / -1;
    padding: 12px;
}

.form-fieldset legend {
    color: var(--ink);
    font-weight: 900;
    padding: 0 6px;
}

.check-grid {
    display: grid;
    gap: 8px 14px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    font: inherit;
    padding: 10px 11px;
    background: #fff;
}

.field-with-actions {
    align-items: stretch;
    display: flex;
    gap: 6px;
}

.field-with-actions input {
    min-width: 0;
}

.inline-secret-field {
    min-width: 320px;
}

.input-action {
    background: #eef5ff;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--accent-dark);
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 900;
    padding: 0 10px;
    width: auto;
}

.input-action:hover {
    background: #dcecff;
}

.form-control,
.form-select {
    border-color: var(--line);
    border-radius: 8px;
    color: var(--ink);
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: #8cb9f2;
    box-shadow: 0 0 0 .22rem rgba(17, 103, 216, .12);
}

.form-check {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 0;
    min-height: 42px;
    padding-left: 0;
}

.form-check .form-check-input {
    margin: 0;
    width: 1.05em;
}

textarea {
    resize: vertical;
}

button {
    border: 0;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    min-height: 40px;
    padding: 0 14px;
}

button:hover {
    filter: brightness(.94);
}

.btn {
    border-radius: 8px;
    font-weight: 850;
    min-height: 40px;
}

.btn-sm,
.compact.btn {
    min-height: 32px;
}

.button-link {
    align-items: center;
    background: var(--accent);
    border-radius: 7px;
    color: #fff;
    display: inline-flex;
    font-size: 14px;
    font-weight: 800;
    min-height: 38px;
    padding: 9px 14px;
    text-decoration: none;
    white-space: nowrap;
}

.button-link.secondary {
    background: #e8eef6;
    color: var(--ink);
}

.secondary-button {
    background: #e8eef6;
    color: var(--ink);
}

.form-actions {
    align-items: center;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-row {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-row h2 {
    margin: 0;
}

.edit-form {
    align-items: end;
}

.pager {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 14px;
}

.pager a {
    background: var(--accent-soft);
    border-radius: 7px;
    color: var(--accent-dark);
    font-weight: 800;
    padding: 8px 12px;
    text-decoration: none;
}

.pager a.active {
    background: var(--accent);
    color: #fff;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.table-wrap .dataTables_wrapper {
    min-width: 980px;
    padding: 12px;
}

.dataTables_wrapper .row {
    align-items: center;
    gap: 10px 0;
    margin: 0 0 10px;
}

.dataTables_wrapper .form-control,
.dataTables_wrapper .form-select {
    border-color: var(--line);
    border-radius: 7px;
    box-shadow: none;
    min-height: 38px;
}

.dataTables_wrapper .page-link {
    color: var(--accent-dark);
}

.dataTables_wrapper .active > .page-link,
.dataTables_wrapper .page-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.table {
    --bs-table-bg: #fff;
    --bs-table-hover-bg: #f6faff;
    --bs-table-border-color: var(--line);
}

.table > :not(caption) > * > * {
    padding: 10px 12px;
}

.data-table {
    background: #fff;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fbff;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.table th {
    background: #f8fbff;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tbody tr:nth-child(even) {
    background: #fbfdff;
}

.data-table tbody tr:hover {
    background: #eef6ff;
}

[data-content-rows].is-loading {
    opacity: .55;
}

code {
    display: inline-block;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

.copy-url {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(260px, 1fr) auto;
    min-width: 430px;
}

.copy-url code {
    max-width: none;
}

.copy-button {
    min-height: 34px;
    white-space: nowrap;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    min-width: 74px;
    padding: 5px 9px;
    text-align: center;
    text-transform: uppercase;
}

.status-pill.online {
    background: #dcfae6;
    color: var(--ok);
}

.status-pill.offline {
    background: #fee4e2;
    color: var(--danger);
}

.status-pill.unknown {
    background: #eef2f6;
    color: var(--muted);
}

.inline-edit {
    display: grid;
    grid-template-columns: 180px 90px 160px 150px 130px 90px 90px;
    gap: 8px;
    min-width: 980px;
}

.inline-mini {
    display: grid;
    gap: 8px;
    grid-template-columns: 150px 210px 90px 90px 110px;
    min-width: 690px;
}

.bouquet-picker {
    position: relative;
}

.bouquet-picker summary {
    background: var(--accent-soft);
    border-radius: 7px;
    color: var(--accent-dark);
    cursor: pointer;
    font-weight: 800;
    min-height: 40px;
    padding: 10px 12px;
}

.bouquet-picker > div {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 38px rgba(15, 23, 42, .18);
    min-width: 260px;
    padding: 12px;
    position: absolute;
    right: 0;
    top: 44px;
    z-index: 12;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.tabs a {
    background: var(--accent-soft);
    border-radius: 7px;
    color: var(--accent-dark);
    font-weight: 900;
    padding: 9px 12px;
    text-decoration: none;
}

.tabs a.active {
    background: var(--accent);
    color: #fff;
}

.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.stream-edit {
    display: grid;
    gap: 8px;
    grid-template-columns: 160px 130px 240px 110px 150px 130px 120px 86px 86px;
    min-width: 1320px;
}

.content-edit {
    display: grid;
    gap: 8px;
    grid-template-columns: 160px 130px 150px 240px 150px 240px 80px 130px 110px 120px 86px 86px;
    min-width: 1680px;
}

.content-edit.series-edit {
    grid-template-columns: 150px 120px 140px 220px 150px 240px 80px 150px 80px 80px 120px 110px 120px 86px 86px;
    min-width: 1960px;
}

.content-edit .check {
    align-items: center;
    display: flex;
    gap: 6px;
}

.content-edit .check input {
    width: auto;
}

.stream-edit .check {
    align-items: center;
    display: flex;
    gap: 6px;
}

.stream-edit .check input {
    width: auto;
}

.balancer-edit {
    display: grid;
    gap: 8px;
    grid-template-columns: 140px 120px 220px 130px 80px 130px 86px 86px;
    min-width: 1090px;
}

.balancer-edit .check {
    align-items: center;
    display: flex;
    gap: 6px;
}

.balancer-edit .check input {
    width: auto;
}

.category-edit {
    display: grid;
    gap: 8px;
    grid-template-columns: 180px 150px 90px;
    min-width: 440px;
}

.category-actions {
    align-items: start;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(440px, auto) auto;
    min-width: 560px;
}

.category-actions .muted-copy {
    grid-column: 1 / -1;
    font-size: 12px;
}

.package-prices {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(6, minmax(90px, 1fr));
}

.package-prices label {
    min-width: 0;
}

.package-edit {
    display: grid;
    gap: 8px;
    grid-template-columns: 170px 220px 95px 95px minmax(620px, 1fr) 90px;
    min-width: 1320px;
}

.compact-prices {
    grid-template-columns: repeat(12, minmax(48px, 1fr));
}

.price-chip {
    background: var(--accent-soft);
    border-radius: 999px;
    color: var(--accent-dark);
    display: inline-block;
    font-size: 12px;
    font-weight: 850;
    margin: 2px;
    padding: 4px 8px;
}

.balancing-edit {
    display: grid;
    gap: 8px;
    grid-template-columns: 150px 90px 110px 130px 110px 90px;
    min-width: 760px;
}

.danger-panel {
    border-color: #fecaca;
}

.danger-button {
    background: var(--danger);
}

.warning-button {
    background: #f59e0b;
    color: #111827;
}

.danger-button.compact {
    min-height: 32px;
    padding: 0 10px;
}

.process-toolbar {
    display: grid;
    gap: 14px;
}

.process-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mini-bar {
    background: #e5e9ee;
    display: inline-block;
    height: 10px;
    margin-right: 8px;
    overflow: hidden;
    vertical-align: middle;
    width: 90px;
}

.mini-bar i {
    background: #1167d8;
    display: block;
    height: 100%;
    width: calc(var(--value) * 1%);
}

.process-table {
    min-width: 1180px;
}

.process-table code {
    max-width: 420px;
}

.movie-poster {
    background: #edf2f7;
    border: 1px solid var(--line);
    border-radius: 4px;
    display: block;
    height: 50px;
    object-fit: cover;
    width: 33px;
}

.poster-empty {
    color: var(--muted);
    display: inline-block;
    font-size: 11px;
    width: 38px;
}

.wide-field {
    grid-column: 1 / -1;
}

.movie-action-grid {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(280px, 1fr) repeat(4, auto);
}

.vod-progress {
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 12px;
}

.vod-progress.is-running {
    background: #fffbeb;
    border-color: #fbbf24;
}

.vod-progress.is-done {
    background: #ecfdf3;
    border-color: #86efac;
}

.vod-progress.is-error {
    background: #fef2f2;
    border-color: #fca5a5;
}

.vod-progress__head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.vod-progress__bar {
    background: #e5e9ee;
    border-radius: 999px;
    height: 13px;
    overflow: hidden;
}

.vod-progress__bar i {
    background: #f59e0b;
    display: block;
    height: 100%;
    transition: width .35s ease;
    width: calc(var(--value) * 1%);
}

.vod-progress.is-done .vod-progress__bar i {
    background: #16a34a;
}

.vod-progress.is-error .vod-progress__bar i {
    background: var(--danger);
}

.dense-table th,
.dense-table td {
    padding: 9px 10px;
}

.poster-thumb {
    border-radius: 5px;
    display: block;
    height: 50px;
    object-fit: cover;
    width: 34px;
}

.queue-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.queue-progress {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(110px, 1fr) auto;
    min-width: 170px;
}

.queue-row.is-running {
    background: #fffdf3;
}

.queue-row.is-done {
    background: #f0fdf4;
}

.queue-row.is-error {
    background: #fff5f5;
}

.install-form {
    display: grid;
    gap: 8px;
    grid-template-columns: 140px 90px;
    min-width: 240px;
}

.muted-line {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.settings-form h2 {
    margin: 8px 0 0;
}

.setting-check {
    align-items: center;
    display: flex;
    gap: 8px;
    min-height: 42px;
}

.setting-check input {
    width: auto;
}

.bulk-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, .8fr) minmax(260px, 1fr);
}

.bulk-grid .check {
    align-self: end;
    min-height: 42px;
}

.bulk-confirm {
    margin: 4px 0;
    padding: 14px;
}

.mass-delete-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.mass-delete-card {
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: var(--ink);
    display: grid;
    gap: 8px;
    padding: 16px;
    text-decoration: none;
}

.mass-delete-card.active,
.mass-delete-card:hover {
    background: #fff7f7;
    border-color: #f97066;
}

.mass-delete-card strong {
    font-size: 18px;
    font-weight: 950;
}

.mass-delete-card span {
    color: var(--danger);
    font-weight: 950;
}

.mass-delete-card small {
    color: var(--muted);
    line-height: 1.4;
}

.mass-delete-confirm {
    max-width: 720px;
}

.delete-warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    color: #7c2d12;
    display: grid;
    gap: 6px;
    padding: 14px;
}

.footer {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    padding: 0 28px 24px;
    text-align: center;
}

.install-modal {
    align-items: center;
    background: rgba(17, 24, 39, .48);
    display: grid;
    inset: 0;
    padding: 22px;
    position: fixed;
    z-index: 50;
}

.install-modal[hidden] {
    display: none;
}

.install-modal__card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(15, 23, 42, .24);
    margin: auto;
    max-width: 520px;
    padding: 24px;
    width: min(100%, 520px);
}

.install-modal__card h2 {
    margin: 0 0 8px;
}

.install-modal__card p {
    color: var(--muted);
    margin: 0 0 16px;
}

.install-progress {
    background: #edf0f4;
    border-radius: 999px;
    height: 14px;
    margin-bottom: 10px;
    overflow: hidden;
}

.install-progress span {
    background: linear-gradient(90deg, #1167d8, #58a9ff);
    display: block;
    height: 100%;
    transition: width .35s ease;
}

.install-modal__card pre {
    background: #0a2342;
    border-radius: 7px;
    color: #e5e7eb;
    margin: 14px 0 0;
    max-height: 220px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.access-modal {
    align-items: center;
    background: rgba(10, 35, 66, .55);
    display: grid;
    inset: 0;
    padding: 22px;
    position: fixed;
    z-index: 60;
}

.access-modal[hidden] {
    display: none;
}

.access-modal__card {
    background: #fff;
    border: 1px solid #dce8f5;
    border-radius: 8px;
    box-shadow: 0 22px 70px rgba(15, 23, 42, .28);
    margin: auto;
    max-width: 720px;
    overflow: hidden;
    width: min(100%, 720px);
}

.access-modal__head {
    align-items: start;
    background: linear-gradient(135deg, #0a2342, #1167d8);
    color: #fff;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 22px;
}

.access-modal__head h2 {
    margin: 0 0 4px;
}

.access-modal__head p {
    color: #dbeafe;
    margin: 0;
}

.access-modal__body {
    display: grid;
    gap: 12px;
    padding: 22px;
}

.access-modal__body textarea {
    background: #f8fbff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    min-height: 82px;
}

.icon-button {
    align-items: center;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 7px;
    display: inline-grid;
    font-size: 24px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    place-items: center;
    width: 38px;
}

.table-icon-button {
    background: #eef5ff;
    border-color: var(--line);
    color: var(--accent-dark);
    display: inline-grid;
    font-size: 18px;
    text-decoration: none;
}

.table-icon-button:hover {
    background: #dcecff;
    color: var(--accent-dark);
}

.customer-summary {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.customer-summary span {
    background: #f6f9fd;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    padding: 12px;
}

.customer-summary strong {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.modal-warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 7px;
    color: #9a3412;
    font-size: 13px;
    font-weight: 700;
    margin: 2px 0 0;
    padding: 10px 12px;
}

details pre {
    max-height: 180px;
    max-width: 520px;
    overflow: auto;
    white-space: pre-wrap;
}

.inline-edit .check {
    align-items: center;
    display: flex;
    gap: 6px;
}

.inline-edit .check input {
    width: auto;
}

.flash {
    border-radius: 7px;
    margin-bottom: 14px;
    padding: 12px 14px;
}

.flash.success {
    background: #dcfae6;
    color: var(--ok);
}

.flash.error {
    background: #fee4e2;
    color: var(--danger);
}

.password-form {
    max-width: 520px;
}

.password-rules {
    color: var(--muted);
    display: grid;
    gap: 6px;
    list-style: none;
    margin: -4px 0 0;
    padding: 0;
}

.password-rules li::before {
    content: "○";
    margin-right: 8px;
}

.password-rules li.valid {
    color: var(--ok);
    font-weight: 800;
}

.password-rules li.valid::before {
    content: "✓";
}

@media (max-width: 900px) {
    .auth-main {
        min-height: auto;
        padding: 16px;
    }

    body.auth-page .footer {
        margin-top: 0;
        padding-bottom: 18px;
    }

    .topbar {
        align-items: stretch;
        gap: 12px;
        grid-template-columns: 1fr;
        padding: 12px 14px;
        position: relative;
    }

    .topnav {
        align-items: stretch;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .nav-link,
    .nav-group summary {
        white-space: nowrap;
    }

    .nav-group > div {
        position: static;
        box-shadow: none;
    }

    .main {
        padding: 18px;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-shell-bs {
        padding: 0;
    }

    .login-frame {
        border-radius: 12px;
        grid-template-columns: 1fr;
    }

    .login-hero {
        border-radius: 10px 10px 0 0;
        padding: 28px;
    }

    .login-brand strong {
        font-size: 22px;
    }

    .login-hero h1 {
        font-size: 31px;
    }

    .login-hero ul {
        gap: 10px;
    }

    .login-shell-bs .login-hero,
    .login-shell-bs .login-card {
        min-height: auto;
    }

    .login-card {
        border-left: 1px solid var(--line);
        border-radius: 0 0 10px 10px;
        padding: 28px;
    }

    .login-card h2 {
        font-size: 27px;
    }

    .telegram-link {
        align-items: flex-start;
        border-radius: 12px;
    }

    .recaptcha-wrap {
        justify-content: flex-start;
    }

    .stats,
    .overview-grid,
    .grid-form,
    .server-grid,
    .bulk-grid {
        grid-template-columns: 1fr;
    }

    .section-row {
        align-items: stretch;
        flex-direction: column;
    }

    .profile {
        grid-template-columns: 1fr auto auto;
    }

    .profile span {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .auth-main {
        padding: 10px;
    }

    .login-frame {
        border-radius: 10px;
    }

    .login-hero {
        gap: 22px;
        padding: 24px;
    }

    .login-shell-bs .login-hero::after {
        opacity: .72;
    }

    .login-hero h1 {
        font-size: 28px;
    }

    .login-hero p,
    .login-hero li {
        font-size: 13px;
    }

    .login-card {
        gap: 18px;
        padding: 22px;
    }

    .login-card h2 {
        font-size: 24px;
    }

    .telegram-icon {
        height: 36px;
        width: 36px;
    }

    .login-input {
        min-height: 48px;
    }

    .topnav {
        margin-inline: -2px;
    }

    .main {
        padding: 14px 10px;
    }

    .panel {
        padding: 16px;
    }

    .table-wrap .dataTables_wrapper,
    table {
        min-width: 760px;
    }
}
