:root {
    --green: #1f6f43;
    --green-dark: #155233;
    --green-light: #e8f3ed;

    --background: #f4f6f5;
    --card: #ffffff;

    --text: #17211c;
    --muted: #66736c;

    --border: #dce3df;

    --danger: #b42318;
    --danger-light: #feeceb;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;

    background: var(--background);

    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    background: rgba(255, 255, 255, 0.95);

    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(14px);
}

.header-inner {
    max-width: 1100px;

    margin: 0 auto;

    padding: 12px 16px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    text-decoration: none;

    font-size: 20px;
    font-weight: 700;
}

.header-add-button {
    width: 42px;
    height: 42px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--green);

    color: white;

    text-decoration: none;

    font-size: 28px;
    line-height: 1;
}

main {
    width: 100%;
}

.map-page,
.form-page,
.details-page {
    max-width: 1100px;

    margin: 0 auto;

    padding: 20px 16px 50px;
}

.map-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;

    margin-bottom: 16px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;

    font-size: 28px;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 17px;
}

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

.main-map {
    width: 100%;
    height: 56vh;
    min-height: 420px;

    border-radius: 20px;

    overflow: hidden;

    border: 1px solid var(--border);
}

.position-map {
    width: 100%;
    height: 340px;

    border-radius: 16px;

    overflow: hidden;

    border: 1px solid var(--border);
}

.detail-map {
    width: 100%;
    height: 320px;

    margin-bottom: 20px;

    border-radius: 20px;

    overflow: hidden;

    border: 1px solid var(--border);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 46px;

    padding: 10px 18px;

    border: none;
    border-radius: 12px;

    text-decoration: none;

    font-size: 16px;
    font-weight: 600;

    cursor: pointer;
}

.button-primary {
    background: var(--green);
    color: white;
}

.button-primary:hover {
    background: var(--green-dark);
}

.button-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.button-full {
    width: 100%;

    margin-top: 8px;
}

.list-section {
    margin-top: 26px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 14px;
}

.section-heading h2 {
    margin: 0;
}

.counter {
    padding: 4px 9px;

    border-radius: 999px;

    background: var(--green-light);
    color: var(--green-dark);

    font-size: 13px;
    font-weight: 600;
}

.schrank-list {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(260px, 1fr));

    gap: 12px;
}

.schrank-card {
    display: block;

    padding: 16px;

    background: var(--card);

    border: 1px solid var(--border);
    border-radius: 16px;

    text-decoration: none;
}

.schrank-card:hover {
    border-color: #b9c9bf;
}

.schrank-card-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.schrank-card h3 {
    margin-bottom: 5px;
}

.favorite {
    font-size: 22px;
}

.favorite-large {
    font-size: 34px;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;

    margin-top: 12px;
}

.badge {
    display: inline-flex;

    padding: 6px 9px;

    border-radius: 999px;

    background: var(--green-light);

    color: var(--green-dark);

    font-size: 13px;
    font-weight: 600;
}

.empty-state {
    padding: 40px 20px;

    text-align: center;

    background: var(--card);

    border: 1px solid var(--border);
    border-radius: 18px;
}

.empty-icon {
    margin-bottom: 10px;

    font-size: 42px;
}

.page-heading {
    margin-bottom: 18px;
}

.back-link {
    display: inline-block;

    margin-bottom: 14px;

    color: var(--green-dark);

    text-decoration: none;

    font-weight: 600;
}

.form-card {
    padding: 20px;

    background: var(--card);

    border: 1px solid var(--border);
    border-radius: 20px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;

    margin-bottom: 7px;

    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;

    padding: 12px 13px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: white;

    color: var(--text);

    font: inherit;

    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--green);
}

textarea {
    resize: vertical;
}

.coordinate-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.help-text {
    margin-top: 7px;

    color: var(--muted);

    font-size: 13px;
}

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

    margin-bottom: 18px;
}

.check-card {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 12px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: #fafcfb;
}

.check-card input {
    width: auto;

    margin: 0;

    transform: scale(1.2);
}

.details-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 16px;
}

.details-badges {
    margin-bottom: 20px;
}

.details-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(250px, 1fr));

    gap: 12px;
}

.detail-box {
    padding: 18px;

    background: var(--card);

    border: 1px solid var(--border);
    border-radius: 16px;
}

.detail-box h2 {
    margin-bottom: 8px;
}

.detail-box p {
    margin-bottom: 0;
}

.detail-notes {
    grid-column: 1 / -1;
}

.preserve-lines {
    white-space: pre-wrap;
}

.action-row {
    display: flex;
    gap: 10px;

    margin-top: 20px;
}

.flash-container {
    max-width: 1100px;

    margin: 14px auto 0;

    padding: 0 16px;
}

.flash {
    padding: 12px 14px;

    border-radius: 12px;

    font-weight: 600;
}

.flash-success {
    background: var(--green-light);
    color: var(--green-dark);
}

.flash-error {
    background: var(--danger-light);
    color: var(--danger);
}

.map-popup a {
    display: inline-block;

    margin-top: 7px;

    color: var(--green-dark);

    font-weight: 700;
}


@media (max-width: 700px) {

    .map-page,
    .form-page,
    .details-page {
        padding:
            15px
            12px
            35px;
    }

    .map-toolbar {
        flex-direction: column;
    }

    .map-toolbar .button {
        width: 100%;
    }

    .main-map {
        height: 55vh;
        min-height: 390px;

        border-radius: 15px;
    }

    .position-map {
        height: 300px;
    }

    .coordinate-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .check-grid {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 15px;
    }

    .action-row {
        flex-direction: column;
    }

    .action-row .button,
    .action-row form,
    .action-row form button {
        width: 100%;
    }

}
