:root {
    --primary: #E4002B;
    --primary-glow: rgba(228, 0, 43, 0.5);
    --bg-main: #0f172a; /* Темный современный фон */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    background: #f8fafc;
    position: relative;
}

/* Animated Mesh Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 10% 10%, rgba(228, 0, 43, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(0, 120, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 1) 0%, #020617 100%);
    animation: bgAnimate 20s ease infinite alternate;
}

@keyframes bgAnimate {
    0% { transform: scale(1); }
    100% { transform: scale(1.1) rotate(2deg); }
}

.glass-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 1fr; /* Фиксируем высоту строки */
    height: 100vh;
    padding: 20px;
    gap: 20px;
    overflow: hidden; /* Контейнер не должен расти */
}

/* Sidebar Ultra-Glass */
.sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    min-height: 0; /* Важно для скролла внутри grid */
}

.logo {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 30px;
    text-align: left;
    padding-left: 10px;
}

.logo-red {
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
}

nav {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
}

nav::-webkit-scrollbar { width: 4px; }
nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 10px; }

.nav-item {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 14px 18px;
    margin-bottom: 8px;
    border-radius: 16px;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateX(8px);
}

.nav-item.active {
    background: rgba(228, 0, 43, 0.15);
    color: #ff4d6d;
    box-shadow: inset 0 0 15px rgba(228, 0, 43, 0.1);
    border: 1px solid rgba(228, 0, 43, 0.3);
}

.nav-header {
    margin: 30px 0 15px 18px;
    font-size: 10px;
    color: #94a3b8;
    letter-spacing: 2px;
    font-weight: 800;
    text-transform: uppercase;
}

/* Content Area */
.content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    padding-bottom: 100px; /* Добавляем больше места снизу */
    overflow-y: auto;
    box-shadow: var(--card-shadow);
    min-height: 0; /* Важно для корректного скролла в grid */
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
}

h1 {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.search-bar {
    flex-grow: 1;
    margin: 0 40px;
    max-width: 600px;
    position: relative;
}

.search-bar input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 24px;
    border-radius: 20px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    transform: translateY(-2px);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 18px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Stats Ultra */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 28px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition);
    text-align: left;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 30px var(--primary-glow);
}

/* Cards Ultra */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
}

.card {
    background: rgba(255, 255, 255, 0.03);
    padding: 30px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-8px);
    border-color: rgba(228, 0, 43, 0.4);
    box-shadow: 0 0 30px rgba(228, 0, 43, 0.15);
}

.card-type {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 10px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-number {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
    display: block;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
}

.info-label { color: rgba(255, 255, 255, 0.4); }

.card-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.card-user-name {
    font-weight: 700;
    font-size: 15px;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-free { background: #dcfce7; color: #15803d; }
.status-assigned { background: rgba(0, 120, 255, 0.15); color: #60a5fa; border: 1px solid rgba(0, 120, 255, 0.3); }
.status-broken { background: #fee2e2; color: #b91c1c; }
.status-blocked { background: #f1f5f9; color: #475569; }

/* Modal Ultra */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    width: 100%;
    max-width: 580px;
    padding: 40px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.6);
    transform: scale(1);
    animation: slideUp 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.btn {
    padding: 16px 24px;
    border-radius: 20px;
    font-weight: 700;
    font-family: var(--font-heading);
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 25px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px var(--primary-glow);
    filter: brightness(1.1);
}

input, select, textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 18px;
    border-radius: 16px;
    font-weight: 500;
    font-size: 15px;
    color: #fff;
    font-family: var(--font-main);
    outline: none;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

option {
    background: #1e293b;
    color: #fff;
}

/* Hidden */
.hidden { display: none !important; }

/* Sidebar footer */
.sidebar-footer {
    padding-top: 20px;
}

/* Sidebar Add button */
#add-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px var(--primary-glow);
    transition: var(--transition);
}

#add-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px var(--primary-glow);
    filter: brightness(1.08);
}

.plus-icon {
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.close-modal {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: #f1f5f9;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: #64748b;
}

.close-modal:hover {
    background: #fee2e2;
    color: var(--primary);
}

/* Form groups */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Modal Footer */
.modal-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 32px;
}

/* Btn Secondary */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    font-weight: 700;
    font-family: var(--font-heading);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 20px;
    padding: 16px 24px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Card actions */
.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.card-actions .btn {
    flex: 1;
    padding: 10px;
    font-size: 13px;
    border-radius: 14px;
    font-family: var(--font-main);
    font-weight: 600;
}

/* Loader */
.loader {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 60px auto;
}

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

/* Empty state */
.empty-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 16px;
    padding: 60px;
    grid-column: 1 / -1;
}

/* Card entrance animation */
@keyframes cardIn {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card {
    animation: cardIn 0.5s var(--transition) both;
}

/* Stat card icon */
.stat-icon {
    font-size: 28px;
    margin-bottom: 14px;
    display: block;
}

/* Scrollbar for content */
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }

/* Error state */
.error {
    color: #b91c1c;
    text-align: center;
    padding: 40px;
}

/* Operator dot in sidebar */
.op-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Operator badge on cards */
.op-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.op-MegaCom { background: rgba(228, 0, 43, 0.15); color: #ff4d6d; border: 1px solid rgba(228, 0, 43, 0.3); box-shadow: 0 0 10px rgba(228, 0, 43, 0.1); }
.op-O\!     { background: rgba(255, 120, 0, 0.15); color: #ffaa40; border: 1px solid rgba(255, 120, 0, 0.3); box-shadow: 0 0 10px rgba(255, 120, 0, 0.1); }
.op-Другой  { background: rgba(255, 255, 255, 0.05); color: #94a3b8; border: 1px solid rgba(255, 255, 255, 0.1); }

/* Grouped items in card */
.group-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.group-item-row:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}


/* Employee view grid */
.employee-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.emp-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transition: var(--transition);
}

.emp-card:hover {
    box-shadow: 0 15px 40px rgba(0,0,0,0.06);
    transform: translateY(-3px);
}

.emp-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.emp-card-header img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
}

.emp-card-name {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
}

.emp-card-dept {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.emp-sim-count {
    margin-left: auto;
    background: rgba(228,0,43,0.08);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.emp-sims {
    display: flex;
    gap: 16px;
    padding: 20px 28px;
    flex-wrap: wrap;
}

.emp-sim-chip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 200px;
    transition: var(--transition);
    cursor: pointer;
}

.emp-sim-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(228, 0, 43, 0.4);
    box-shadow: 0 4px 20px rgba(228, 0, 43, 0.15);
}

.emp-sim-number {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
}

.emp-sim-iccid {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

/* Unassigned section */
.unassigned-header {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.free-chips {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
