:root { --primary-color: #2e7d32; --primary-dark: #1b5e20; --secondary-color: #4caf50; --accent-color: #81c784; --bg-color: #f0f2f5; --card-bg: #ffffff; --text-color: #333; --danger-color: #e53935; --warning-color: #ff9800; --info-color: #0288d1; --border-radius: 12px; --shadow: 0 4px 12px rgba(0,0,0,0.08); }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); line-height: 1.6; padding-bottom: 40px; font-size: 17px; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }
header { background: linear-gradient(135deg, var(--primary-dark), var(--primary-color)); color: white; padding: 1rem 0; box-shadow: 0 4px 12px rgba(0,0,0,0.15); position: sticky; top: 0; z-index: 100; transition: all 0.3s ease; }
.header-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.logo { display: flex; align-items: center; font-weight: 700; font-size: 1.4rem; white-space: nowrap; }
.logo i { margin-right: 10px; color: var(--accent-color); }
nav { flex-grow: 1; }
nav ul { display: flex; list-style: none; gap: 5px; flex-wrap: wrap; justify-content: center; }
nav ul li a { color: rgba(255,255,255,0.9); text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: var(--border-radius); transition: all 0.2s; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
nav ul li a:hover, nav ul li a.active { background-color: rgba(255,255,255,0.15); color: white; transform: translateY(-1px); }
.user-welcome { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.15); padding: 5px 15px; border-radius: 20px; font-size: 0.9rem; white-space: nowrap; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background-color: var(--accent-color); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-logout { background: none; border: none; color: rgba(255,255,255,0.8); cursor: pointer; font-size: 1.1rem; margin-left: 5px; }
.btn { padding: 12px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; box-shadow: 0 2px 5px rgba(0,0,0,0.15); }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: var(--primary-dark); }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-admin { background-color: var(--warning-color); color: white; }
.btn-info { background-color: var(--info-color); color: white; }
.btn-sm { padding: 8px 14px; font-size: 0.95rem; }
.section { background-color: transparent; padding: 0; margin-bottom: 2rem; }
.section > h2 { background: white; padding: 15px; border-radius: var(--border-radius); box-shadow: var(--shadow); color: var(--primary-dark); margin-bottom: 1.5rem; font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.admin-panel { background-color: #fff8e1; border-left: 4px solid var(--warning-color); padding: 1rem; margin-bottom: 1.5rem; border-radius: 6px; box-shadow: var(--shadow); }
.member-electricity-card { background: white; border-radius: var(--border-radius); padding: 20px; margin-bottom: 25px; box-shadow: var(--shadow); border: 1px solid #e0e0e0; }
.member-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid #f5f5f5; flex-wrap: wrap; gap: 10px;}
.member-name { font-size: 1.2rem; font-weight: bold; color: var(--primary-color); }
.readings-badge { display: inline-flex; align-items: center; gap: 10px; background: #e3f2fd; color: #0277bd; padding: 5px 10px; border-radius: 6px; font-size: 0.9rem; margin-left: auto; cursor: pointer; border: 1px solid transparent; transition: all 0.2s; }
.readings-badge:hover { background: #bbdefb; border-color: #90caf9; }
.readings-badge i { font-size: 0.8rem; opacity: 0.7; }
.news-item { background: white; border-radius: var(--border-radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; border-left: 5px solid var(--secondary-color); transition: transform 0.2s; position: relative; }
.news-item:hover { transform: translateY(-2px); }
.news-date { color: #888; font-size: 0.9rem; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.news-title { font-size: 1.3rem; margin-bottom: 10px; color: var(--text-color); font-weight: 700; }
.news-content { color: #555; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; }
.delete-news-btn { position: absolute; top: 20px; right: 20px; color: #aaa; cursor: pointer; transition: color 0.2s; }
.delete-news-btn:hover { color: var(--danger-color); }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.doc-card { background: white; padding: 15px; border-radius: var(--border-radius); box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.doc-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.doc-preview { height: 150px; display: flex; align-items: center; justify-content: center; background: #f9f9f9; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.doc-preview i { font-size: 4rem; color: #ccc; }
.doc-preview-img { width: 100%; height: 100%; object-fit: cover; }
.doc-name { font-weight: 600; font-size: 1rem; margin-bottom: 5px; word-break: break-word; }
.doc-meta { font-size: 0.8rem; color: #777; margin-bottom: 10px; }
.doc-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: auto; }
.doc-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 5px; transition: transform 0.2s; }
.doc-btn:hover { transform: scale(1.15); }
.doc-btn.download { color: var(--primary-color); }
.doc-btn.delete { color: var(--danger-color); }
.suggestion-form { background: white; padding: 20px; border-radius: var(--border-radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.suggestion-list { display: flex; flex-direction: column; gap: 15px; }
.suggestion-card { background: white; padding: 20px; border-radius: var(--border-radius); box-shadow: var(--shadow); border-left: 4px solid var(--accent-color); position: relative; }
.suggestion-header { display: flex; justify-content: space-between; font-size: 0.85rem; color: #777; margin-bottom: 10px; }
.suggestion-text { font-size: 1rem; line-height: 1.5; }
.suggestion-delete { position: absolute; top: 15px; right: 15px; color: #aaa; cursor: pointer; }
.suggestion-delete:hover { color: var(--danger-color); }
.balance-block { display: flex; justify-content: space-between; align-items: center; background: #f9f9f9; padding: 10px 15px; border-radius: 8px; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.balance-text { font-size: 1.1rem; font-weight: 500; }
.balance-positive { color: var(--primary-color); }
.balance-negative { color: var(--danger-color); }
.balance-actions { display: flex; gap: 10px; }
.table-scroll-wrapper { max-height: 300px; overflow-y: auto; overflow-x: auto; border: 1px solid #eee; border-radius: 6px; }
.table-scroll-wrapper thead th { position: sticky; top: 0; background-color: #f1f3f5; z-index: 1; box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1); white-space: nowrap; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
table th { color: #555; font-weight: 600; padding: 12px 15px; text-align: left; }
table td { padding: 10px 15px; border-bottom: 1px solid #eee; vertical-align: middle; }
table tr:hover { background-color: #fafafa; }
.editable, .editable-note, .editable-balance { cursor: pointer; border-bottom: 1px dashed #ccc; }
.editable:hover { background-color: #fff3e0; }
.editable-note:empty::after { content: "✎"; color: #ccc; }
.payment-status { padding: 4px 10px; border-radius: 15px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.payment-status.paid { background-color: #e8f5e9; color: #2e7d32; }
.payment-status.unpaid { background-color: #ffebee; color: #c62828; }
.payment-status.partial { background-color: #fff3e0; color: #ef6c00; }
.draggable-row { cursor: grab; }
.draggable-row.dragging { opacity: 0.5; background: #e3f2fd; border: 2px dashed #2196f3; }
.draggable-row.drag-over { border-top: 3px solid #2e7d32; }
.grab-handle { color: #ccc; cursor: grab; margin-right: 10px; padding: 5px; }
.grab-handle:hover { color: #555; }
.logs-wrapper { display: flex; gap: 20px; flex-wrap: wrap; }
.log-column { flex: 1; min-width: 300px; background: white; padding: 15px; border-radius: var(--border-radius); box-shadow: var(--shadow); }
.log-column h3 { font-size: 1.1rem; color: var(--text-color); margin-bottom: 10px; border-bottom: 2px solid var(--accent-color); padding-bottom: 5px; }
.audit-log-container { max-height: 400px; overflow-y: auto; background: white; border-radius: var(--border-radius); box-shadow: inset 0 0 5px rgba(0,0,0,0.05); padding: 0; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.stat-card { background: white; padding: 25px; border-radius: var(--border-radius); box-shadow: var(--shadow); position: relative; overflow: hidden; border-left: 5px solid var(--primary-color); display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.stat-card.debt { border-left-color: var(--danger-color); }
.stat-title { font-size: 1rem; font-weight: 600; color: #666; text-transform: uppercase; margin-bottom: 5px; }
.stat-value { font-size: 2.2rem; font-weight: 700; }
.stat-icon { position: absolute; right: 20px; top: 20px; font-size: 2.5rem; opacity: 0.1; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: none; justify-content: center; align-items: center; backdrop-filter: blur(2px); }
.modal-window { background: white; width: 95%; max-width: 500px; padding: 30px; border-radius: 16px; box-shadow: 0 15px 30px rgba(0,0,0,0.2); }
.modal-content input { width: 100%; padding: 14px; margin-bottom: 15px; border: 2px solid #ddd; border-radius: 10px; font-size: 1.1rem; }
.modal-content label { font-size: 1rem; font-weight: 700; color: #333; margin-bottom: 8px; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.success-modal-content { text-align: center; padding: 20px 0; }
.success-icon { font-size: 60px; color: var(--secondary-color); margin-bottom: 20px; display: block; }
.success-text { font-size: 1.4rem; color: var(--text-color); font-weight: 600; }
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #e8f5e9, #c8e6c9); padding: 20px; }
.login-container { background: white; padding: 40px; border-radius: 16px; box-shadow: 0 15px 35px rgba(46, 125, 50, 0.1); width: 100%; max-width: 380px; text-align: center; }
.login-header h2 { color: var(--primary-color); margin-bottom: 10px; font-size: 1.8rem; display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-header p { color: #666; margin-bottom: 30px; font-size: 0.95rem; }
.login-form-group { margin-bottom: 20px; text-align: left; }
.login-form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; color: #444; }
.login-input { width: 100%; padding: 14px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 1.1rem; transition: border-color 0.3s; }
.login-input:focus { border-color: var(--secondary-color); outline: none; }
.login-btn { width: 100%; padding: 12px; background-color: var(--primary-color); color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background-color 0.3s, transform 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-btn:hover { background-color: var(--primary-dark); transform: translateY(-2px); }
.password-wrapper { position: relative; width: 100%; }
.toggle-password { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #aaa; z-index: 2; font-size: 1rem; transition: color 0.2s; }
.toggle-password:hover { color: var(--primary-color); }
.password-wrapper input { padding-right: 40px !important; margin-bottom: 0; }
.password-card { background: white; padding: 25px; border-radius: var(--border-radius); box-shadow: var(--shadow); margin-top: 20px; max-width: 500px; }
.password-card h3 { margin-bottom: 20px; color: var(--primary-dark); border-bottom: 1px solid #eee; padding-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.form-control { width: 100%; padding: 14px; border: 2px solid #ddd; border-radius: 10px; font-size: 1.1rem; margin-bottom: 15px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
#members-page .table-scroll-wrapper { max-height: none !important; overflow-y: visible !important; }

/* ОПРОСЫ */
.poll-card { background: white; border-radius: var(--border-radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); border-left: 5px solid #9c27b0; }
.poll-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; flex-wrap: wrap; gap:10px; }
.poll-title { font-size: 1.2rem; font-weight: bold; color: var(--text-color); }
.poll-status { font-size: 0.8rem; padding: 3px 8px; border-radius: 12px; font-weight: bold; }
.poll-status.active { background: #e8f5e9; color: #2e7d32; }
.poll-status.closed { background: #ffebee; color: #c62828; }
.poll-desc { color: #666; margin-bottom: 15px; font-size: 0.95rem; white-space: pre-wrap; word-wrap: break-word;}
.poll-option-btn { display: block; width: 100%; text-align: left; padding: 12px 15px; margin-bottom: 8px; background: #f9f9f9; border: 2px solid #eee; border-radius: 8px; cursor: pointer; transition: all 0.2s; font-size: 1rem; }
.poll-option-btn:hover { background: #f0f7ff; border-color: #2196f3; }
.poll-result-item { margin-bottom: 12px; }
.poll-result-label { display: flex; justify-content: space-between; font-size: 0.95rem; margin-bottom: 4px; }
.poll-progress-bg { background: #eee; height: 8px; border-radius: 4px; overflow: hidden; }
.poll-progress-fill { background: #9c27b0; height: 100%; transition: width 0.5s ease; }
.poll-voted-mark { color: var(--primary-color); font-weight: bold; font-size: 0.85rem; }

/* Модалка с текстом */
.modal-content textarea { width: 100%; padding: 14px; margin-bottom: 15px; border: 2px solid #ddd; border-radius: 10px; font-size: 1.1rem; resize: none; overflow-y: hidden; min-height: 100px; font-family: inherit; line-height: 1.5; }
.modal-content textarea:focus { border-color: var(--primary-color); outline: none; }

/* МОБИЛКА */
@media (max-width: 768px) {
    header { position: relative; padding: 10px 0; }
    .header-content { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 10px 0; }
    .logo { grid-column: 1; font-size: 1.5rem; justify-content: center; width: 100%; margin-bottom: 10px; }
    .user-welcome { grid-column: 2; background: transparent; padding: 0; justify-content: flex-end; }
    .user-welcome span { display: none; }
    nav { grid-column: 1 / -1; width: 100%; overflow-x: visible !important; padding-bottom: 0 !important; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 10px; }
    nav ul { flex-wrap: wrap !important; justify-content: center !important; gap: 8px !important; padding: 0 5px; }
    nav ul li { flex: 1 1 45%; min-width: 140px; }
    nav ul li a { justify-content: center; background: rgba(255,255,255,0.15); padding: 12px 10px !important; font-size: 1rem !important; border: 1px solid rgba(255,255,255,0.2); }
    nav ul li a.active { background: white !important; color: var(--primary-dark) !important; font-weight: 800; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
    .balance-block { flex-direction: column; align-items: flex-start; }
    .balance-actions { width: 100%; display: flex; gap: 10px; }
    .balance-actions .btn { flex: 1; justify-content: center; }
    .readings-badge { width: 100%; margin-top: 10px; justify-content: center; padding: 10px; }
    .logs-wrapper { flex-direction: column; }
    .docs-grid { grid-template-columns: 1fr; }
    .container { padding: 0 10px; }
    .member-electricity-card { padding: 15px; border: none; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
    .table-scroll-wrapper { max-height: none !important; overflow: visible !important; border: none !important; }
    table { min-width: 0 !important; width: 100% !important; }
    #membersTable thead, .electricity-table thead { display: none; }
    #membersTable tbody, #membersTable tr, #membersTable td, .electricity-table tbody, .electricity-table tr, .electricity-table td { display: block; width: 100%; }
    #membersTable tr, .electricity-table tr { margin-bottom: 20px; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border: 2px solid #eee; overflow: hidden; }
    .status-badge { font-size: 0.8rem; padding: 2px 8px; border-radius: 10px; background: #eee; color: #777; white-space: nowrap; }
    .status-badge.active { background: #e8f5e9; color: #2e7d32; }
    #membersTable td, .electricity-table td { display: flex; justify-content: space-between; align-items: center; text-align: right; padding: 12px 15px; border-bottom: 1px solid #f5f5f5; font-size: 1rem; min-height: 40px; }
    #membersTable td::before, .electricity-table td::before { content: attr(data-label); font-weight: 600; font-size: 0.95rem; color: #444; margin-right: 15px; text-align: left; flex-shrink: 0; }
    .grab-handle { display: none; }
    #membersTable td:last-child, .electricity-table td:last-child { border-bottom: none; justify-content: flex-end; background-color: #fafafa; }
    #membersTable td:last-child::before, .electricity-table td[data-label="Действия"]::before { display: none; }
}
.page { display: none; }
.page.active { display: block; }
