:root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 20px 50px rgba(15, 23, 42, .12);
    --radius: 18px;
    --accent: #111827;
    --accent-soft: #f1f5f9;
    --danger: #b91c1c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-shell {
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 18px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
}

.brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 22px;
}

.brand h1 {
    font-size: 20px;
    line-height: 1.15;
    margin: 0;
}

.brand p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, .06);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card h2 {
    margin: 0 0 10px;
    font-size: 17px;
}

.hint {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin: 11px 0 6px;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
}

input:focus,
textarea:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, .2);
}

input[readonly] {
    background: #f8fafc;
    color: var(--muted);
}

.coords-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 12px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    padding: 11px 14px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}

button:hover,
.button:hover {
    filter: brightness(1.05);
}

button.secondary {
    background: var(--accent-soft);
    color: var(--text);
}

button.text-button {
    width: auto;
    margin: 0;
    padding: 7px 10px;
    background: #f8fafc;
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 13px;
}

.status {
    margin: 8px 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 14px;
}

.status.error {
    background: #fef2f2;
    color: #991b1b;
}

.status.ok {
    background: #ecfdf5;
    color: #065f46;
}

.houses-list {
    display: grid;
    gap: 8px;
    max-height: 330px;
    overflow: auto;
    padding-right: 4px;
}

.house-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    cursor: pointer;
}

.house-item:hover {
    background: #f8fafc;
}

.house-item strong {
    display: block;
    font-size: 15px;
}

.house-item span {
    color: var(--muted);
    font-size: 12px;
}

.house-item .coords {
    text-align: right;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.map-area {
    position: relative;
    min-width: 0;
}

#map {
    width: 100%;
    height: 100vh;
    z-index: 1;
}

.map-toolbar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    max-width: min(760px, calc(100% - 32px));
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 14px;
}

.house-number-marker {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 13px;
    border: 3px solid #fff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .28);
}

.temp-marker {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #fff;
    border: 4px solid #111827;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .25);
}

.popup-title {
    font-size: 16px;
    margin: 0 0 6px;
}

.popup-meta {
    color: #475569;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.popup-note {
    border-top: 1px solid #e2e8f0;
    margin-top: 8px;
    padding-top: 8px;
    color: #334155;
    font-size: 13px;
}

.popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.popup-actions button {
    width: auto;
    margin: 0;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
}

.popup-actions .danger {
    background: var(--danger);
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        max-height: none;
    }

    #map {
        height: 70vh;
    }

    .map-toolbar {
        top: 10px;
        border-radius: 16px;
    }
}

.moderation-info {
    border-color: #c7d2fe;
    background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
}

.admin-link {
    width: 100%;
    margin-top: 8px;
}

.is-hidden {
    display: none !important;
}

.edit-card {
    border-color: #bfdbfe;
}

.popup-note.muted {
    color: var(--muted);
}

.popup-actions {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.popup-actions button {
    width: 100%;
    margin-top: 0;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 12px;
}

.popup-actions button.danger {
    background: var(--danger);
}

.status.warning {
    background: #fffbeb;
    color: #92400e;
}

/* v0.3 — logowanie, rejestracja i użytkownicy */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #f3f4f6;
    padding: 24px;
}

.auth-card {
    width: min(460px, 100%);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 26px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .10);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.auth-card label {
    display: block;
    font-weight: 800;
    font-size: 13px;
    margin: 14px 0 6px;
}

.auth-card input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
}

.button.full {
    width: 100%;
    margin-top: 16px;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 18px 0 0;
    color: #64748b;
}

.auth-links a {
    color: #111827;
    font-weight: 700;
    text-decoration: none;
}

.status.ok {
    background: #ecfdf5;
    color: #065f46;
}

.status.error {
    background: #fef2f2;
    color: #991b1b;
}

.light-inline {
    margin-top: 8px;
    background: #f1f5f9 !important;
    color: #111827 !important;
    border: 1px solid #e2e8f0;
}
