* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    color: #1a1a1a;
    background: #fafafa;
}

input, select, textarea, button {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

button {
    background: #fff;
    cursor: pointer;
}
button:hover { background: #f0f0f0; }
button.primary { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
button.primary:hover { background: #333; }

/* ---------- login ---------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 280px;
    padding: 24px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}
.login-form h1 { font-size: 18px; margin: 0 0 8px; }
.error-message { color: #b00020; font-size: 13px; min-height: 18px; }

/* ---------- admin edit page ---------- */

header.admin-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid #ddd;
    background: #fff;
}

main.admin-main { padding: 16px 24px; max-width: none; margin: 0; }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 12px;
}
.toolbar .count { font-size: 13px; color: #666; }

.table-scroll { overflow-x: auto; border: 1px solid #e0e0e0; border-radius: 4px; background: #fff; }

table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 3px 8px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}
th {
    color: #555;
    font-weight: 500;
    padding-top: 6px;
    padding-bottom: 2px;
    border-bottom: none;
    background: #fff;
}
tr.filter-row td { padding: 2px 6px 6px; border-bottom: 1px solid #ddd; background: #fff; }
tr.filter-row input, tr.filter-row select {
    width: 100%;
    min-width: 90px;
    font-size: 11px;
    padding: 2px 4px;
    height: 22px;
}
tbody tr:hover td { background: #f7f8fa; }
tr.row-hidden td { color: #999; }
td.col-name { white-space: normal; min-width: 160px; }
td.col-location { white-space: normal; min-width: 170px; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { border: none; background: none; padding: 2px 5px; font-size: 12px; }

/* ---------- цветные теги ---------- */

.tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    line-height: 1.5;
}
.tag-empty { border: 1px dashed #ccc; color: #999; background: transparent; }
.tag-yes { background: #e6f4ea; color: #1e7e34; }
.tag-no { background: #fdecea; color: #c0392b; }
.tag-c1  { background: #e3f0fb; color: #1c5c8c; }
.tag-c2  { background: #e0f5f0; color: #147a63; }
.tag-c3  { background: #e8f5e0; color: #3f7d1f; }
.tag-c4  { background: #f1f3d8; color: #6b6b1f; }
.tag-c5  { background: #fdf1da; color: #92660b; }
.tag-c6  { background: #fde7df; color: #a13f1f; }
.tag-c7  { background: #fbe3e3; color: #a12f2f; }
.tag-c8  { background: #fbe6f0; color: #9c2f63; }
.tag-c9  { background: #f0e6fb; color: #6a2f9c; }
.tag-c10 { background: #e6e9fb; color: #34399c; }
.tag-c11 { background: #e6ebee; color: #3d5566; }
.tag-c12 { background: #f5e6d3; color: #8a5a2b; }
.tag-c13 { background: #ececec; color: #555555; }

/* та же палитра, применённая прямо к <select> в модалке */
select.tag-select { font-weight: 500; border-color: transparent; }
select.tag-select.tag-empty { border: 1px dashed #ccc; color: #999; font-weight: 400; }

/* модальная форма — normal-flow overlay, не position: fixed */
.modal-overlay {
    display: none;
    background: rgba(0, 0, 0, 0.45);
    position: fixed;
    inset: 0;
    overflow-y: auto;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
}
.modal-overlay.open { display: flex; }
.modal-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px 24px;
    width: 100%;
    max-width: 440px;
}
.modal-card h2 { font-size: 16px; margin: 0 0 16px; }
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #444; min-width: 0; }
.form-grid select, .form-grid input, .form-grid textarea { width: 100%; min-width: 0; }
.coord-row { display: flex; gap: 12px; }
.coord-row label { flex: 1 1 0; min-width: 0; }
.checkbox-row { display: flex; align-items: center; gap: 6px; flex-direction: row !important; }
.checkbox-row input { width: auto; }
.city-row { display: flex; gap: 6px; align-items: flex-end; min-width: 0; }
.city-row select { flex: 1 1 0; min-width: 0; }
.city-row button { flex-shrink: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions .danger { color: #b00020; margin-right: auto; }
