@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Inter:wght@400;500;600&display=swap");

:root {
    --brand-bg: #d8d1c3;
    --brand-bg-soft: #f3efe6;
    --brand-ink: #1a1714;
    --brand-accent: #7c6a55;
    --brand-accent-soft: rgba(124, 106, 85, 0.12);
    --brand-line: rgba(26, 23, 20, 0.08);
    --brand-lilac: #2f166b;
    --brand-lilac-dark: #1c0649;
    --deep-purple: #1a0d3e;
    --deep-purple-light: #2d1861;
    --purple-glow: rgba(99, 56, 186, 0.35);
}

html {
    font-family: "Inter", sans-serif;
    background: var(--brand-bg);
}

body {
    background: linear-gradient(120deg, var(--brand-bg) 0%, var(--brand-bg-soft) 70%);
    color: var(--brand-ink);
    min-height: 100vh;
}

.brand-shell {
    color: var(--brand-ink);
}

/* Современная навигация */
.modern-nav {
    background: linear-gradient(135deg, var(--deep-purple) 0%, var(--deep-purple-light) 50%, #3d1f7a 100%);
    border-bottom: 1px solid rgba(185, 155, 255, 0.15);
    box-shadow: 0 5px 20px rgba(26, 13, 62, 0.2), 0 0 40px rgba(99, 56, 186, 0.1);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.modern-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(185, 155, 255, 0.05) 50%, transparent 100%);
    animation: shimmer 8s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.brand-logo-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-initials-modern {
    font-family: "Playfair Display", serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: #fff;
    text-shadow: 0 1px 10px rgba(185, 155, 255, 0.3);
    position: relative;
}

.brand-initials-modern::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #b99bff 0%, transparent 100%);
}

.brand-divider {
    width: 1px;
    height: 36px;
    background: linear-gradient(180deg, transparent 0%, rgba(185, 155, 255, 0.3) 50%, transparent 100%);
}

.brand-title {
    font-family: "Playfair Display", serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.brand-subtitle {
    font-family: "Inter", sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(185, 155, 255, 0.85);
    margin-top: 1px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.4rem 1rem 0.4rem 0.4rem;
    border-radius: 50px;
    border: 1px solid rgba(185, 155, 255, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.user-badge:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(185, 155, 255, 0.35);
    box-shadow: 0 4px 12px rgba(99, 56, 186, 0.15);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b99bff 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(185, 155, 255, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.01em;
}

.user-role {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(185, 155, 255, 0.8);
}

.logout-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(185, 155, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(185, 155, 255, 0.9);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.logout-btn:hover {
    background: rgba(255, 77, 77, 0.15);
    border-color: rgba(255, 77, 77, 0.4);
    color: #ff9b9b;
    transform: rotate(10deg) scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.12);
}

.brand-mark {
    font-family: "Inter", sans-serif;
    letter-spacing: 0.175em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--brand-accent);
}

.brand-initials {
    font-family: "Playfair Display", serif;
    font-size: 2.75rem;
    letter-spacing: -0.1rem;
    color: var(--brand-ink);
}

.card {
    background: rgba(255, 255, 255, 0.82);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 55px rgba(26, 23, 20, 0.08);
}

.brand-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0.65rem 1.75rem;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--deep-purple) 0%, var(--deep-purple-light) 50%, #3d1f7a 100%);
    color: #fff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(99, 56, 186, 0.18), 0 0 0 1px rgba(185, 155, 255, 0.08);
    transition: all 0.3s ease;
    font-size: 0.75rem;
}

.brand-button.outline {
    background: transparent;
    color: var(--deep-purple);
    border: 2px solid var(--deep-purple);
    box-shadow: none;
}

.brand-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 18px rgba(99, 56, 186, 0.22), 0 0 0 1px rgba(185, 155, 255, 0.12);
    filter: brightness(1.1);
}

.brand-button.outline:hover {
    background: rgba(45, 24, 97, 0.08);
    border-color: var(--deep-purple-light);
    transform: translateY(-2px);
}

.brand-chip {
    border-radius: 6px;
    padding: 0.45rem 1.1rem;
    border: 1px solid var(--deep-purple);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--deep-purple);
    background: rgba(45, 24, 97, 0.04);
    transition: all 0.3s ease;
    font-weight: 500;
}

.brand-chip:hover {
    background: rgba(45, 24, 97, 0.12);
    color: var(--deep-purple-light);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(45, 24, 97, 0.08);
}

.brand-chip.active {
    background: linear-gradient(135deg, var(--deep-purple) 0%, var(--deep-purple-light) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 56, 186, 0.2), 0 0 0 1px rgba(185, 155, 255, 0.1);
    border-color: transparent;
    transform: translateY(-2px);
}

.table-container {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(26, 23, 20, 0.05);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(45, 24, 97, 0.3);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(45, 24, 97, 0.5);
}

table th {
    font-size: 0.72rem !important;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(26, 23, 20, 0.6);
    border-bottom: 1px solid var(--brand-line);
}

.modal {
    background: rgba(26, 23, 20, 0.28);
}

.modal .card {
    background: #fbf7ef;
}

input,
select,
textarea {
    border-radius: 3px !important;
    border: 1px solid rgba(26, 23, 20, 0.18) !important;
    background: rgba(255, 255, 255, 0.9) !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-accent) !important;
    box-shadow: 0 0 0 1px var(--brand-accent-soft);
}

.login-field {
    display: flex;
    align-items: center;
    border-radius: 3px !important;
    border: 1px solid rgba(26, 23, 20, 0.25);
    background: rgba(255, 255, 255, 0.92);
    padding: 0.2rem 0.8rem;
    gap: 0.75rem;
}

.login-field span {
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(26, 23, 20, 0.55);
}

.login-field input {
    border: none !important;
    background: transparent !important;
    padding: 0.6rem 0;
}

.login-field input:focus {
    box-shadow: none !important;
    outline: none !important;
}

.form-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: rgba(26, 23, 20, 0.6);
    display: block;
    margin-bottom: 0.3rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-control {
    width: 100%;
    border-radius: 3px;
    padding: 0.65rem 0.9rem;
}

.note-field {
    min-height: 120px;
    padding: 0.75rem 1rem;
    border-radius: 3px;
}

.glass-field {
    background: #fbf7ef;
    border: 1px solid rgba(26, 23, 20, 0.08);
    border-radius: 4px;
    padding: 1rem;
    box-shadow: 0 15px 35px rgba(26, 23, 20, 0.08);
}

.password-field {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.eye-btn {
    border: none;
    background: rgba(45, 24, 97, 0.1);
    border-radius: 6px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.eye-btn:hover {
    background: rgba(45, 24, 97, 0.18);
    transform: scale(1.05);
}

.eye-btn.active {
    background: linear-gradient(135deg, var(--deep-purple) 0%, var(--deep-purple-light) 100%);
    color: #fff;
    box-shadow: 0 3px 10px rgba(99, 56, 186, 0.2);
}

.role-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.role-pill {
    border-radius: 6px;
    border: 1px solid var(--deep-purple);
    overflow: hidden;
}

.role-pill input {
    display: none;
}

.role-pill span {
    display: block;
    padding: 0.6rem 2rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.7rem;
    color: var(--deep-purple);
    transition: all 0.3s ease;
    font-weight: 500;
}

.role-pill input:checked + span {
    background: linear-gradient(135deg, var(--deep-purple) 0%, var(--deep-purple-light) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 56, 186, 0.18);
}

.form-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--brand-line);
}

.login-field:focus-within {
    border-color: var(--brand-ink);
    box-shadow: 0 0 0 2px rgba(26, 23, 20, 0.08);
    background: rgba(255, 255, 255, 0.98);
}

.stat-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.175em;
    color: var(--brand-accent);
}

.stat-value {
    font-family: "Playfair Display", serif;
    font-size: 2.1rem;
}

.font-serif {
    font-family: "Playfair Display", serif !important;
}

.flash-stack .card {
    border-radius: 999px;
}

.brand-link {
    color: var(--brand-ink);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: 0.7rem;
    display: inline-block;
    vertical-align: middle;
}

/* Форма внутри flex контейнера должна быть на одной линии */
table form {
    display: inline-block;
    margin: 0;
    padding: 0;
    line-height: 1;
}

table form button {
    vertical-align: middle;
}

.filter-chip {
    border: 1px solid var(--deep-purple);
    padding: 0.45rem 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.7rem;
    color: var(--deep-purple);
    background: rgba(45, 24, 97, 0.04);
    transition: all 0.3s ease;
    border-radius: 6px;
    font-weight: 500;
}

.filter-chip:hover {
    background: rgba(45, 24, 97, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(45, 24, 97, 0.08);
}

.filter-chip.active {
    background: linear-gradient(135deg, var(--deep-purple) 0%, var(--deep-purple-light) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 56, 186, 0.2);
    border-color: transparent;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.action-pill {
    border: 1px solid var(--deep-purple);
    padding: 0.45rem 1.1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-size: 0.7rem;
    color: var(--deep-purple);
    background: rgba(45, 24, 97, 0.04);
    transition: all 0.3s ease;
    border-radius: 6px;
    font-weight: 500;
}

.action-pill:hover {
    background: rgba(45, 24, 97, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(45, 24, 97, 0.08);
}

.action-pill.primary {
    background: linear-gradient(135deg, var(--deep-purple) 0%, var(--deep-purple-light) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 56, 186, 0.18);
    border-color: transparent;
}

.action-pill.primary:hover {
    box-shadow: 0 6px 18px rgba(99, 56, 186, 0.22);
    transform: translateY(-2px);
}

/* ============================================
   АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ============================================ */

/* Планшеты и маленькие экраны */
@media (max-width: 1024px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    main {
        padding: 1.5rem 1rem;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    /* Навигация */
    .nav-content {
        padding: 0.5rem 0;
    }
    
    .brand-logo-wrapper {
        gap: 0.75rem;
    }
    
    .brand-initials-modern {
        font-size: 1.5rem;
    }
    
    .brand-divider {
        height: 28px;
    }
    
    .brand-title {
        font-size: 0.95rem;
    }
    
    .brand-subtitle {
        font-size: 0.55rem;
        letter-spacing: 0.25em;
    }
    
    .nav-actions {
        gap: 0.75rem;
    }
    
    .user-badge {
        padding: 0.35rem 0.85rem 0.35rem 0.35rem;
        gap: 0.6rem;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    .user-name {
        font-size: 0.85rem;
    }
    
    .user-role {
        font-size: 0.6rem;
    }
    
    .logout-btn {
        width: 36px;
        height: 36px;
    }
    
    .logout-btn svg {
        width: 1.1rem;
        height: 1.1rem;
    }
    
    /* Контент */
    main {
        padding: 1rem 0.75rem;
    }
    
    /* Карточки */
    .card {
        border-radius: 8px;
    }
    
    /* Статистика */
    .stat-value {
        font-size: 1.75rem;
    }
    
    /* Кнопки */
    .brand-button {
        padding: 0.6rem 1.5rem;
        font-size: 0.7rem;
    }
    
    /* Чипы и фильтры */
    .brand-chip,
    .filter-chip,
    .action-pill {
        padding: 0.4rem 0.9rem;
        font-size: 0.65rem;
        letter-spacing: 0.15em;
    }
    
    /* Формы */
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-control {
        padding: 0.6rem 0.85rem;
        font-size: 0.9rem;
    }
    
    /* Таблицы */
    .table-container {
        border-radius: 8px;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    table th,
    table td {
        padding: 0.65rem 0.5rem !important;
    }
    
    /* Модальные окна */
    .modal .card {
        max-width: 95vw !important;
        margin: 1rem;
    }
    
    /* Роли */
    .role-pill span {
        padding: 0.55rem 1.5rem;
        font-size: 0.65rem;
    }
}

/* Маленькие мобильные */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 0.75rem;
    }
    
    .brand-logo-wrapper {
        gap: 0.5rem;
    }
    
    .brand-initials-modern {
        font-size: 1.35rem;
    }
    
    .brand-divider {
        display: none;
    }
    
    .brand-title {
        font-size: 0.85rem;
    }
    
    .brand-subtitle {
        font-size: 0.5rem;
    }
    
    .user-info {
        display: none;
    }
    
    .user-badge {
        padding: 0.35rem;
        border-radius: 50%;
    }
    
    .logout-btn {
        width: 34px;
        height: 34px;
    }
    
    main {
        padding: 0.75rem 0.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .brand-button {
        padding: 0.55rem 1.25rem;
        font-size: 0.65rem;
        width: 100%;
    }
    
    .brand-chip,
    .filter-chip,
    .action-pill {
        padding: 0.35rem 0.75rem;
        font-size: 0.6rem;
        letter-spacing: 0.12em;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    table th,
    table td {
        padding: 0.5rem 0.35rem !important;
    }
    
    .modal .card {
        margin: 0.5rem;
        padding: 1rem !important;
    }
    
    /* Скрыть длинные тексты на маленьких экранах */
    .brand-mark {
        font-size: 0.65rem;
    }
}

/* Горизонтальная ориентация на мобильных */
@media (max-width: 896px) and (orientation: landscape) {
    .nav-content {
        padding: 0.4rem 0;
    }
    
    .brand-initials-modern {
        font-size: 1.4rem;
    }
    
    main {
        padding: 1rem;
    }
}

/* Улучшение touch-интерфейса */
@media (hover: none) and (pointer: coarse) {
    .brand-button,
    .brand-chip,
    .filter-chip,
    .action-pill,
    .logout-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .brand-button:active,
    .brand-chip:active,
    .filter-chip:active,
    .action-pill:active {
        transform: scale(0.97);
    }
}
