@import "users.css";
@import "checkbox.css";
@import "datatables.css";

:root {
    --primary-color: #ffffff;              /* Білий текст */
    --secondary-color: #1f2a38;            /* Темний фон блоків */
    --secondary-text: #a0b0c0;             /* Світло-сірий з блакитним */
    --helper-text: #7f8fa0;                /* Допоміжний текст */
    --danger-color: #ff4c4c;               /* Червоний для помилок */
    --background-color: linear-gradient(180deg, #2c3e50, #5dade2); /* Градієнт сірого та темного блакитного */
    --item-background: #FFFFFF12;            /* Темно-сірий фон карток */
    --highlight-color: #5dade2;            /* Яскравий блакитний для виділення */
    --highlight-gradient: linear-gradient(135deg, #5dade2, #3498db); /* Градієнт для акцентів */
    --divider-color: #3a4a5a;              /* Лінії та роздільники */
    --hover-background: #34495e;           /* Темний фон при ховері */
    --hover-background-opaque: rgba(52, 73, 94, 0.7); /* Прозорий ховер */
    --hover-danger: #ff6b6b;               /* Інтенсивний червоний при ховері на помилку */
    --footer-color: #1c2531;               /* Темний фон футера */
    --msg-color: #4a657d;                  /* Повідомлення, сірий з блакитним */
    --pop-up-background: #2c3e50;          /* Фон спливаючих вікон */
    --button-bg: linear-gradient(135deg, #2980b9, #1f3f5a);       /* Градієнт кнопки */
    --button-hover: linear-gradient(135deg, #3498db, #2c5a80);    /* Градієнт кнопки при ховері */
    --start-color: #2980b9;               /* Початок градієнта кнопки */
    --start-gradient: #3498db;            /* Альтернативний градієнт для акценту */
    --stop-color: #1f3f5a;                /* Кінець градієнта кнопки */
    --stop-gradient: #2c5a80;             /* Кінець градієнта при ховері */
}

html, body {
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    color: var(--primary-color);
    background: var(--background-color);
    font-family: Verdana, sans-serif;
    min-height: 100vh;
    width: 100vw;
    max-width: 1700px;
}
body {
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
*, *::before, *::after {
    box-sizing: inherit;
}
.header, .footer {
    display: flex;
    background: var(--footer-color);
    align-items: center;
    justify-content: space-between;
    padding-inline: 20px;
}
.header img{
    height: 50px;
    margin-inline-end: 30px;
}
.header .button{
    width: unset !important;
}
.header nav{
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.header nav a {
    color: #ccc;
    text-decoration: none;
}
.header nav a:hover {
    color: white;
}
.header .logo{
    display: flex;
    align-items: center;
}
a {
    color: inherit;
    text-decoration: none;
}
.hamburger-menu {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.hamburger-icon {
    width: 30px;
    height: 30px;
    background-size: cover;
    cursor: pointer;
}

.menu-items {
    display: none;
    position: absolute;
    top: 40px;
    right: 0;
    background: var(--hover-background-opaque);
    padding: 0;
    list-style: none;
    width: max-content;
    border-radius: 10px;
    z-index: 5;
}

.menu-items li {
    padding: 5px 20px;
    border-bottom: 2px solid var(--divider-color);
    border-radius: 10px;
    cursor: pointer;
}

.menu-items li a,
.menu-items li button {
    all: unset;
    text-decoration: none;
    display: block;
}

.menu-items li a:hover,
.menu-items li button:hover {
    text-decoration: underline;
}
.hamburger-menu.active .menu-items {
    display: block;
}
.home{
    display: flex;
    justify-content: space-around;
    gap: 2rem;
    padding: 20px;
    max-width: 1300px;
    margin: auto;
}
input, textarea, select, .input{
    border: none;
    border-radius: 12px;
    padding: 12px;
    background: var(--item-background);
    width: 100%;
    color: var(--primary-color);
}
input::placeholder {
  color: var(--secondary-text);
}
input::placeholder { var(--secondary-text); }
input::-webkit-input-placeholder { var(--secondary-text); } /* Chrome, Safari */
input:-ms-input-placeholder { var(--secondary-text); }     /* IE 10+ */
input::-ms-input-placeholder { var(--secondary-text); }    /* Edge */

input[disabled],
select[disabled],
textarea[disabled],
.disabled-field {
    background-color: var(--pop-up-background) !important;
    cursor: not-allowed;
    opacity: 0.7;
    transition: background-color 0.2s ease, color 0.2s ease;
}

textarea {
    overflow: auto;
}
/* Chrome, Safari, Opera */
textarea::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}
/* Firefox */
textarea {
    scrollbar-width: none;
}
/* IE 10+ */
textarea {
    -ms-overflow-style: none;
}
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='2' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
    padding-right: 36px;
    cursor: pointer;
}

/* Опційно: ховер / фокус */
input:focus, textarea:focus, select:focus, .input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color-light);
}
.form .checkbox-input{
    width: unset !important;
    margin-right: 20px;
}
.button{
    all: unset;
    box-sizing: border-box;
    align-items: center;
    text-align: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 13.3px;
    background: var(--item-background);
    backdrop-filter: blur(75px);
    -webkit-backdrop-filter: blur(75px);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}
.button img{
    max-height: 20px;
}
.button:hover{
    background: var(--button-hover);
}
.button.dangerous:hover{
    background: var(--danger-color);
}
.button-with-background{
    width: 100%;
    background: var(--highlight-gradient);
}

.blocked-clients-page {
    padding: 32px 24px;
}

.blocked-clients-heading,
.blocked-clients-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.blocked-clients-heading {
    justify-content: space-between;
}

.blocked-clients-heading .button,
.blocked-clients-actions .button {
    width: auto;
    white-space: nowrap;
}

.blocked-clients-table-wrap {
    overflow-x: auto;
}

.blocked-clients-table {
    width: 100%;
    border-collapse: collapse;
}

.blocked-clients-table th,
.blocked-clients-table td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--divider-color);
    text-align: left;
}

.blocked-clients-table th {
    white-space: nowrap;
}

.blocked-clients-actions {
    flex-wrap: wrap;
}

.btn-secondary{
    max-width: fit-content;
    margin: 10px;
}
.content {
    padding: 20px;
    max-width: 1000px;
    margin: 20px auto;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.container{
    margin: 10px auto;
    width: 80%;
    max-width: 1000px;
    gap: 1rem;
    display: grid;
}

.footer {
    text-align: center;
    padding: 10px;
    color: #888;
    border-top: 1px solid #ddd;
    margin-top: 40px;
}

table {
    width: 100%;
    border-collapse: separate; /* важливо для gap між рядками */
    border-radius: 15px;       /* закруглення тільки зовнішніх кутів */
    overflow: hidden;          /* обрізаємо кути всередині */
}

th, td {
    padding: 12px 16px;
    border: none; /* прибираємо звичайні рамки */
}

th {
    background: var(--secondary-color);
    color: #fff;
    text-align: left;
    padding: 14px 16px;
}

tr {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.form-container {
    max-width: 800px;
    gap: 1rem;
    display: grid;
}

.client-block-form {
    width: 100%;
}
.client-block-button {
    width: 100%;
    background: rgba(185, 28, 28, .5);
}
.client-block-button:hover {
    background: rgba(185, 28, 28);
}
.client-block-button-unblock {
    background: rgba(22, 163, 74, .5);
}
.client-block-button-unblock:hover {
    background: rgba(22, 163, 74);
}
.client-block-reason {
    overflow-wrap: anywhere;
}
.network-card-history {
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
}
.network-card-history > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 1rem;
    cursor: pointer;
    list-style: none;
    font-size: 1.5em;
    font-weight: 700;
}
.network-card-history > summary::-webkit-details-marker {
    display: none;
}
.network-card-history > summary::after {
    content: "▼";
    margin-left: 12px;
    font-size: 0.8em;
    line-height: 1;
    transition: transform 0.3s ease;
}
.network-card-history:not([open]) > summary {
    margin-bottom: 0;
}
.network-card-history:not([open]) > summary::after {
    transform: rotate(-180deg);
}
.network-card-history p {
    margin: 0;
    color: var(--secondary-text);
}
.network-card-list {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.network-card-item {
    min-width: 0;
}
.network-card-value {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.network-card-meta {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    margin-top: 15px;
    font-size: 13px;
    align-items: baseline;
}
.network-card-status {
    color: #c8f9d7;
}
.network-card-status-blocked {
    color: #fecaca;
}
.network-card-user-count {
    position: relative;
    cursor: help;
}
.network-card-users-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 10;
    width: max-content;
    max-width: min(320px, calc(100vw - 48px));
    padding: 10px 12px;
    border: 1px solid var(--divider-color);
    border-radius: 8px;
    background: var(--secondary-color);
    color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.network-card-user-count:hover .network-card-users-tooltip,
.network-card-user-count:focus-within .network-card-users-tooltip {
    display: block;
}
.network-card-users-tooltip ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.network-card-users-tooltip li + li {
    margin-top: 4px;
}
.network-card-block-form {
    display: flex;
    justify-content: flex-end;
}
.network-card-block-form .button {
    width: auto;
    padding: 8px 12px;
    font-size: 13px;
}
#client-table tbody tr.client-blocked td:not(.actions) {
    color: #9ca3af;
}
.form-table th {
    text-align: left;
    width: 200px;
    vertical-align: top;
}
.form-actions {
    margin-top: 20px;
}
.delete-btn {
    background: #dc3545;
    color: #fff;
}
.delete-btn:hover {
    background: #c82333;
}
.error, .errorlist {
    color: red;
    font-size: 0.9em;
}
.messages {
    list-style: none;
    padding: 0;
}
.messages li {
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 10px;
}
.messages li.success { background: #d4edda; color: #155724; }
.messages li.error { background: #f8d7da; color: #721c24; }

.sections {
  display: flex;
  gap: 20px;
}
.sections div {
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 8px;
}
#queue {
  display: none;
  align-items: baseline;
}
#queue p{
  margin-block: 5px;
}
.actions{
    display: flex;
    gap: 1rem;
}
.form{
    background-color: rgba(0, 0, 0, .1);
    height: fit-content;
    min-width: 250px;
    border-radius: 15px;
    text-align: center;
    padding: 10px;
}
.form-banner{
    background-color: rgba(0, 0, 0, .1);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    height: fit-content;
    min-width: 250px;
    border-radius: 15px;
    padding: 10px;
    max-width: 600px;
}
.form-banner div{
    display: grid;
    gap: 5px;
}
.controls-horizontal{
    margin-left: 0;
    display: flex;
    gap: 5px;
    align-items: baseline;
    justify-content: space-between;
    justify-items: start;
}
.controls-horizontal span{
    white-space: nowrap;
}
.form-group{
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 270px;
    margin: 15px;
    justify-content: space-between;
}
.total{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 1rem;
}
.total .title{
    display: flex;
    justify-content: center;
    align-items: baseline;
    min-width: 150px;
}
.total .title p{
    margin-block: 10px 0;
}
.emoji{
    font-size: x-large;
}
.total h2{
    margin-bottom: 0;
    white-space: nowrap;
}
.help{
    font-size: x-small;
}
.items-list{
    width: 100%;
    display: flex;
    gap: 10px;
    flex-direction: column;
    max-height: 500px;
    flex-wrap: wrap;
    align-items: center;
}
.item{
    background: var(--item-background);
    border-radius: 15px;
    padding: 10px 20px;
    min-width: 190px;
    height: fit-content;
}
.sort-item{
    width: 50%;
    height: fit-content;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}
.sort-item .carousel-item{
    max-width: 400px;
}
.form-header{
    display: flex;
    justify-content: flex-start;
    align-items: center;
}
.account-list{
    display: grid;
    gap: 1rem;
}
.account{
    display: grid;
    justify-content: space-between;
    align-items: center;
    grid-template-columns: 2fr 1fr 3fr;
    gap: 16px;
}
.account-deleted {
    border: 1px solid var(--danger-color);
    background: rgba(255, 76, 76, 0.12);
    opacity: 0.72;
}
.deleted-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--danger-color);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.account-links {
    display: grid;
    gap: 8px;
    width: 190px;
    min-width: 0;
}
.link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    align-items: center;
    gap: 6px;
}
.compact-link {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 6px 9px;
    border-radius: 8px;
    background: var(--item-background);
    color: var(--primary-color);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.compact-link:hover {
    background: var(--hover-background);
    text-decoration: underline;
}
.copy-link-button {
    width: 58px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 6px 9px;
    background: transparent;
    color: var(--primary-color);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.copy-link-button:hover,
.copy-link-button.copied {
    border-color: var(--highlight-color);
    color: var(--primary-color);
}
@media (max-width: 900px) {
    .account {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .compact-link {
        max-width: 160px;
    }
    .account-links {
        width: min(100%, 260px);
    }
}
.stat{
    display: flex;
    gap: 10px;
}
.stat .colum{
    display: grid;
    justify-items: center;
    gap: 10px;
    width: 80px;
    word-wrap: break-word;
}
.stat .colum p{
    width: 110px;
    margin-block: 0;
    text-align: center;
    overflow-wrap: break-word;
}
.logs{
    display: grid;
    gap: 1rem;
    height: fit-content;
}
.user-content{
    width: 100%;
    min-width: 0;
    margin-top: 40px;
}
.div-404{
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    height: 80vh;
}
.img-404{
    height: 100%;
}
.settings{
    display: flex;
    justify-content: flex-start;
    gap: 2rem;
    padding: 20px;
    max-width: 1300px;
    margin: auto;
}
.settings .form {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: space-around;
    height: 250px;
    min-width: 450px;
}

.settings .form div{
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 70%;
}
.settings .form div input{
    width: 100px;
    text-align: center;
}
.field-error{
    color: var(--danger-color);
}
.order-form{
    display: grid;
    gap: 1rem;
    justify-items: center;
}
.order-form .button{
    max-width: 300px;
}
.page{
    margin: 20px;
}
.page.edit-banner{
    display: flex;
    align-items: center;
    gap: 1rem;
}
.form-header.for-banner{
    justify-content: space-between;
    white-space: nowrap;
    margin-inline: 20px;
}

.carousel-item{
    position: relative;
    background: var(--item-background);
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 4 / 1;
    height: auto;
    border-radius: 20px;
    overflow: hidden;
}
.carousel-item img{
    height: 100%;
    width: 100%;
}
.settings-block{
    display: flex;
    gap: 1rem;
    align-items: baseline;
    white-space: nowrap;
}
.tariff-form{
    display: grid;
    justify-items: start;
    gap: 1rem;
}
.link{
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.link a{
    white-space: nowrap;
}


/* Mobile-only UI helpers. Hidden by default to preserve the original desktop. */
.mobile-form-title,
.mobile-list-heading,
.mobile-premium-filter,
.mobile-field-label,
.mobile-status-value,
.mobile-order-label,
.mobile-banner-list-heading,
.mobile-banner-active-label {
    display: none;
}

@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        min-height: 100%;
        overflow-x: hidden;
        font-size: 16px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    body {
        background-attachment: scroll;
    }

    p,
    h1,
    h2,
    h3,
    label,
    th,
    td,
    a,
    button {
        overflow-wrap: anywhere;
    }

    .header {
        min-height: 76px;
        padding: 10px 16px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, .24);
    }

    .header img {
        height: 46px;
        margin-inline-end: 12px;
    }

    .header h1 {
        margin: 0;
        font-size: 25px;
    }

    .hamburger-icon {
        width: 36px !important;
        height: 36px !important;
        margin: 0 !important;
    }

    .menu-items {
        position: fixed;
        top: 68px;
        right: 12px;
        width: min(300px, calc(100vw - 24px));
        max-height: calc(100svh - 82px);
        overflow-y: auto;
        background: rgba(28, 37, 49, .98);
        box-shadow: 0 10px 30px rgba(0, 0, 0, .32);
    }

    .menu-items li {
        padding: 15px 20px;
        font-size: 17px;
    }

    .home {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 16px;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 16px;
    }

    .home > .container {
        display: contents !important;
    }

    .home > .form {
        order: 2;
    }

    .home > .container > .total {
        order: 1;
    }

    .home > .container > .mobile-list-heading {
        order: 3;
    }

    .home > .container > .mobile-premium-filter {
        order: 4;
    }

    .home > .container > .dataTables_wrapper,
    .home > .container > #client-table {
        order: 5;
    }

    .home > .container > .logs {
        order: 6;
    }

    .form {
        width: 100%;
        min-width: 0;
        max-width: none;
        padding: 20px;
        border: 1px solid rgba(255, 255, 255, .1);
        border-radius: 20px;
        background: rgba(11, 43, 72, .72);
        text-align: left;
    }

    .desktop-form-title {
        display: none;
    }

    .mobile-form-title {
        display: block;
        margin: 0 0 20px;
        font-size: 25px;
        line-height: 1.2;
    }

    .form-group,
    .form .form-group {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 8px;
        width: 100%;
        max-width: none;
        margin: 0 0 18px;
    }

    .form-group > label:first-child {
        font-size: 16px;
        font-weight: 500;
    }

    input,
    textarea,
    select,
    .input {
        min-width: 0;
        min-height: 52px;
        padding: 14px 16px;
        border-radius: 13px;
        font-size: 16px;
        line-height: 1.35;
    }

    textarea {
        min-height: 120px;
    }

    input[type="checkbox"] {
        min-height: 0;
    }

    .form-actions {
        width: 100%;
        margin-top: 22px;
    }

    .form-actions .button,
    .form > .button,
    .client-block-form .button,
    #reset-btn,
    .tariff-form > .button,
    .order-form > .button {
        display: flex;
        justify-content: center;
        width: 100% !important;
        min-height: 54px;
        padding: 14px 18px;
        font-size: 17px;
    }

    .form-actions .button,
    .tariff-form > .button,
    .order-form > .button {
        background: var(--highlight-gradient);
    }

    .checkbox-ios {
        align-self: flex-start;
        min-height: 32px;
    }

    .controls-horizontal {
        display: flex;
        width: 100%;
        min-width: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .controls-horizontal > input {
        width: 100%;
    }

    .ratio-inline {
        align-items: stretch;
    }

    .ratio-separator {
        display: none;
    }

    .mobile-field-label {
        display: block;
        margin-top: 4px;
        font-size: 16px;
        font-weight: 500;
    }

    .field-error,
    .error,
    .errorlist {
        max-width: 100%;
        margin: 2px 0 0;
        font-size: 14px;
    }

    /* Equal-size dashboard statistic cards. */
    .home > .container > .total,
    .user-content > .total {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: 100%;
    }

    .home > .container > .total .item,
    .user-content > .total .item {
        display: flex;
        min-width: 0;
        height: 112px;
        padding: 14px;
        flex-direction: column;
        justify-content: space-between;
        border-radius: 18px;
    }

    .home > .container > .total .title,
    .user-content > .total .title {
        min-width: 0;
    }

    .home > .container > .total .title p,
    .user-content > .total .title p,
    .home > .container > .total h2,
    .user-content > .total h2,
    .user-content > .total .help {
        margin: 0;
    }

    .home > .container > .total .title p,
    .user-content > .total .title p {
        font-size: 14px;
        line-height: 1.25;
    }

    .home > .container > .total h2,
    .user-content > .total h2 {
        font-size: clamp(18px, 5.2vw, 23px);
        line-height: 1.1;
        white-space: normal;
    }

    .user-content > .total .help {
        font-size: 11px;
        line-height: 1.25;
    }

    /* Mobile client/admin list heading and filters. */
    .mobile-list-heading {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        margin: 2px 0 -16px;
        padding: 18px 18px 0;
        border-radius: 20px 20px 0 0;
        background: rgba(11, 43, 72, .72);
    }

    .mobile-list-heading h2 {
        margin: 0;
        font-size: 25px;
        overflow-wrap: normal;
        white-space: nowrap;
    }

    .mobile-list-heading p {
        margin: 0 0 3px;
        color: var(--secondary-text);
        font-size: 13px;
        overflow-wrap: normal;
        white-space: nowrap;
    }

    .mobile-premium-filter {
        display: flex;
        flex-direction: column;
        gap: 7px;
        width: 100%;
        margin-bottom: -16px;
        padding: 14px 18px 0;
        background: rgba(11, 43, 72, .72);
        font-size: 14px;
    }

    .mobile-premium-filter select {
        width: 100%;
    }

    .dataTables_wrapper {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 14px 18px 18px;
        border-radius: 0 0 20px 20px;
        background: rgba(11, 43, 72, .72);
        overflow: visible;
    }

    .dataTables_filter,
    .dataTables_filter label {
        display: flex;
        width: 100%;
        align-items: center;
        margin: 0 0 14px;
    }

    .dataTables_filter label {
        font-size: 0;
    }

    .dataTables_filter input {
        width: 100%;
        min-height: 50px;
        margin: 0 !important;
        padding-left: 44px;
        font-size: 16px;
        background-color: var(--item-background);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: 15px center;
    }

    /* Replace desktop user tables with touch-friendly cards. */
    .admin-users-table,
    .admin-users-table tbody {
        display: block;
        width: 100% !important;
    }

    .admin-users-table thead {
        display: none;
    }

    .admin-users-table tbody {
        display: grid;
        gap: 10px;
    }

    .admin-users-table tbody tr {
        display: grid;
        position: relative;
        width: 100%;
        min-height: 98px;
        margin: 0;
        padding: 14px;
        align-items: center;
        border: 1px solid rgba(255, 255, 255, .08);
        border-radius: 17px;
        background: var(--item-background);
        box-shadow: none;
        cursor: pointer;
    }

    .admin-users-table tbody tr:hover {
        transform: none;
        box-shadow: none;
    }

    .admin-users-table tbody tr:active {
        background: var(--hover-background-opaque);
    }

    .admin-users-table tbody tr:focus-visible {
        outline: 3px solid var(--highlight-color);
        outline-offset: 2px;
    }

    .admin-users-table tbody tr::before {
        content: attr(data-initial);
        display: grid;
        width: 58px;
        height: 58px;
        place-items: center;
        border-radius: 50%;
        background: var(--highlight-gradient);
        font-size: 23px;
        font-weight: 700;
        text-transform: uppercase;
    }

    .admin-users-table tbody td {
        display: block;
        min-width: 0;
        padding: 0;
        border: 0;
        background: transparent;
        overflow-wrap: anywhere;
    }

    .client-mobile-table tbody tr {
        grid-template-columns: 58px minmax(0, 1fr) 92px;
        grid-template-areas:
            "avatar login actions"
            "avatar premium actions"
            "leads leads actions";
        column-gap: 12px;
        row-gap: 6px;
    }

    .client-mobile-table tbody tr::before {
        grid-area: avatar;
    }

    #client-table.client-mobile-table tbody tr.client-blocked::before {
        background: rgba(255, 255, 255, .12);
        color: #9ca3af;
    }

    .client-mobile-table .column-login {
        grid-area: login;
        font-size: 17px;
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .client-mobile-table .column-is_premium {
        grid-area: premium;
        width: fit-content;
        padding: 4px 9px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .12);
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .client-mobile-table .column-is_premium::before {
        content: none;
    }

    .client-mobile-table .column-is_premium[data-state="true"] {
        border: 1px solid rgba(74, 222, 128, .42);
        background: rgba(22, 163, 74, .28);
        color: #c8f9d7;
        box-shadow: 0 0 14px rgba(34, 197, 94, .12);
    }

    .client-mobile-table .column-is_premium[data-state="false"] {
        border: 1px solid rgba(255, 255, 255, .08);
        background: rgba(255, 255, 255, .08);
        color: var(--secondary-text);
    }

    .client-mobile-table .column-leads {
        display: flex;
        grid-area: leads;
        align-items: baseline;
        gap: 8px;
        font-size: 20px;
        font-weight: 700;
    }

    .client-mobile-table .column-leads::before {
        content: "Leads";
        display: inline;
        margin: 0;
        font-size: 13px;
        font-weight: 400;
    }

    .column-end-data,
    .column-end_data,
    .edit-btn {
        display: none !important;
    }

    .client-mobile-table .actions,
    .admin-mobile-table .actions {
        grid-area: actions;
        display: block;
        width: 92px;
        min-width: 0;
        white-space: normal;
    }

    .client-mobile-table .delete-btn,
    .admin-mobile-table .delete-btn {
        display: flex;
        width: 100%;
        min-height: 48px;
        align-items: center;
        justify-content: center;
        padding: 10px 12px;
        border-radius: 14px;
        font-size: 15px;
        white-space: nowrap;
    }

    .admin-mobile-table tbody tr {
        grid-template-columns: 58px minmax(0, 1fr) 104px;
        grid-template-areas:
            "avatar login actions"
            "avatar premium actions";
        column-gap: 12px;
        row-gap: 6px;
    }

    .admin-mobile-table tbody tr::before {
        grid-area: avatar;
        content: attr(data-initial);
    }

    .admin-mobile-table .column-login {
        grid-area: login;
        font-size: 17px;
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-mobile-table .column-is_superuser {
        grid-area: premium;
        width: fit-content;
        padding: 5px 10px;
        border-radius: 999px;
        background: rgba(52, 152, 219, .26);
        font-size: 13px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-mobile-table .column-is_superuser[data-state="false"] {
        display: none;
    }

    .admin-mobile-table .column-is_superuser[data-state="true"] {
        border: 1px solid rgba(74, 222, 128, .42);
        background: rgba(22, 163, 74, .28);
        color: #c8f9d7;
        box-shadow: 0 0 14px rgba(34, 197, 94, .12);
    }

    .client-mobile-table .desktop-status-value,
    .admin-mobile-table .desktop-status-value {
        display: none;
    }

    .client-mobile-table .mobile-status-value,
    .admin-mobile-table .mobile-status-value {
        display: inline;
    }

    .admin-mobile-table .actions {
        width: 104px;
    }

    /* Client editing: stats first, then one-column form, then account cards. */
    .form-header {
        display: flex;
        margin: 0;
        padding: 12px 16px 0;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .form-header h2 {
        width: 100%;
        margin: 2px 0 0;
        font-size: 26px;
    }

    .btn-secondary {
        min-height: 50px;
        margin: 0;
        padding: 13px 18px;
    }

    .home > .form-container {
        order: 2;
    }

    .home > .user-content {
        display: contents;
    }

    .home > .user-content > .total {
        order: 1;
    }

    .home > .user-content > .account-list {
        order: 4;
    }

    .home > .user-content > .network-card-history {
        order: 3;
    }

    .form-container {
        display: block;
        width: 100%;
        max-width: none;
    }

    .form-container form {
        width: 100%;
    }

    .form-container .ratio-inline {
        flex-direction: column;
    }

    .form-container .current-value {
        display: block;
        margin-bottom: 2px;
        font-size: 15px;
    }

    /* Account cards are intentionally vertical on phones. */
    .account-list {
        display: grid;
        gap: 12px;
        width: 100%;
        padding: 18px;
        border-radius: 20px;
        background: rgba(11, 43, 72, .72);
    }

    .account-list > h2 {
        margin: 0 0 2px;
        font-size: 26px;
    }

    .network-card-history > summary {
        font-size: 26px;
    }

    .network-card-item {
        width: 100%;
        padding: 16px;
        border: 1px solid rgba(255, 255, 255, .09);
        border-radius: 17px;
    }

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

    .network-card-block-form {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .account {
        display: grid;
        position: relative;
        width: 100%;
        min-width: 0;
        padding: 16px;
        grid-template-columns: 58px minmax(0, 1fr);
        grid-template-areas:
            "avatar title"
            "avatar links"
            "stats stats";
        align-items: start;
        gap: 12px;
        border: 1px solid rgba(255, 255, 255, .09);
        border-radius: 17px;
    }

    .account::before {
        content: attr(data-initial);
        display: grid;
        grid-area: avatar;
        width: 58px;
        height: 58px;
        place-items: center;
        border-radius: 50%;
        background: var(--highlight-gradient);
        font-size: 22px;
        font-weight: 700;
    }

    .account > h3 {
        grid-area: title;
        min-width: 0;
        margin: 2px 0 0;
        font-size: 20px;
    }

    .account-links {
        display: grid;
        grid-area: links;
        width: 100%;
        min-width: 0;
        gap: 9px;
    }

    .link-row {
        display: grid;
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) 76px;
        gap: 8px;
    }

    .compact-link {
        width: 100%;
        max-width: none;
        min-height: 44px;
        padding: 11px 12px;
        font-size: 14px;
    }

    .copy-link-button {
        width: 76px;
        min-height: 44px;
        padding: 9px 8px;
        font-size: 14px;
    }

    .account .stat {
        display: grid;
        grid-area: stats;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .account .stat .colum {
        display: flex;
        width: 100%;
        min-width: 0;
        min-height: 68px;
        padding: 10px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        border-radius: 12px;
        background: rgba(255, 255, 255, .07);
    }

    .account .stat .colum:last-child {
        grid-column: 1 / -1;
    }

    .account .stat .colum p {
        width: 100%;
        margin: 0;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .account .stat .colum .help {
        margin-bottom: 5px;
        font-size: 12px;
    }

    /* Tariff table becomes independent mobile cards; desktop table remains intact. */
    .page {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 16px;
    }

    .tariff-form,
    .tariff-table-wrapper {
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }

    .settings-block {
        display: flex;
        width: 100%;
        margin-bottom: 2px;
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 9px;
        border: 1px solid var(--divider-color);
        border-radius: 17px;
        background: rgba(31, 42, 56, .7);
        white-space: normal;
    }

    .settings-block input {
        width: 100%;
    }

    .tariff-table,
    .tariff-table tbody {
        display: block;
        width: 100%;
    }

    .tariff-table thead {
        display: none;
    }

    .tariff-table tbody {
        display: grid;
        gap: 14px;
    }

    .tariff-table tbody tr {
        display: block;
        width: 100%;
        padding: 4px 16px;
        border: 1px solid var(--divider-color);
        border-radius: 17px;
        background: rgba(31, 42, 56, .7);
        box-shadow: none;
    }

    .tariff-table tbody tr:hover {
        transform: none;
        box-shadow: none;
    }

    .tariff-table tbody td {
        display: grid;
        width: 100%;
        min-width: 0;
        padding: 13px 0;
        grid-template-columns: 90px minmax(0, 1fr);
        align-items: center;
        gap: 12px;
        border-bottom: 1px solid var(--divider-color);
    }

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

    .tariff-table tbody td::before {
        content: attr(data-label);
        color: var(--secondary-text);
        font-size: 13px;
        font-weight: 700;
        letter-spacing: .06em;
        text-transform: uppercase;
    }

    .tariff-table input {
        width: 100%;
    }

    /* Banners and banner editor. */
    .form-header.for-banner {
        margin: 0;
        padding: 12px 16px;
    }

    .page.edit-banner {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .form-conteiner,
    .form-banner {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .form-banner {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
        padding: 18px;
    }

    .form-banner > div {
        display: grid;
        min-width: 0;
        gap: 8px;
    }

    .form-banner input,
    .form-banner textarea,
    .form-banner select {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .items-list {
        width: 100%;
        max-height: none;
        padding: 0;
        flex-wrap: nowrap;
    }

    .sort-item {
        width: 100%;
    }

    .sort-item .carousel-item {
        max-width: none;
    }

    .active-list {
        margin-bottom: 24px;
    }

    .desktop-order-label {
        display: none;
    }

    .mobile-order-label {
        display: inline;
    }

    .banners-list {
        width: 100%;
        border: 1px solid rgba(255, 255, 255, .1);
        border-radius: 20px;
        background: rgba(11, 43, 72, .72);
        overflow: hidden;
    }

    .mobile-banner-list-heading {
        display: flex;
        min-height: 64px;
        padding: 17px 18px 10px;
        align-items: flex-end;
        justify-content: space-between;
        gap: 12px;
    }

    .mobile-banner-list-heading h2,
    .mobile-banner-list-heading p {
        margin: 0;
        overflow-wrap: normal;
        white-space: nowrap;
    }

    .mobile-banner-list-heading h2 {
        font-size: 24px;
    }

    .mobile-banner-list-heading p {
        margin-bottom: 3px;
        color: var(--secondary-text);
        font-size: 13px;
    }

    .banners-list .dataTables_wrapper {
        padding-top: 8px;
        border-radius: 0;
        background: transparent;
    }

    .banner-table,
    .banner-table tbody {
        display: block;
        width: 100% !important;
    }

    .banner-table thead {
        display: none;
    }

    .banner-table tbody {
        display: grid;
        gap: 10px;
    }

    .banner-table tbody tr {
        display: grid;
        width: 100%;
        padding: 15px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 12px;
        border-radius: 16px;
        background: var(--item-background);
        box-shadow: none;
        cursor: pointer;
    }

    .banner-table tbody tr:hover {
        transform: none;
        box-shadow: none;
    }

    .banner-table tbody td {
        display: block;
        min-width: 0;
        padding: 0;
        overflow-wrap: anywhere;
    }

    .banner-table .column-name {
        font-size: 18px;
        font-weight: 700;
    }

    .banner-table .column-url {
        grid-column: 1;
        color: var(--secondary-text);
        font-size: 14px;
    }

    .banner-table .column-url::before,
    .banner-table .column-interval::before {
        display: block;
        margin-bottom: 3px;
        color: var(--secondary-text);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .06em;
        text-transform: uppercase;
    }

    .banner-table .column-url::before {
        content: "URL";
    }

    .banner-table .column-interval {
        grid-column: 1;
        font-size: 14px;
    }

    .banner-table .column-interval::before {
        content: "Interval";
    }

    .banner-table .column-active {
        grid-column: 1;
    }

    .banner-active-control {
        display: flex;
        width: fit-content;
        min-height: 44px;
        padding: 8px 11px;
        align-items: center;
        gap: 9px;
        border: 1px solid rgba(255, 255, 255, .1);
        border-radius: 12px;
        background: rgba(255, 255, 255, .07);
        cursor: pointer;
    }

    .mobile-banner-active-label {
        display: inline;
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
    }

    .banner-table .actions {
        display: flex;
        grid-column: 2;
        grid-row: 1 / span 4;
        align-items: center;
    }

    .banner-table .delete-btn {
        width: 92px;
        min-height: 48px;
        padding: 10px;
        white-space: nowrap;
    }

    .active-toggle {
        display: block;
        width: 24px;
        height: 24px;
        margin: 0;
        padding: 0;
    }

    /* Logs become readable activity cards. */
    .logs {
        width: 100%;
        padding: 18px;
        border-radius: 20px;
        background: rgba(11, 43, 72, .72);
    }

    .logs h3 {
        margin: 0 0 14px;
        font-size: 25px;
    }

    .logs-container {
        display: grid;
        width: 100%;
        min-width: 0;
        gap: 9px;
        overflow: visible;
    }

    .logs-container > .log-entry:first-child {
        display: none;
    }

    .log-entry {
        display: grid;
        width: 100%;
        min-width: 0;
        margin: 0;
        padding: 14px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px 12px;
        border-radius: 14px;
        background: var(--item-background);
    }

    .log-entry .log:first-child {
        grid-column: 1;
        font-size: 16px;
        font-weight: 700;
    }

    .log-entry .log-action {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .log-entry .log:last-child {
        grid-column: 2;
        grid-row: 1;
        color: var(--secondary-text);
        text-align: right;
    }

    .log,
    .log-action {
        width: auto;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    /* Login and utility pages. */
    .login {
        width: 100%;
        min-height: 100svh;
        height: auto;
        padding: 28px 18px;
    }

    .login .logo {
        margin-bottom: 34px;
        flex-direction: column;
        text-align: center;
    }

    .login img {
        width: 82px;
        margin: 0 0 14px;
    }

    .login h1 {
        font-size: 25px;
    }

    .login form {
        width: 100%;
        max-width: 420px;
        height: auto;
        gap: 12px;
        align-items: stretch;
    }

    .login .button {
        min-height: 52px;
    }

    .div-404 {
        width: 100%;
        height: auto;
        min-height: calc(100svh - 76px);
        padding: 20px;
    }

    .img-404 {
        width: 100%;
        max-width: 560px;
        height: auto;
    }
}

@media (max-width: 360px) {
    .header {
        padding-inline: 12px;
    }

    .header img {
        height: 40px;
        margin-inline-end: 8px;
    }

    .header h1 {
        font-size: 22px;
    }

    .home,
    .page {
        padding: 12px;
    }

    .form,
    .dataTables_wrapper,
    .account-list,
    .logs {
        padding: 15px;
    }

    .home > .container > .total,
    .user-content > .total {
        gap: 9px;
    }

    .home > .container > .total .item,
    .user-content > .total .item {
        height: 108px;
        padding: 12px;
    }

    .client-mobile-table tbody tr {
        grid-template-columns: 52px minmax(0, 1fr) 76px;
        grid-template-areas:
            "avatar login actions"
            "avatar premium actions"
            "leads leads actions";
    }

    .admin-users-table tbody tr::before {
        width: 52px;
        height: 52px;
        font-size: 17px;
    }

    .client-mobile-table .column-leads { font-size: 18px; }

    .client-mobile-table .column-leads::before {
        margin: 0;
    }

    .client-mobile-table .actions {
        width: 76px;
    }

    .client-mobile-table .delete-btn,
    .admin-mobile-table .delete-btn {
        padding-inline: 8px;
        font-size: 14px;
    }

    .admin-mobile-table tbody tr {
        grid-template-columns: 52px minmax(0, 1fr) 88px;
    }

    .admin-mobile-table .actions {
        width: 88px;
    }

    .account {
        grid-template-columns: 50px minmax(0, 1fr);
    }

    .account::before {
        width: 50px;
        height: 50px;
    }

    .link-row {
        grid-template-columns: minmax(0, 1fr) 68px;
    }

    .copy-link-button {
        width: 68px;
    }
}

@media (max-width: 768px) {
    /* The main dashboard has more counters than the edit page: keep it at 3 × 3. */
    .home > .container > .total {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .home > .container > .total .item {
        height: 96px;
        padding: 9px 6px;
        justify-content: center;
        gap: 7px;
        border-radius: 14px;
        text-align: center;
    }

    .home > .container > .total .title p {
        display: flex;
        min-height: 2.4em;
        align-items: center;
        justify-content: center;
        font-size: clamp(10px, 2.8vw, 12px);
        line-height: 1.2;
        letter-spacing: -.1px;
        overflow-wrap: normal;
        word-break: normal;
    }

    .home > .container > .total h2 {
        max-width: 100%;
        font-size: clamp(13px, 3.5vw, 17px);
        line-height: 1.1;
        letter-spacing: -.25px;
        white-space: nowrap;
    }
}
