:root {
    --tt-primary: #5b21ff;
    --tt-primary-dark: #3f16b8;
    --tt-accent: #a78bfa;
    --tt-black: #0f1118;
    --tt-surface: #171c28;
    --tt-surface-soft: #1f2635;
    --tt-light: #f4f5f8;
    --tt-white: #ffffff;
    --tt-text: #1a1d23;
    --tt-text-muted: #6b7280;
    --tt-border: #e9eef5;
    --tt-border-strong: #d6dce7;
    --tt-shadow-sm: 0 8px 22px rgba(15, 17, 24, 0.06);
    --tt-shadow-md: 0 18px 36px rgba(15, 17, 24, 0.16);
    --tt-radius-card: 14px;
    --tt-radius-control: 10px;
    --bs-primary: var(--tt-primary);
    --bs-primary-rgb: 91, 33, 255;
}

body {
    background-color: var(--tt-light);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--tt-text);
}

body:not(.auth-page) {
    padding-left: 56px;
}

body.tt-sidebar-pinned {
    padding-left: 262px;
}

.btn-primary,
.bg-primary {
    background-color: var(--tt-primary) !important;
    border-color: var(--tt-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--tt-primary-dark) !important;
    border-color: var(--tt-primary-dark) !important;
}

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

.card {
    border-radius: var(--tt-radius-card);
    border-color: var(--tt-border);
    box-shadow: var(--tt-shadow-sm);
}

.card-header {
    border-radius: var(--tt-radius-card) var(--tt-radius-card) 0 0 !important;
}

.table > thead > tr > th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tt-text-muted);
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding-top: 10px;
    padding-bottom: 10px;
}

.table > tbody > tr > td {
    font-size: 0.875rem;
    vertical-align: middle;
    border-color: #f0f2f5;
}

.table-hover tbody tr:hover {
    background-color: rgba(91, 33, 255, 0.03);
}

.form-control,
.form-select,
.btn,
.badge {
    border-radius: var(--tt-radius-control);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(91, 33, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(91, 33, 255, 0.12);
}

.btn {
    font-weight: 500;
}

.badge {
    font-weight: 500;
    letter-spacing: 0.02em;
}

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

::-webkit-scrollbar-track {
    background: #f0f2f5;
}

::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.app-flash-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.app-flash-stack--closing .app-flash {
    opacity: 0;
    transform: translateY(12px);
}

.app-flash {
    --app-flash-accent: var(--tt-primary);
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--app-flash-accent);
    background: linear-gradient(180deg, rgba(15, 17, 24, 0.98) 0%, rgba(23, 28, 40, 0.98) 100%);
    box-shadow: var(--tt-shadow-md);
    backdrop-filter: blur(10px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    animation: appFlashSlideIn 0.22s ease-out;
}

.app-flash__body {
    min-width: 0;
    flex: 1 1 auto;
}

.app-flash__title {
    margin-bottom: 4px;
    color: var(--app-flash-accent);
    font-size: 0.76rem;
    line-height: 1.2;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-flash__message {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.94rem;
    line-height: 1.45;
    word-break: break-word;
}

.app-flash__close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.app-flash__close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--tt-white);
}

.app-flash--success {
    --app-flash-accent: #22c55e;
    box-shadow: 0 18px 36px rgba(34, 197, 94, 0.22);
}

.app-flash--danger {
    --app-flash-accent: #ef4444;
    box-shadow: 0 18px 36px rgba(239, 68, 68, 0.18);
}

.app-flash--warning {
    --app-flash-accent: #f59e0b;
    box-shadow: 0 18px 36px rgba(245, 158, 11, 0.18);
}

.app-flash--info {
    --app-flash-accent: var(--tt-accent);
}

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

.tt-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: 56px;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(180deg, #0f1118 0%, #141824 70%, #120a2b 100%);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.18);
    transition: width 0.22s cubic-bezier(.4, 0, .2, 1);
    will-change: width;
}

.tt-sidebar:hover,
.tt-sidebar.pinned {
    width: 262px;
}

.tt-sidebar-inner {
    display: flex;
    flex-direction: column;
    width: 262px;
    height: 100%;
}

.tt-sidebar-logo {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 14px;
    color: var(--tt-white);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 1px solid rgba(91, 33, 255, 0.25);
}

.tt-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    color: var(--tt-white);
    background: rgba(91, 33, 255, 0.22);
    border: 1px solid rgba(167, 139, 250, 0.22);
    border-radius: 8px;
    flex-shrink: 0;
}

.tt-logo-eyes {
    gap: 2px;
    overflow: hidden;
}

.tt-mini-eye {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 11px;
    height: 11px;
    background: #5500ff;
    border-radius: 50%;
    flex-shrink: 0;
}

.tt-mini-white {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    transform-origin: center;
    animation: ttMiniBlink 5s ease-in-out infinite;
}

.tt-mini-white-b2 {
    animation-delay: 0.15s;
}

@keyframes ttMiniBlink {
    0%, 88%, 100% {
        transform: scaleY(1);
    }
    93% {
        transform: scaleY(0.08);
    }
}

.tt-mini-pupil {
    width: 4px;
    height: 4px;
    background: #111;
    border-radius: 50%;
}

.tt-logo-text {
    margin-left: 12px;
    color: var(--tt-white);
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tt-brand-name {
    font-weight: 800;
    letter-spacing: 0.02em;
}

.tt-sidebar:hover .tt-logo-text,
.tt-sidebar.pinned .tt-logo-text,
.tt-sidebar:hover .tt-nav-label,
.tt-sidebar.pinned .tt-nav-label,
.tt-sidebar:hover .tt-user-info,
.tt-sidebar.pinned .tt-user-info {
    opacity: 1;
}

.tt-sidebar:hover .tt-logo-text,
.tt-sidebar:hover .tt-nav-label {
    transition-delay: 0.08s;
}

.tt-sidebar-nav {
    flex: 1;
    padding: 6px 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
}

.tt-sidebar-nav::-webkit-scrollbar {
    display: none;
}

.tt-nav-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 9px 15px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.855rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tt-nav-item:hover {
    color: var(--tt-white);
    background: rgba(255, 255, 255, 0.06);
    border-left-color: rgba(91, 33, 255, 0.55);
    text-decoration: none;
}

.tt-nav-item.active {
    color: var(--tt-white);
    background: rgba(91, 33, 255, 0.22);
    border-left-color: var(--tt-primary);
}

.tt-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    flex-shrink: 0;
}

.tt-nav-label {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-left: 12px;
    line-height: 1.25;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.tt-sidebar:hover .tt-nav-label,
.tt-sidebar.pinned .tt-nav-label {
    transform: translateX(0);
}

.tt-sidebar-bottom {
    flex-shrink: 0;
    padding: 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.tt-user-dropdown-wrapper {
    position: relative;
}

.tt-user-item {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 8px 15px;
    color: inherit;
    white-space: nowrap;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tt-user-dropdown-toggle {
    position: relative;
}

.tt-user-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tt-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    color: var(--tt-white);
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

.tt-user-info {
    flex: 1;
    margin-left: 10px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tt-user-name {
    max-width: 130px;
    overflow: hidden;
    color: var(--tt-white);
    font-size: 0.8rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tt-user-dropdown-arrow {
    position: absolute;
    top: 50%;
    right: 8px;
    opacity: 0.5;
    transform: translateY(-50%);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.tt-user-dropdown-wrapper.active .tt-user-dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.tt-user-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 8px;
    width: 230px;
    overflow: hidden;
    background: #1e2630;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.tt-user-dropdown-wrapper.active .tt-user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tt-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #e0e6ed;
    font-size: 0.875rem;
    text-decoration: none;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tt-user-dropdown-item:last-child {
    border-bottom: 0;
}

.tt-user-dropdown-item:hover {
    color: var(--tt-white);
    background: rgba(255, 255, 255, 0.08);
}

.tt-user-dropdown-item-danger:hover {
    color: #ff6b6b;
    background: rgba(220, 53, 69, 0.15);
}

@media (max-width: 767px) {
    body:not(.auth-page),
    body.tt-sidebar-pinned {
        padding-top: 56px;
        padding-left: 0;
    }

    .app-flash-stack {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
    }

    .tt-sidebar,
    .tt-sidebar:hover,
    .tt-sidebar.pinned {
        width: 100%;
        height: 56px;
        overflow: visible;
    }

    .tt-sidebar-inner {
        flex-direction: row;
        width: 100%;
    }

    .tt-sidebar-logo {
        width: 56px;
        padding: 14px;
        border-bottom: 0;
    }

    .tt-sidebar-nav {
        display: flex;
        padding: 0;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .tt-nav-item {
        min-width: 56px;
        padding: 9px 14px;
        border-bottom: 3px solid transparent;
        border-left: 0;
    }

    .tt-nav-item.active {
        border-bottom-color: var(--tt-primary);
        border-left-color: transparent;
    }

    .tt-nav-label,
    .tt-logo-text,
    .tt-user-info,
    .tt-user-dropdown-arrow {
        display: none !important;
    }

    .tt-sidebar-bottom {
        margin-left: auto;
        padding: 4px 6px;
        border-top: 0;
    }

    .tt-user-item {
        min-height: 48px;
        padding: 8px;
    }

    .tt-user-dropdown-menu {
        left: auto;
        right: 0;
        width: 230px;
    }

    .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}
