:root {
    --ink: #151414;
    --cloud: #f8fafc;
    --sky: #54b9f5;
    --brand-green: #5a8c50;
    --leaf: #34b98e;
    --honey: #f5c044;
    --card-border: #e6eaf0;
    --input-border: #d9e2ec;
    --muted: #6d7784;
    --color-page: var(--cloud);
    --color-panel: #ffffff;
    --color-text: var(--ink);
    --color-muted: var(--muted);
    --color-border: var(--card-border);
    --color-primary: var(--brand-green);
    --color-primary-hover: #4d7845;
    --color-danger-bg: #fff0f0;
    --color-danger-text: #c73e52;
    --shadow-panel: 0 20px 48px rgba(21, 20, 20, 0.08);
    --app-background-logo: url("/static/img/baby-p-logo.png");
    --app-background-logo-opacity: 0.2;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Montserrat", Arial, Helvetica, sans-serif;
    color: var(--color-text);
    background: var(--color-page);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background-image: var(--app-background-logo);
    background-repeat: no-repeat;
    background-position: center;
    background-size: min(78vw, 760px);
    opacity: var(--app-background-logo-opacity);
}

body::after {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background: rgba(248, 250, 252, 0.72);
}

button,
input,
select,
textarea {
    font: inherit;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.app-page {
    padding: clamp(16px, 2.5vw, 32px);
}

.login-shell {
    width: min(100%, 420px);
}

.app-shell {
    width: min(100%, 1280px);
    margin: 0 auto;
}

.management-page .app-shell {
    width: min(100%, 1440px);
}

.management-page .app-panel {
    min-height: 0;
}

.login-panel {
    width: 100%;
    padding: 32px;
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-panel);
}

.app-panel {
    min-width: 0;
    min-height: 220px;
    padding: clamp(20px, 2.4vw, 32px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

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

.brand-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid var(--color-border);
}

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

h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.login-intro {
    margin: 0 0 28px;
    color: var(--color-muted);
    line-height: 1.5;
}

.login-form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field-help {
    margin: 0;
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.4;
}

label {
    font-size: 14px;
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="time"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--color-text);
    background: #ffffff;
    box-shadow: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="time"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    outline: 3px solid rgba(90, 140, 80, 0.18);
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #8a95a3;
}

.form-message {
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid rgba(199, 62, 82, 0.18);
    border-radius: 8px;
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    font-size: 14px;
}

button[type="submit"] {
    min-height: 46px;
    margin-top: 4px;
    border: 0;
    border-radius: 8px;
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

button[type="submit"]:hover {
    background: var(--color-primary-hover);
}

.primary-button {
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: var(--brand-green);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

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

.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(21, 20, 20, 0.36);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-panel {
    position: relative;
    width: min(100%, 760px);
    max-height: min(86vh, 820px);
    overflow: auto;
    padding: 28px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(21, 20, 20, 0.24);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.settings-form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.floating-actions {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 20;
    display: flex;
    gap: 10px;
}

.floating-actions form {
    margin: 0;
}

.floating-action {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--brand-green);
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(21, 20, 20, 0.18);
}

.floating-action svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
}

.settings-card {
    min-width: 0;
    padding: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.settings-card h2 {
    margin: 0;
    font-size: 20px;
}

.settings-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.settings-selector {
    align-self: start;
}

.settings-actions,
.settings-workspace {
    grid-column: 2;
}

.settings-workspace {
    min-height: 180px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.action-button,
.icon-button,
.text-button {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text);
    cursor: pointer;
}

.action-button {
    display: grid;
    min-height: 104px;
    padding: 18px;
    place-items: center;
    text-align: center;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.action-icon {
    display: grid;
    width: 64px;
    height: 64px;
    place-items: center;
    color: var(--ink);
}

.action-icon svg {
    width: 54px;
    height: 54px;
    fill: none;
    stroke: currentColor;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.action-button:hover,
.icon-button:hover,
.text-button:hover {
    border-color: var(--brand-green);
}

.action-button:hover {
    box-shadow: 0 12px 28px rgba(21, 20, 20, 0.08);
    transform: translateY(-1px);
}

.icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    font-size: 22px;
}

.icon-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.text-button {
    min-height: 36px;
    padding: 0 12px;
    font-weight: 700;
}

.management-hero {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.management-hero p {
    margin: 0;
}

.location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
    align-items: start;
}

.location-button {
    display: grid;
    justify-items: center;
    gap: 12px;
    min-height: 236px;
    padding: 20px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--color-text);
    text-align: center;
    text-decoration: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.location-button:hover,
.location-button:focus-visible {
    border-color: var(--brand-green);
    box-shadow: 0 16px 34px rgba(21, 20, 20, 0.1);
    transform: translateY(-2px);
}

.location-logo-ring {
    display: grid;
    width: 144px;
    height: 144px;
    place-items: center;
    overflow: hidden;
    border: 3px solid rgba(90, 140, 80, 0.34);
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(21, 20, 20, 0.08);
}

.location-logo-ring img {
    width: 108px;
    height: 108px;
    object-fit: contain;
}

.location-name {
    display: block;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
}

.location-meta {
    display: block;
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.4;
}

.location-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.location-stat {
    padding: 5px 9px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 700;
}

.empty-state {
    padding: 22px;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--color-muted);
}

.location-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 0;
}

.location-detail-main {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 18px;
}

.location-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.location-header-actions .location-menu-panel {
    right: 0;
    left: auto;
}

.location-detail-logo {
    display: grid;
    width: 92px;
    height: 92px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border: 2px solid rgba(90, 140, 80, 0.34);
    border-radius: 50%;
    background: #ffffff;
}

.location-detail-logo img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    gap: 16px;
}

.detail-grid-spaced {
    margin-top: 16px;
}

.management-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
}

.management-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--color-muted);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.management-tab:hover,
.management-tab:focus-visible,
.management-tab.is-active {
    border-color: rgba(90, 140, 80, 0.26);
    background: var(--brand-green);
    color: #ffffff;
}

.management-content-panel {
    margin-top: 16px;
}

.simulation-embed-panel {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #ffffff;
}

.simulation-embed {
    display: block;
    width: 100%;
    height: min(78vh, 920px);
    min-height: 620px;
    border: 0;
    background: #ffffff;
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.detail-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #ffffff;
}

.complaint-row {
    align-items: flex-start;
    flex-wrap: wrap;
}

.complaint-body {
    display: grid;
    min-width: 0;
    gap: 6px;
}

.complaint-message {
    margin: 0;
    color: var(--color-text);
    line-height: 1.5;
    white-space: pre-wrap;
}

.complaint-timer {
    width: fit-content;
    margin: 0;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(84, 185, 245, 0.12);
    color: #266b91;
    font-size: 12px;
    font-weight: 800;
}

.complaint-detail-line {
    margin: 0;
}

.complaint-reaction {
    margin: 2px 0 0;
    padding: 10px 12px;
    border-left: 3px solid var(--brand-green);
    border-radius: 0 8px 8px 0;
    background: rgba(90, 140, 80, 0.08);
    line-height: 1.5;
    white-space: pre-wrap;
}

.complaint-parent-approved {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    gap: 7px;
    margin: 2px 0 0;
    padding: 7px 10px;
    border: 1px solid rgba(52, 185, 142, 0.28);
    border-radius: 999px;
    background: rgba(52, 185, 142, 0.1);
    color: #247d62;
    font-size: 12px;
    font-weight: 800;
}

.complaint-parent-approved svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.complaint-parent-reactions {
    display: grid;
    gap: 6px;
    margin-top: 2px;
}

.complaint-parent-reaction {
    margin: 0;
    padding: 9px 11px;
    border-left: 3px solid var(--sky);
    border-radius: 0 8px 8px 0;
    background: rgba(84, 185, 245, 0.1);
    line-height: 1.45;
    white-space: pre-wrap;
}

.complaint-side {
    display: grid;
    justify-items: end;
    gap: 10px;
    margin-left: auto;
}

.complaint-status {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid rgba(90, 140, 80, 0.22);
    border-radius: 999px;
    background: rgba(90, 140, 80, 0.08);
    color: var(--brand-green);
    font-size: 12px;
    font-weight: 800;
}

.complaint-status.is-in_behandeling {
    border-color: rgba(245, 192, 68, 0.38);
    background: rgba(245, 192, 68, 0.14);
    color: #8a650e;
}

.complaint-status.is-afgehandeld {
    border-color: rgba(52, 185, 142, 0.28);
    background: rgba(52, 185, 142, 0.1);
    color: #247d62;
}

.complaint-status.is-parent-approved {
    border-color: rgba(52, 185, 142, 0.36);
    background: var(--brand-green);
    color: #ffffff;
}

.complaint-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.complaint-action {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text);
    cursor: pointer;
}

.complaint-action:hover,
.complaint-action:focus-visible {
    border-color: var(--brand-green);
    color: var(--brand-green);
    outline: none;
}

.complaint-action:disabled {
    cursor: wait;
    opacity: 0.55;
}

.complaint-action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.complaint-action-delete:hover,
.complaint-action-delete:focus-visible {
    border-color: rgba(199, 62, 82, 0.36);
    color: var(--color-danger-text);
}

.location-menu {
    position: relative;
}

.location-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 30;
    display: none;
    width: min(82vw, 320px);
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(21, 20, 20, 0.14);
}

.location-menu.is-open .location-menu-panel {
    display: grid;
    gap: 6px;
}

.location-menu-item,
.location-menu-add {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.location-menu-item:hover,
.location-menu-item:focus-visible,
.location-menu-add:hover,
.location-menu-add:focus-visible,
.location-menu-item.is-active {
    border-color: rgba(90, 140, 80, 0.24);
    background: rgba(90, 140, 80, 0.1);
}

.location-menu-add {
    margin-top: 6px;
    border-color: var(--color-border);
    color: var(--brand-green);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 0;
}

.toolbar-actions form {
    margin: 0;
}

.toolbar-action,
.toolbar-actions .toolbar-action {
    display: grid;
    width: 46px;
    height: 46px;
    min-height: 46px;
    margin-top: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--brand-green);
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 12px 28px rgba(21, 20, 20, 0.14);
}

.toolbar-action:hover,
.toolbar-action:focus-visible,
.toolbar-actions .toolbar-action:hover,
.toolbar-actions .toolbar-action:focus-visible {
    background: var(--color-primary-hover);
}

.toolbar-action svg,
.toolbar-actions .toolbar-action svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 760px) {
    .login-page,
    .app-page {
        padding: 16px;
    }

    .login-panel {
        padding: 24px;
    }

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

    .settings-actions {
        grid-column: auto;
    }

    .settings-selector {
        display: none;
    }

    .settings-selector.is-visible {
        display: block;
    }

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

    .modal-overlay {
        padding: 12px;
    }

    .modal-panel {
        padding: 22px;
    }

    .form-grid.two-columns {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .toolbar-actions {
        justify-content: flex-end;
        margin-left: 0;
    }

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

    .location-detail-header {
        align-items: flex-start;
    }

    .location-detail-main {
        width: 100%;
    }

    .location-header-actions {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }

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