/* === Общие стили === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f4f6f9;
    color: #2c3e50;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    padding: 30px 35px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.container:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* === Заголовки и навигация === */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.5px;
}

nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

nav a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

nav a:hover {
    background: #eef2ff;
    color: #1e40af;
}

.logout-btn {
    background: #fee2e2;
    color: #b91c1c !important;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
}

.logout-btn:hover {
    background: #fecaca !important;
}

/* === Кнопки и фильтры === */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 20px;
    background: #f1f5f9;
    color: #334155;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-btn.active {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.filter-btn:hover:not(.active) {
    background: #e2e8f0;
}

.add-btn {
    display: inline-flex;
    align-items: center;
    background: #10b981;
    color: #fff;
    padding: 10px 22px;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.1s;
    margin: 15px 0;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.add-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.add-btn.top {
    margin-top: 0;
}

.add-btn.bottom {
    margin-bottom: 0;
}

/* === Таблицы === */
.clients-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.clients-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}

.clients-table thead th a {
    color: #475569;
    text-decoration: none;
    transition: color 0.2s;
}

.clients-table thead th a:hover {
    color: #1e293b;
}

.clients-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.95rem;
}

.clients-table tbody tr:last-child td {
    border-bottom: none;
}

.clients-table tbody tr {
    transition: background 0.15s;
}

.clients-table tbody tr:hover {
    background: #f8fafc;
}

/* Кнопки действий в таблице */
.edit-btn,
.delete-btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.edit-btn {
    background: #fef3c7;
    color: #92400e;
}

.edit-btn:hover {
    background: #fde68a;
}

.delete-btn {
    background: #fee2e2;
    color: #991b1b;
}

.delete-btn:hover {
    background: #fecaca;
}

/* === Формы === */
.login-box {
    max-width: 400px;
    margin: 80px auto;
    background: #fff;
    padding: 35px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.login-box h2 {
    margin-bottom: 25px;
    font-size: 1.8rem;
    color: #1e293b;
    text-align: center;
}

.login-box label,
.add-form label {
    display: block;
    margin-bottom: 16px;
    font-weight: 500;
    color: #475569;
}

.login-box input[type="text"],
.login-box input[type="password"],
.add-form input[type="text"],
.add-form input[type="number"],
.add-form select {
    width: 100%;
    padding: 10px 14px;
    margin-top: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.add-form input:focus,
.add-form select:focus,
.login-box input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #fff;
}

.add-form button,
.login-box button {
    padding: 11px 24px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.add-form button:hover,
.login-box button:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.radio-group {
    display: flex;
    gap: 25px;
    margin-bottom: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

/* === Сообщения === */
.success {
    background: #dcfce7;
    color: #166534;
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    border-left: 4px solid #22c55e;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    border-left: 4px solid #ef4444;
}

.error-box {
    background: #fee2e2;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    color: #991b1b;
}

.error-box p {
    margin-bottom: 5px;
}

/* === Вспомогательные элементы === */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 25px;
    color: #64748b;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: #1e293b;
}

small {
    display: block;
    color: #64748b;
    margin-top: 4px;
    font-size: 0.85rem;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    .clients-table thead {
        display: none;
    }
    .clients-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 12px;
    }
    .clients-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #475569;
        margin-right: 10px;
    }
}

tr.unpaid {
    background-color: #fff0f0 !important;
}