* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.header {
    background: #1e3a5f;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.header p {
    color: #cbd5e1;
    font-size: 0.85rem;
}

.logo-space img {
    display: block;
    height: 60px;
    width: auto;
}

.user-bar {
    background: white;
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid #e2e8f0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.user-info span:first-child {
    font-weight: 700;
    color: #1e3a5f;
}

.user-role {
    background: #1e3a5f;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
}

.user-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.bot-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: #2c5282;
    color: white;
    text-decoration: none;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 600;
}

.bot-link:hover {
    background: #1e3a5f;
}

.logout-btn {
    padding: 6px 16px;
    background: #e53e3e;
    color: white;
    text-decoration: none;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.logout-btn:hover {
    background: #c53030;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e3a5f;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2c5282;
}

.success-message {
    background: #e6fffa;
    border-left: 4px solid #38a169;
    color: #22543d;
}

.error-message {
    background: #fff5f5;
    border-left: 4px solid #e53e3e;
    color: #742a2a;
}

.success-message, .error-message {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.search-container {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
}

.search-box {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: #2c5282;
}

.search-clear {
    padding: 10px 20px;
    background: #1e3a5f;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.search-clear:hover {
    background: #2c5282;
}

.search-results-info {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #4a5568;
}

.highlight {
    background: #fefcbf;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

.form-card {
    background: white;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: white;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
}

.section-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e3a5f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-icon {
    color: #718096;
    font-size: 0.9rem;
}

.section-content {
    padding: 20px;
}

.section-content.collapsed {
    display: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 4px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #2d3748;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    background: white;
    font-size: 0.9rem;
    border-radius: 8px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c5282;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border-radius: 8px;
    gap: 6px;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
}

.btn-success {
    background: #38a169;
    color: white;
}

.btn-success:hover {
    background: #2f855a;
}

.btn-primary {
    background: #1e3a5f;
    color: white;
}

.btn-primary:hover {
    background: #2c5282;
}

.btn-warning {
    background: #dd6b20;
    color: white;
}

.btn-warning:hover {
    background: #c05621;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: #f7fafc;
    color: #1e3a5f;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
}

.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.85rem;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.category-list {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #edf2f7;
    background: white;
}

.category-item:last-child {
    border-bottom: none;
}

.category-item span {
    font-weight: 600;
}

.category-actions {
    display: flex;
    gap: 8px;
}

.categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 24px;
}

.category {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.category-header {
    padding: 14px 20px;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}

.category-header span:first-child {
    font-weight: 800;
    color: #1e3a5f;
    font-size: 1.1rem;
}

.badge {
    background: #eceee9;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    min-width: 32px;
    text-align: center;
}

.category-content.collapsed {
    display: none;
}

.documents {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 12px;
}

.doc-info {
    flex: 1;
}

.doc-info h4 {
    font-weight: 700;
    color: #1e3a5f;
    margin-bottom: 4px;
    font-size: 1rem;
}

.doc-info p {
    color: #4a5568;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.doc-info small {
    color: #718096;
    font-size: 0.7rem;
}

.doc-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    position: relative;
}

.modal-content h2 {
    padding: 16px 20px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e3a5f;
    border-bottom: 1px solid #e2e8f0;
}

.modal-content form {
    padding: 20px;
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 24px;
    color: #718096;
    cursor: pointer;
}

.close-modal:hover {
    color: #1e3a5f;
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .logo-space img {
        height: 45px;
    }
    
    .user-bar {
        flex-direction: column;
        text-align: center;
    }
    
    .user-buttons {
        justify-content: center;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .search-clear {
        width: 100%;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .document {
        flex-direction: column;
    }
    
    .doc-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
    }
    
    .modal-content {
        margin: 16px;
    }
    
    .category-header {
        flex-direction: column;
        text-align: center;
    }
}

@media print {
    .user-bar,
    .search-container,
    .form-card,
    .doc-actions,
    .logout-btn,
    .bot-link {
        display: none;
    }
}

.empty-message {
    text-align: center;
    color: #718096;
    padding: 32px;
    font-style: italic;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
}