:root {
    --sea: #d8e4ef;
    --land: #f3efe6;
    --land-hover: #fffdf8;
    --merkez: #c8c0b2;
    --stroke: #3a4552;
    --ink: #1a222c;
    --panel: #f7f4ee;
    --muted: #5c6672;
    --shadow: 0 18px 50px rgba(26, 34, 44, 0.18);
    --font: "Manrope", system-ui, sans-serif;
    --display: "Syne", system-ui, sans-serif;
    --focus: #2f6fed;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    color: var(--ink);
    background: var(--sea);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

::selection {
    background: rgba(47, 111, 237, 0.22);
}

.page-map,
.main-map {
    width: 100%;
    height: 100%;
}

.map {
    width: 100%;
    height: 100%;
    background: var(--sea);
}

.map-back {
    position: fixed;
    top: 1rem;
    left: 4.25rem;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 0;
    border-radius: 999px;
    padding: 0.55rem 0.95rem 0.55rem 0.7rem;
    background: var(--panel);
    color: var(--ink);
    font: 600 0.9rem var(--font);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.map-back[hidden] {
    display: none !important;
}

.map-back:hover {
    background: #fff;
}

.map-back:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.leaflet-container {
    width: 100%;
    height: 100%;
    background: var(--sea);
    font: inherit;
}

/* Tıklanınca SVG path bounding-box mavi karesini kapat */
.leaflet-container path,
.leaflet-container svg,
.leaflet-interactive,
.leaflet-interactive:focus,
.leaflet-interactive:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.leaflet-tooltip.district-label {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: var(--ink);
    font-family: var(--font);
    font-size: 12.5px;
    font-weight: 650;
    letter-spacing: -0.01em;
    padding: 0;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95),
        0 0 8px rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    pointer-events: none;
}

.leaflet-tooltip.district-label::before {
    display: none;
}

.leaflet-tooltip.district-label--merkez {
    font-weight: 800;
    font-size: 13.5px;
}

.leaflet-container path {
    -webkit-tap-highlight-color: transparent;
}

.leaflet-control-zoom {
    border: 0 !important;
    box-shadow: var(--shadow) !important;
    overflow: hidden;
    border-radius: 12px !important;
}

.leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    color: var(--ink) !important;
    background: var(--panel) !important;
    border-bottom: 1px solid rgba(26, 34, 44, 0.08) !important;
}

.leaflet-control-zoom a:hover {
    background: #fff !important;
}

.leaflet-tooltip.map-tip {
    background: var(--ink);
    color: #fff;
    border: 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 0.4rem 0.65rem;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
}

.leaflet-tooltip.map-tip::before {
    border-top-color: var(--ink);
}

.map-chrome {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.map-user {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    background: rgba(247, 244, 238, 0.92);
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    box-shadow: var(--shadow);
}

.map-login-btn {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    background: var(--ink);
    color: #fff;
    font: 650 0.88rem var(--font);
    box-shadow: var(--shadow);
}

.map-login-btn:hover {
    filter: brightness(1.08);
}

.district-modal {
    border: 0;
    padding: 0;
    border-radius: 20px;
    background: transparent;
    max-width: min(640px, calc(100vw - 1.5rem));
    width: 100%;
    max-height: calc(100vh - 2rem);
}

.district-modal::backdrop {
    background: rgba(20, 28, 36, 0.45);
    backdrop-filter: blur(4px);
}

.district-modal__inner {
    margin: 0;
    position: relative;
    background: var(--panel);
    color: var(--ink);
    border-radius: 20px;
    padding: 1.5rem 1.35rem 1.25rem;
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.85rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.district-modal__eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.district-modal__inner h2 {
    margin: 0;
    font-family: var(--display);
    font-weight: 750;
    font-size: clamp(1.55rem, 3vw, 1.9rem);
    letter-spacing: -0.03em;
    padding-right: 2rem;
}

.district-modal__close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(26, 34, 44, 0.06);
    color: var(--ink);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.field {
    display: grid;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
}

.field--full {
    grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
    border: 1px solid rgba(26, 34, 44, 0.12);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font: 500 0.92rem var(--font);
    width: 100%;
    resize: vertical;
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
    opacity: 0.7;
    background: #f0eee8;
}

.district-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.25rem;
}

.btn-primary,
.btn-secondary {
    border: 0;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font: 650 0.9rem var(--font);
    cursor: pointer;
}

.btn-primary {
    background: var(--ink);
    color: #fff;
}

.btn-secondary {
    background: rgba(26, 34, 44, 0.06);
    color: var(--ink);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.form-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.district-logs h3 {
    margin: 0.5rem 0 0.4rem;
    font-size: 0.9rem;
}

.district-logs ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.district-logs li {
    background: rgba(26, 34, 44, 0.04);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
    line-height: 1.4;
}

.auth-kicker {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
}

.auth-back {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 640px) {
    .field-grid {
        grid-template-columns: 1fr;
    }
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(26, 34, 44, 0.08);
    background: #fff;
}

.brand {
    font-family: var(--display);
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 1rem;
    color: var(--muted);
}

.main {
    min-height: calc(100vh - 65px);
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 65px);
    padding: 2rem 1rem;
    background: var(--sea);
    overflow: auto;
}

.auth-card {
    width: min(420px, 100%);
    background: var(--panel);
    border-radius: 16px;
    padding: 1.75rem;
    display: grid;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin: 0;
    font-family: var(--display);
    font-size: 2rem;
}

.auth-card .subtitle {
    margin: 0;
    color: var(--muted);
}

.auth-card label {
    display: grid;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.auth-card input {
    border: 1px solid rgba(26, 34, 44, 0.12);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    font: inherit;
}

.auth-card button {
    border: 0;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    padding: 0.8rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.form-error {
    margin: 0;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    background: rgba(180, 50, 50, 0.1);
    color: #8a1f1f;
    font-size: 0.9rem;
}

.crm-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.crm-tab {
    border: 0;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    background: rgba(26, 34, 44, 0.06);
    color: var(--muted);
    font: 650 0.82rem var(--font);
    cursor: pointer;
}

.crm-tab.is-active {
    background: var(--ink);
    color: #fff;
}

.crm-panel {
    display: none;
    gap: 0.85rem;
}

.crm-panel.is-active {
    display: grid;
}

.crm-subhead {
    margin: 0;
    font-size: 0.95rem;
}

.party-form,
.mini-form,
.party-card {
    background: rgba(26, 34, 44, 0.035);
    border-radius: 14px;
    padding: 0.85rem;
    display: grid;
    gap: 0.7rem;
}

.party-card__head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
}

.party-card h3,
.party-card h4 {
    margin: 0;
    font-size: 0.98rem;
}

.party-card h4 {
    margin-top: 0.35rem;
    font-size: 0.86rem;
    color: var(--muted);
}

.party-notes,
.muted {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.person-list,
.log-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.person-list li,
.log-list li {
    background: #fff;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    font-size: 0.84rem;
    line-height: 1.4;
}

.link-btn {
    border: 0;
    background: none;
    color: var(--focus);
    font: 600 0.8rem var(--font);
    cursor: pointer;
    padding: 0;
    margin-top: 0.25rem;
}

.link-btn.danger {
    color: #a33;
}

.btn-small {
    justify-self: start;
    padding: 0.55rem 0.85rem;
    font-size: 0.84rem;
}

@media (prefers-reduced-motion: reduce) {
    .district-modal,
    .district-modal::backdrop {
        transition: none;
    }
}
