* { box-sizing: border-box; }
body { font-family: Arial, Helvetica, sans-serif; margin: 0; background: #f5f6f8; color: #222; }
.nav { background: #2f3e46; padding: 10px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.nav a { color: #fff; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav-brand { font-weight: bold; }
.nav-user { margin-left: auto; color: #cbd5c0; }
main { padding: 20px; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 22px; }
table.data { border-collapse: collapse; width: 100%; background: #fff; }
table.data th, table.data td { border: 1px solid #ddd; padding: 6px 10px; text-align: left; font-size: 14px; vertical-align: middle; }
table.data th { background: #4472c4; color: #fff; }
table.data th a.sort-link { color: #fff; text-decoration: none; }
table.data th a.sort-link:hover { text-decoration: underline; }
table.data tr.confirmed { background: #e2efda; }
table.detail { border-collapse: collapse; background: #fff; }
table.detail th { text-align: left; padding: 4px 10px; background: #eee; width: 260px; border: 1px solid #ddd; }
table.detail td { padding: 4px 10px; border: 1px solid #ddd; }
.filters { margin-bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select { padding: 6px; }
.phone-filter { max-width: 160px; }
.status-form select { padding: 3px; max-width: 260px; }
.status-filter { position: relative; }
.status-filter summary { cursor: pointer; padding: 6px 10px; background: #fff; border: 1px solid #ccc; border-radius: 4px; list-style: none; }
.status-filter summary::-webkit-details-marker { display: none; }
.status-filter[open] summary { border-radius: 4px 4px 0 0; }
.status-checks { position: absolute; z-index: 5; background: #fff; border: 1px solid #ccc; border-top: none; padding: 8px 12px; min-width: 320px; max-height: 260px; overflow-y: auto; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.status-checks label { display: block; font-size: 13px; padding: 3px 0; white-space: nowrap; }
.clear-filters { align-self: center; font-size: 13px; color: #4472c4; }
.confirm-form { display: flex; align-items: center; justify-content: center; }
.confirm-form input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.pagination { margin-top: 14px; display: flex; gap: 12px; align-items: center; }
.flash { list-style: none; padding: 0; }
.flash li { padding: 8px 12px; margin-bottom: 8px; border-radius: 4px; }
.flash-success { background: #d4edda; color: #155724; }
.flash-error { background: #f8d7da; color: #721c24; }
.login-form { display: flex; flex-direction: column; gap: 10px; max-width: 320px; }
.login-form label { display: flex; flex-direction: column; gap: 4px; }
button { cursor: pointer; padding: 8px 14px; background: #4472c4; color: #fff; border: none; border-radius: 4px; }
button:hover { background: #35569c; }

/* Раскрывающиеся строки ФИО с неподтверждёнными номерами на странице статистики */
table.stats-table td.stats-expand-cell { padding: 0; }
.stats-row-details { width: 100%; }
.stats-row-summary {
  display: flex; cursor: pointer; list-style: none; padding: 6px 10px 6px 6px;
}
.stats-row-summary::-webkit-details-marker { display: none; }
.stats-row-summary::before { content: '▸'; color: #888; width: 16px; flex: 0 0 16px; }
.stats-row-details[open] > .stats-row-summary::before { content: '▾'; }
.stats-row-summary .stats-col { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-row-summary .stats-col:nth-child(1) { flex: 0 0 calc(40% - 20px); }
.stats-row-summary .stats-col:nth-child(2) { flex: 0 0 20%; }
.stats-row-summary .stats-col:nth-child(3) { flex: 0 0 20%; }
.stats-row-summary .stats-col:nth-child(4) { flex: 0 0 20%; }
.stats-inner-table {
  width: calc(100% - 40px); margin: 0 10px 10px 30px; border-collapse: collapse; background: #f7f8fa;
}
.stats-inner-table th, .stats-inner-table td {
  border: 1px solid #ddd; padding: 4px 8px; font-size: 13px; text-align: left;
}
.stats-inner-table th { background: #dbe4f3; color: #1f2d3d; }

/* Страница "Персональные данные" */
table.personal-table th, table.personal-table td { font-size: 13px; }
.personal-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; max-width: 1000px; }
.personal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.personal-form input { padding: 6px; }
.personal-form .form-buttons { grid-column: 1 / -1; display: flex; gap: 14px; align-items: center; }
.delete-form { margin-top: 24px; }
button.danger { background: #c0392b; }
button.danger:hover { background: #962d22; }

.megafon-form { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.megafon-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.megafon-form textarea { padding: 6px; font-family: monospace; }
.megafon-form .form-buttons { display: flex; gap: 12px; }
.row-delete { padding: 4px 8px; font-size: 12px; }
.clear-db-form { display: inline; }

/* Администрирование */
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.inline-form input[type="password"] { padding: 4px; width: 140px; }
.admin-create-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.admin-create-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.admin-create-form input[type="text"], .admin-create-form input[type="password"] { padding: 6px; }
.admin-create-form .checkbox-label { flex-direction: row; align-items: center; gap: 6px; }
