* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

#app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 24px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

#search {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 300px;
    font-size: 14px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

#btn-add {
    background: #4CAF50;
    color: white;
}

#btn-add:hover {
    background: #45a049;
}

.btn-primary {
    background: #2196F3;
    color: white;
    width: 100%;
    padding: 12px;
    margin-top: 20px;
}

.btn-primary:hover {
    background: #1976D2;
}

main {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

tr:hover {
    background: #f8f9fa;
}

.file-link {
    color: #2196F3;
    text-decoration: none;
    font-size: 12px;
    margin-right: 5px;
}

.file-link:hover {
    text-decoration: underline;
}

.action-btns {
    display: flex;
    gap: 5px;
}

.btn-edit {
    background: #FF9800;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-delete {
    background: #f44336;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-files {
    background: #2196F3;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

#pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

#pagination button {
    background: #f0f0f0;
    color: #333;
}

#pagination button:hover {
    background: #ddd;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    #search {
        width: 100%;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 8px;
    }
}

.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 400px;
    max-width: 90%;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.error-msg {
    color: #f44336;
    margin-top: 10px;
    text-align: center;
    padding: 10px;
    background: #ffebee;
    border-radius: 5px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#current-user {
    font-weight: 500;
    color: #555;
}

.btn-logout {
    background: #f44336;
    color: white;
    padding: 8px 15px;
    font-size: 12px;
}

.btn-logout:hover {
    background: #d32f2f;
}

#filter-stage {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
}

.stage-select {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    width: 130px;
}

.stage-badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.stage-Новый {
    background: #e3f2fd;
    color: #1976d2;
}

.stage-В-работе {
    background: #fff3e0;
    color: #f57c00;
}

.stage-Расчет {
    background: #f3e5f5;
    color: #7b1fa2;
}

.stage-Согласование {
    background: #e8f5e9;
    color: #388e3c;
}

.stage-Завершен {
    background: #e0f2f1;
    color: #00796b;
}

.stage-Отказ {
    background: #ffebee;
    color: #d32f2f;
}

.file-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-calc,
.btn-file {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 3px;
}

.btn-calc {
    background: #9c27b0;
    color: white;
}

.btn-file {
    background: #2196F3;
    color: white;
}

.btn-calc:hover {
    background: #7b1fa2;
}

.btn-file:hover {
    background: #1976d2;
}

.responsible-select {
    padding: 3px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    width: 120px;
}

/* Крестик для всех модалок */
.close,
.close-file {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.close:hover,
.close-file:hover {
    color: #333;
}

/* Drop-зона */
.drop-zone {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #2196F3;
    background: #e3f2fd;
}

.drop-zone p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.drop-zone input[type="file"] {
    display: inline-block;
    margin-top: 10px;
}

.file-name {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #4CAF50;
    font-weight: 500;
}

.btn-remind {
    background: #FF9800;
    color: white;
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 3px;
}

.btn-remind:hover {
    background: #F57C00;
}

.reminder-badge {
    background: #FFF3E0;
    color: #E65100;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
}

#remind-chat {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
}

.btn-file-delete {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-file-delete:hover {
    background: #cc0000;
}

.reminder-set {
    display: flex;
    align-items: center;
    gap: 3px;
}

.btn-remind-edit {
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 3px;
    width: 20px;
    height: 20px;
    font-size: 10px;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-remind-delete {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-remind-edit:hover {
    background: #1976D2;
}

.btn-remind-delete:hover {
    background: #cc0000;
}