:root {
    --background: #f4f6f8;
    --sidebar: #17191d;
    --sidebar-hover: #25282e;
    --sidebar-active: #ffffff;
    --sidebar-text: #aeb4bd;

    --surface: #ffffff;
    --border: #e3e7ec;

    --text-primary: #1c2026;
    --text-secondary: #727985;

    --accent: #7357e6;
    --accent-light: #eeeafd;

    --success: #1b9c62;
    --success-light: #e7f7ef;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--background);
    color: var(--text-primary);
}

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

button,
input {
    font: inherit;
}

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

.sidebar {
    position: fixed;
    top: 0;
    left: 0;

    width: 250px;
    height: 100vh;

    padding: 24px 16px;

    background: var(--sidebar);
    color: white;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 8px 28px;
}

.sidebar__logo {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border-radius: 12px;

    background: var(--accent);
    color: white;

    font-size: 22px;
    font-weight: 700;
}

.sidebar__title {
    font-size: 17px;
    font-weight: 600;
}

.sidebar__subtitle {
    margin-top: 2px;

    color: var(--sidebar-text);

    font-size: 12px;
}

.sidebar__navigation {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 12px 14px;

    border-radius: 10px;

    color: var(--sidebar-text);

    font-size: 14px;
    font-weight: 500;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.sidebar__link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar__link--active {
    background: var(--sidebar-active);
    color: var(--text-primary);
}

.sidebar__link--active:hover {
    background: var(--sidebar-active);
    color: var(--text-primary);
}

.sidebar__icon {
    display: inline-flex;
    justify-content: center;

    width: 20px;

    font-size: 18px;
}

.main-content {
    width: calc(100% - 250px);
    margin-left: 250px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 90px;
    padding: 20px 32px;

    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.topbar__title {
    margin: 0;

    font-size: 24px;
    font-weight: 650;
}

.topbar__subtitle {
    margin: 6px 0 0;

    color: var(--text-secondary);

    font-size: 14px;
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar__avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: var(--accent-light);
    color: var(--accent);

    font-weight: 700;
}

.topbar__username {
    font-size: 14px;
    font-weight: 600;
}

.topbar__role {
    margin-top: 2px;

    color: var(--text-secondary);

    font-size: 12px;
}

.page-content {
    padding: 30px 32px;
}

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

    margin-bottom: 24px;
}

.stat-card,
.content-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.stat-card {
    padding: 22px;
}

.stat-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card__label {
    color: var(--text-secondary);

    font-size: 14px;
    font-weight: 500;
}

.stat-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    border-radius: 9px;

    background: var(--accent-light);
    color: var(--accent);
}

.stat-card__value {
    margin-top: 18px;

    font-size: 32px;
    font-weight: 700;
}

.stat-card__description {
    margin-top: 8px;

    color: var(--text-secondary);

    font-size: 13px;
}

.content-card {
    padding: 24px;
}

.content-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.content-card__title {
    margin: 0;

    font-size: 18px;
    font-weight: 650;
}

.content-card__description {
    margin: 8px 0 0;

    color: var(--text-secondary);

    font-size: 14px;
}

.status-badge {
    display: inline-flex;
    align-items: center;

    padding: 6px 10px;

    border-radius: 999px;

    background: var(--success-light);
    color: var(--success);

    font-size: 12px;
    font-weight: 600;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;

    margin-top: 24px;
}

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

    padding: 18px;

    border: 1px solid var(--border);
    border-radius: 12px;

    transition:
        border-color 0.2s ease,
        transform 0.2s ease;
}

.action-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.action-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    flex-shrink: 0;

    border-radius: 10px;

    background: var(--accent-light);
    color: var(--accent);

    font-weight: 700;
}

.action-card__title {
    font-size: 14px;
    font-weight: 600;
}

.action-card__description {
    margin-top: 5px;

    color: var(--text-secondary);

    font-size: 13px;
    line-height: 1.4;
}

.table-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

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

.search-form__input {
    width: 280px;
    height: 40px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--surface);
    color: var(--text-primary);

    font-size: 14px;

    outline: none;
}

.search-form__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;
    padding: 0 15px;

    border: 1px solid transparent;
    border-radius: 9px;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        opacity 0.2s ease;
}

.button--primary {
    background: var(--accent);
    color: white;
}

.button--primary:hover {
    opacity: 0.9;
}

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

.button--secondary:hover {
    background: var(--background);
}

.table-wrapper {
    margin-top: 24px;
    overflow-x: auto;

    border: 1px solid var(--border);
    border-radius: 12px;
}

.data-table {
    width: 100%;

    border-collapse: collapse;
    background: var(--surface);
}

.data-table th {
    padding: 13px 16px;

    border-bottom: 1px solid var(--border);
    background: #fafbfc;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table td {
    padding: 15px 16px;

    border-bottom: 1px solid var(--border);

    font-size: 14px;
    vertical-align: middle;
}

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

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

.data-table__actions {
    text-align: right;
}

.chat-id {
    display: inline-block;

    padding: 4px 7px;

    border-radius: 6px;

    background: var(--background);
    color: var(--text-secondary);

    font-size: 12px;
}

.chat-title {
    font-weight: 600;
}

.alias-badge {
    display: inline-flex;

    padding: 5px 9px;

    border-radius: 999px;

    background: var(--accent-light);
    color: var(--accent);

    font-size: 12px;
    font-weight: 600;
}

.empty-value {
    color: var(--text-secondary);

    font-size: 13px;
}

.table-link {
    color: var(--accent);

    font-size: 13px;
    font-weight: 600;
}

.table-link:hover {
    text-decoration: underline;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 70px 20px 50px;

    text-align: center;
}

.empty-state__icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 54px;
    height: 54px;

    border-radius: 15px;

    background: var(--accent-light);
    color: var(--accent);

    font-size: 22px;
}

.empty-state__title {
    margin: 18px 0 0;

    font-size: 17px;
}

.empty-state__description {
    max-width: 440px;
    margin: 9px 0 20px;

    color: var(--text-secondary);

    font-size: 14px;
    line-height: 1.5;
}

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

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .table-header {
        flex-direction: column;
    }

    .search-form {
        width: 100%;
        flex-wrap: wrap;
    }

    .search-form__input {
        width: 100%;
    }
}

@media (max-width: 700px) {
    .sidebar {
        position: static;

        width: 100%;
        height: auto;
    }

    .app-layout {
        display: block;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

    .sidebar__navigation {
        flex-direction: row;
        overflow-x: auto;
    }

    .sidebar__link {
        flex-shrink: 0;
    }

    .topbar {
        padding: 18px 20px;
    }

    .topbar__user {
        display: none;
    }

    .page-content {
        padding: 20px;
    }

    .content-card {
        padding: 18px;
    }
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}

.chat-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    margin-bottom: 24px;
    padding: 24px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface);
}

.chat-summary__main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-summary__icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 54px;
    height: 54px;
    flex-shrink: 0;

    border-radius: 14px;

    background: var(--accent-light);
    color: var(--accent);

    font-size: 24px;
}

.chat-summary__title {
    margin: 0;

    font-size: 21px;
    font-weight: 700;
}

.chat-summary__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 10px;
}

.chat-summary__stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-summary__stat-value {
    font-size: 30px;
    font-weight: 700;
}

.chat-summary__stat-label {
    margin-top: 4px;

    color: var(--text-secondary);

    font-size: 13px;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;
    flex-shrink: 0;

    border-radius: 50%;

    background: var(--accent-light);
    color: var(--accent);

    font-size: 14px;
    font-weight: 700;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-secondary {
    margin-top: 3px;

    color: var(--text-secondary);

    font-size: 12px;
}

.username {
    color: var(--accent);

    font-size: 13px;
    font-weight: 600;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;

    margin-top: 18px;
}

.pagination__description {
    color: var(--text-secondary);
    font-size: 13px;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 100vh;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 38px;

    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);

    text-align: center;
    box-shadow: 0 20px 60px rgba(28, 32, 38, 0.1);
}

.login-card__logo {
    margin: 0 auto 20px;
}

.login-card__title {
    margin: 0;
    font-size: 25px;
}

.login-card__description {
    margin: 12px 0 24px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.login-card__error {
    padding: 12px;
    border-radius: 9px;
    background: #fff1f1;
    color: #c93636;
}

.membership-status {
    display: inline-flex;
    align-items: center;

    padding: 6px 10px;

    border-radius: 999px;

    background: var(--background);
    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;
}

.membership-status--active {
    background: var(--success-light);
    color: var(--success);
}

.membership-status--kicked {
    background: #fff1f1;
    color: #c93636;
}

.membership-status--left {
    background: #fff7ed;
    color: #c66a13;
}

@media (max-width: 700px) {
    .chat-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-summary__stat {
        align-items: flex-start;
    }
}

.button--small {
    min-height: 34px;
    padding: 0 12px;

    font-size: 12px;
}

.button--danger {
    border-color: #efc5c5;

    background: #fff1f1;
    color: #c93636;
}

.button--danger:hover {
    border-color: #d94a4a;

    background: #d94a4a;
    color: #ffffff;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.notification {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 1000;

    display: none;

    max-width: 420px;
    padding: 14px 18px;

    border: 1px solid transparent;
    border-radius: 10px;

    background: var(--surface);

    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;

    box-shadow:
        0 10px 30px rgba(28, 32, 38, 0.12);
}

.notification--visible {
    display: block;
}

.notification--success {
    border-color: #b7e2cc;

    background: var(--success-light);
    color: var(--success);
}

.notification--error {
    border-color: #efc5c5;

    background: #fff1f1;
    color: #c93636;
}

@media (max-width: 700px) {
    .notification {
        top: 12px;
        right: 12px;
        left: 12px;

        max-width: none;
    }
}

.member-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
}

.member-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    min-height: 34px;
    padding: 0 11px;

    border: 1px solid transparent;
    border-radius: 8px;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        opacity 0.2s ease,
        transform 0.2s ease;
}

.member-action:hover:not(:disabled) {
    transform: translateY(-1px);
}

.member-action__icon {
    font-size: 13px;
    line-height: 1;
}

.member-action--kick {
    border-color: #f1d3ae;

    background: #fff7ed;
    color: #c96b13;
}

.member-action--kick:hover:not(:disabled) {
    border-color: #e9933d;

    background: #e9933d;
    color: #ffffff;
}

.member-action:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.member-action--loading {
    min-width: 98px;

    cursor: wait;
}

.member-action__spinner {
    width: 13px;
    height: 13px;

    border: 2px solid rgba(201, 107, 19, 0.25);
    border-top-color: currentColor;
    border-radius: 50%;

    animation: member-action-spin 0.7s linear infinite;
}

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

.member-row--removing {
    opacity: 0;
    transform: translateX(10px);

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}

.notification {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 1000;

    display: block;

    max-width: 420px;
    padding: 14px 18px;

    border: 1px solid transparent;
    border-radius: 10px;

    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;

    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);

    box-shadow:
        0 10px 30px rgba(28, 32, 38, 0.12);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

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

.notification--success {
    border-color: #b7e2cc;

    background: var(--success-light);
    color: var(--success);
}

.notification--error {
    border-color: #efc5c5;

    background: #fff1f1;
    color: #c93636;
}

[hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    .member-actions {
        min-width: 250px;
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .notification {
        top: 12px;
        right: 12px;
        left: 12px;

        max-width: none;
    }
}

.data-table__actions {
    text-align: right;
}

.member-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 36px;
    padding: 0 13px;

    border: 1px solid transparent;
    border-radius: 8px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        opacity 0.2s ease;
}

.member-action:hover:not(:disabled) {
    transform: translateY(-1px);
}

.member-action:disabled {
    cursor: wait;
    opacity: 0.7;
}

.member-action--kick {
    border-color: #f0cda3;

    background-color: #fff7ed;
    color: #c66a13;
}

.member-action--kick:hover:not(:disabled) {
    border-color: #e9913a;

    background-color: #e9913a;
    color: #ffffff;
}

.member-action__icon {
    font-size: 14px;
    line-height: 1;
}

.member-action__spinner {
    width: 14px;
    height: 14px;

    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: currentColor;
    border-radius: 50%;

    animation: member-action-spin 0.7s linear infinite;
}

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

.member-row--removing {
    opacity: 0;
    transform: translateX(12px);

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}

.notification {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 1200;

    max-width: 430px;
    padding: 14px 18px;

    border: 1px solid transparent;
    border-radius: 10px;

    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;

    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);

    box-shadow: 0 12px 35px rgba(28, 32, 38, 0.14);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

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

.notification--success {
    border-color: #b7e2cc;

    background-color: #edf9f3;
    color: #168553;
}

.notification--error {
    border-color: #efc5c5;

    background-color: #fff1f1;
    color: #c93636;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1100;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.modal--visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.modal__backdrop {
    position: absolute;
    inset: 0;

    background-color: rgba(15, 18, 24, 0.52);
    backdrop-filter: blur(2px);
}

.modal__dialog {
    position: relative;
    z-index: 1;

    width: 100%;
    max-width: 440px;

    padding: 30px;

    border: 1px solid #e5e7eb;
    border-radius: 16px;

    background-color: #ffffff;

    box-shadow: 0 24px 70px rgba(15, 18, 24, 0.22);

    transform: translateY(12px) scale(0.98);

    transition: transform 0.2s ease;
}

.modal--visible .modal__dialog {
    transform: translateY(0) scale(1);
}

.modal__close {
    position: absolute;
    top: 14px;
    right: 16px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    padding: 0;

    border: none;
    border-radius: 8px;

    background: transparent;
    color: #7a8190;

    font-size: 24px;
    line-height: 1;

    cursor: pointer;
}

.modal__close:hover {
    background-color: #f3f4f6;
    color: #222630;
}

.modal__icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 52px;
    height: 52px;

    margin-bottom: 18px;

    border-radius: 14px;

    font-size: 25px;
    font-weight: 700;
}

.modal__icon--warning {
    background-color: #fff3e5;
    color: #d97817;
}

.modal__title {
    margin: 0 0 10px;

    color: #171a21;

    font-size: 22px;
    line-height: 1.25;
}

.modal__description {
    margin: 0;

    color: #555d6d;

    font-size: 15px;
    line-height: 1.55;
}

.modal__hint {
    margin: 10px 0 0;

    color: #858c99;

    font-size: 13px;
    line-height: 1.5;
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;

    margin-top: 26px;
}

.button--danger {
    border-color: #dc4c4c;

    background-color: #dc4c4c;
    color: #ffffff;
}

.button--danger:hover:not(:disabled) {
    border-color: #c63d3d;

    background-color: #c63d3d;
}

.button--danger:disabled {
    cursor: wait;
    opacity: 0.7;
}

.modal-open {
    overflow: hidden;
}

[hidden] {
    display: none !important;
}

@media (max-width: 700px) {
    .notification {
        top: 12px;
        right: 12px;
        left: 12px;

        max-width: none;
    }

    .modal__dialog {
        padding: 26px 22px 22px;
    }

    .modal__actions {
        flex-direction: column-reverse;
    }

    .modal__actions .button {
        width: 100%;
    }
}

.chat-actions-column {
    width: 140px;
    min-width: 140px;
    text-align: center;
}

th.chat-actions-column {
    text-align: center;
}

td.chat-actions-column {
    text-align: center;
}

.chat-actions-column .table-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
