/* =====================================================================
   LMRA – eigen stijl bovenop de huisstijl (app.css/lists.css/base.css uit DVFlow/DVPortaal).
   1. kleuren (blauw i.p.v. Emyris-rood; per klant overschreven via --brand op .mapp / .app)
   2. de mobiele app (.mapp): grote knoppen, Ja/Nee-vakjes groen/rood zoals het papieren formulier
   3. backoffice-aanvullingen (risico-cellen, vragenbeheer, dashboard)
   ===================================================================== */

:root {
    --brand: #1f4e8c;
    --brand-600: #193f72;
    --brand-900: #112b4d;
    --brand-50: #eaf1f9;
    --good: #1f9d55;
    --good-50: #e3f4ea;
    --bad: #d64545;
    --bad-50: #fbe5e5;
    --risk-laag: #1f9d55;
    --risk-gematigd: #e8772e;
    --risk-hoog: #d64545;
    --form-bg: #f7f3e6;
}

/* ---------- huisstijl naar blauw */
.navitem.active { background: rgba(255, 255, 255, .09); }
.navitem.active .icon { color: #9cc3ff; }
.navgroup__head--static { cursor: default; }
.navgroup__head--static:hover { background: none; }
.sidebar__footer--link { display: flex; align-items: center; gap: 8px; color: #a9b6be !important; font-size: 13px; text-decoration: none !important; }
.sidebar__footer--link:hover { color: #fff !important; }
.app--collapsed .sidebar__footer--link { display: flex; justify-content: center; }
.app--collapsed .sidebar__footer--link span { display: none; }
.auth__visual { background: linear-gradient(135deg, var(--brand) 0%, #0d2f5c 100%) !important; }
.auth__veil { background: linear-gradient(0deg, rgba(8, 25, 48, .55) 0%, transparent 45%) !important; }
.auth__eyebrow::before { background: linear-gradient(90deg, var(--good), var(--brand)) !important; }
.auth__title span { background: linear-gradient(90deg, var(--good), var(--brand)) !important; -webkit-background-clip: text !important; background-clip: text !important; color: transparent !important; }
.auth .field input:focus { box-shadow: 0 0 0 3px rgba(31, 78, 140, .18) !important; }
.auth__brand img { border-radius: 10px; }
.auth__info { padding: 10px 12px; border-radius: 8px; background: var(--brand-50); color: var(--brand-900); margin-bottom: 14px; }
.auth__alert { margin-bottom: 14px; }
.icon.rot180 { transform: rotate(180deg); }
.iconbtn--danger:hover { color: var(--bad); }

/* ================================================================= mobiele app */
.mapp {
    min-height: 100vh; min-height: 100dvh;
    background: var(--slate-50);
    font-size: 16px; /* 16px: iOS zoomt dan niet in bij invoervelden */
    padding-bottom: env(safe-area-inset-bottom);
}
.mmain { max-width: 720px; margin: 0 auto; padding: 14px 14px 40px; }

.mbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: var(--brand); color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.mbar--static { position: static; border-radius: 12px; margin-bottom: 12px; }
.mbar__brand { display: flex; align-items: center; gap: 10px; color: #fff !important; text-decoration: none !important; min-width: 0; flex: 1; }
.mbar__logo { display: grid; place-items: center; background: #fff; border-radius: 8px; padding: 3px 6px; height: 38px; flex: none; }
.mbar__logo img { max-height: 32px; max-width: 110px; display: block; }
.mbar__title { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.mbar__title strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbar__title small { font-size: 12px; opacity: .8; }

.mmenu { position: relative; }
.mmenu > summary { list-style: none; cursor: pointer; }
.mmenu > summary::-webkit-details-marker { display: none; }
.mmenu__btn .avatar { width: 38px; height: 38px; background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .35); }
.mmenu__panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
    min-width: 260px; padding: 6px;
    background: var(--white); color: var(--text);
    border: 1px solid var(--slate-200); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.mmenu__who { display: flex; flex-direction: column; padding: 10px 12px 12px; border-bottom: 1px solid var(--slate-100); margin-bottom: 4px; }
.mmenu__who small { color: var(--text-muted); font-size: 13px; }
.mmenu__item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 12px; border: 0; border-radius: 8px; background: none;
    color: var(--text) !important; font: inherit; font-size: 15px; text-align: left; text-decoration: none !important; cursor: pointer;
}
.mmenu__item:hover { background: var(--slate-50); }
.mmenu__item--danger { color: var(--bad) !important; }

.mtitle { font-size: 22px; font-weight: 700; margin: 4px 0 6px; letter-spacing: -.01em; }
.mtitle--form { margin-top: 6px; }
.msec { font-size: 15px; font-weight: 600; margin: 22px 2px 10px; color: var(--slate-700); text-transform: uppercase; letter-spacing: .04em; }
.msec .req, .mfield em, .q__measure em, .permit-star { color: var(--bad); font-style: normal; }
.mintro { margin: 0 0 12px; }
.mnote { font-size: 13px; margin: 8px 2px; }

.mcard {
    background: var(--white); border: 1px solid var(--slate-200); border-radius: 14px;
    padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.mcard--center { text-align: center; margin-top: 30px; }
.mcard__title { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.mempty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); text-align: center; padding: 26px 14px; }

.mhero { padding: 6px 2px 4px; }
.mhero .mtitle { font-size: 24px; }
.mhero .muted { margin: 0 0 14px; }

/* knoppen */
.mbtn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 10px 18px;
    border: 1px solid transparent; border-radius: 12px;
    font: inherit; font-size: 16px; font-weight: 600; line-height: 1.2;
    text-decoration: none !important; cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: transform .06s ease, filter .15s ease;
}
.mbtn:active { transform: scale(.98); }
.mbtn[disabled], .mbtn[aria-busy="true"] { opacity: .65; pointer-events: none; }
.mbtn--primary { background: var(--brand); color: #fff !important; box-shadow: 0 6px 16px -6px rgba(31, 78, 140, .6); }
.mbtn--primary:hover { filter: brightness(1.06); }
.mbtn--ghost { background: var(--white); color: var(--brand) !important; border-color: var(--slate-200); }
.mbtn--link { background: none; color: var(--brand) !important; min-height: 40px; font-weight: 500; }
.mbtn--wa { background: #25d366; color: #073b1c !important; }
.mbtn--xl { min-height: 60px; font-size: 18px; border-radius: 14px; }
.mbtn--block { display: flex; width: 100%; }

/* invoer */
.mfield { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.mfield > span { font-size: 14px; font-weight: 600; color: var(--slate-700); }
.minput {
    width: 100%; min-height: 48px; padding: 11px 12px;
    border: 1px solid var(--slate-300); border-radius: 10px; background: var(--white); color: var(--text);
    font: inherit; font-size: 16px;
}
textarea.minput { min-height: 70px; resize: vertical; }
.minput:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 78, 140, .16); }
.minput--code { font-size: 26px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.mgrid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 420px) { .mgrid2 { grid-template-columns: 1fr; } }
.mfield.has-error .minput { border-color: var(--bad); background: #fff8f8; }
.mfield__error { display: block; color: var(--bad); font-size: 13px; font-weight: 500; margin-top: 4px; }
.mwho { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 14px; }
.mcheck { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; font-size: 15px; }
.mcheck input { width: 22px; height: 22px; accent-color: var(--brand); }
[data-permit-field] .permit-star { display: none; }
[data-permit-field].is-required .permit-star { display: inline; }

/* meldingen */
.malert { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 15px; }
.malert--success { background: var(--good-50); color: #135c34; border: 1px solid #bfe3cd; }
.malert--error { background: var(--bad-50); color: #8f2323; border: 1px solid #f2c4c4; }
.malert--info { background: var(--brand-50); color: var(--brand-900); border: 1px solid #c9daef; justify-content: space-between; }

/* ---------- vragen: Ja/Nee zoals op het formulier (groen = goed, rood = afwijking) */
.qlist { display: flex; flex-direction: column; gap: 10px; }
.q {
    background: var(--form-bg); border: 1px solid #e6dfc6; border-radius: 14px;
    padding: 12px; scroll-margin-top: 80px;
}
.q.has-error { border-color: var(--bad); box-shadow: 0 0 0 2px rgba(214, 69, 69, .15); }
.q__text { display: flex; gap: 10px; font-size: 16px; font-weight: 500; line-height: 1.35; margin-bottom: 10px; }
.q__nr {
    flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-top: -1px;
    border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
}
.q__opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 54px; border-radius: 12px; border: 2px solid; font-size: 18px; font-weight: 700;
    transition: background .12s ease, color .12s ease;
}
.opt--good span { border-color: var(--good); color: var(--good); background: var(--good-50); }
.opt--bad span { border-color: var(--bad); color: var(--bad); background: var(--bad-50); }
.opt input:checked + span { color: #fff; }
.opt--good input:checked + span { background: var(--good); }
.opt--bad input:checked + span { background: var(--bad); }
.opt input:checked + span::before { content: "✓"; font-size: 18px; }
.opt input:focus-visible + span { outline: 3px solid rgba(31, 78, 140, .45); outline-offset: 2px; }
.q__measure { display: none; flex-direction: column; gap: 6px; margin-top: 10px; }
.q__measure > span { font-size: 14px; font-weight: 600; color: #8f2323; }
.q.is-dev .q__measure, .q:has(input[data-dev="1"]:checked) .q__measure { display: flex; }
.q.is-dev, .q:has(input[data-dev="1"]:checked) { border-color: #efb4b4; background: #fff4f2; }

/* ---------- risico */
.risks { display: grid; grid-template-columns: 1fr; gap: 10px; }
.risks.has-error { outline: 2px solid var(--bad); outline-offset: 4px; border-radius: 14px; }
.risk { position: relative; display: block; cursor: pointer; }
.risk input { position: absolute; opacity: 0; pointer-events: none; }
.risk span {
    display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px;
    border-radius: 12px; border: 2px solid var(--rc); background: var(--white); color: var(--rc);
    font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
}
.risk input:checked + span { background: var(--rc); color: #fff; box-shadow: 0 8px 18px -8px var(--rc); }
.risk input:checked + span::before { content: "✓"; }
.risk input:focus-visible + span { outline: 3px solid rgba(31, 78, 140, .45); outline-offset: 2px; }
.risk--laag { --rc: var(--risk-laag); }
.risk--gematigd { --rc: var(--risk-gematigd); }
.risk--hoog { --rc: var(--risk-hoog); }
@media (min-width: 560px) { .risks { grid-template-columns: repeat(3, 1fr); } }

.msubmit { margin-top: 18px; }

/* ---------- lijst (historie) */
.mlist { display: flex; flex-direction: column; gap: 8px; }
.mitem {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    background: var(--white); border: 1px solid var(--slate-200); border-radius: 14px;
    color: var(--text) !important; text-decoration: none !important; box-shadow: var(--shadow-sm);
}
.mitem:active { background: var(--slate-50); }
.mitem__date {
    flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 48px; height: 52px; border-radius: 10px; background: var(--brand-50); color: var(--brand);
    line-height: 1.05;
}
.mitem__date strong { font-size: 20px; }
.mitem__date small { font-size: 12px; text-transform: uppercase; }
.mitem__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mitem__main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mitem__main small { color: var(--text-muted); font-size: 13px; }
.mitem__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.devcount { color: var(--bad); font-weight: 600; font-size: 12px; }
.unsent { color: var(--warning); font-size: 12px; }

/* risico-pil */
.rpill {
    display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 700; color: #fff; background: var(--rc, var(--slate-500)); white-space: nowrap;
}
.rpill--lg { font-size: 14px; padding: 6px 12px; }
.rpill.risk--laag { --rc: var(--risk-laag); }
.rpill.risk--gematigd { --rc: var(--risk-gematigd); }
.rpill.risk--hoog { --rc: var(--risk-hoog); }

/* ---------- weergave van één LMRA */
.lsum__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lsum__head .mtitle { margin: 0 0 6px; }
.lsum__kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; margin: 8px 0 12px; font-size: 15px; }
.lsum__kv dt { color: var(--text-muted); }
.lsum__kv dd { margin: 0; }
.share__btns { display: grid; gap: 10px; }
.share__hint { margin-bottom: 4px; }
.mailform { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--slate-100); }
.mailform__title { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 10px; }
.alist { display: flex; flex-direction: column; }
.aitem { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 9px 0; border-top: 1px solid var(--slate-100); align-items: center; }
.aitem:first-child { border-top: 0; }
.aitem__q { font-size: 15px; }
.aitem__m { grid-column: 1 / -1; font-size: 14px; color: #8f2323; background: #fff4f2; border-radius: 8px; padding: 6px 9px; }
.aitem.is-dev .aitem__q { font-weight: 600; }
.achip { min-width: 46px; text-align: center; padding: 4px 8px; border-radius: 8px; font-weight: 700; font-size: 13px; color: #fff; }
.achip--good { background: var(--good); }
.achip--bad { background: var(--bad); }
.lremarks { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--slate-100); }
.lremarks p { margin: 4px 0 0; white-space: pre-wrap; }
.slog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.slog li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.slog li span { color: var(--text-muted); }
.slog li.is-failed strong, .slog li small { color: var(--bad); }
.mactions { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

/* ---------- openbare pagina / fouten */
.mapp--public .mmain { padding-top: 18px; }
.pub-card { max-width: 520px; margin: 40px auto; background: var(--white); border: 1px solid var(--slate-200); border-radius: 14px; padding: 22px; text-align: center; }

/* ---------- klant kiezen */
.tenantpick { display: flex; flex-direction: column; gap: 10px; }
.tenantpick form { margin: 0; }
.tenantpick__item {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px;
    background: var(--white); border: 1px solid var(--slate-200); border-radius: 12px; cursor: pointer;
    font: inherit; font-size: 16px; text-align: left; color: var(--text);
}
.tenantpick__item:hover { border-color: var(--brand); }
.tenantpick__item.is-current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-50); }
.tenantpick__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); flex: none; }
.tenantpick__name { flex: 1; font-weight: 600; }
.tenantpick__item small { color: var(--text-muted); }

/* ================================================================= backoffice */
.cell-risk { font-weight: 700; }
.cell-risk--hoog { color: var(--risk-hoog) !important; }
.cell-risk--gematigd { color: var(--risk-gematigd) !important; }
.cell-risk--laag { color: var(--risk-laag) !important; }
.cell-bold { font-weight: 700; }

.dlist { display: flex; flex-direction: column; }
.dlist__row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-top: 1px solid var(--slate-100); color: var(--text) !important; text-decoration: none !important; }
.dlist__row:first-child { border-top: 0; }
.dlist__row:hover { background: var(--slate-50); }
.dlist__date { flex: none; width: 120px; color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.dlist__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dlist__main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlist__main small { color: var(--text-muted); }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bars__row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 32px; gap: 10px; align-items: center; font-size: 13px; }
.bars__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars__track { height: 8px; border-radius: 4px; background: var(--slate-100); overflow: hidden; }
.bars__fill { display: block; height: 100%; background: var(--bad); border-radius: 4px; }
.bars__val { text-align: right; font-weight: 700; color: var(--bad); }

.atable { width: 100%; border-collapse: collapse; font-size: 14px; }
.atable th { text-align: left; font-weight: 600; color: #fff; background: var(--brand); padding: 8px 10px; }
.atable td { padding: 8px 10px; border-top: 1px solid #e6dfc6; background: var(--form-bg); vertical-align: middle; }
.atable tr.is-dev td:first-child { font-weight: 600; }
.atable .c { text-align: center; width: 64px; }
.abox { display: inline-grid; place-items: center; width: 30px; height: 26px; border-radius: 6px; font-weight: 800; color: #fff; border: 2px solid; }
.abox--good { border-color: var(--good); background: var(--good-50); }
.abox--bad { border-color: var(--bad); background: var(--bad-50); }
.abox--good.is-chosen { background: var(--good); }
.abox--bad.is-chosen { background: var(--bad); }

.qinfo { margin-top: 0; }
.qinfo .good { color: var(--good); }
.qinfo .bad { color: var(--bad); }
.alert--info { background: var(--brand-50); color: var(--brand-900); border: 1px solid #c9daef; }
.qadmin { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius); overflow: hidden; }
.qadmin__head, .qadmin__row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 60px 60px 130px 150px; gap: 8px; align-items: center; padding: 8px 12px; }
.qadmin__head { background: var(--slate-50); font-weight: 600; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.qadmin__row { border-top: 1px solid var(--slate-100); }
.qadmin__row:hover { background: var(--slate-50); }
.qadmin__row.is-inactive { opacity: .55; }
.qadmin__nr { font-weight: 700; color: var(--brand); text-align: center; }
.qadmin__text small { margin-left: 6px; }
.qadmin__actions { display: flex; justify-content: flex-end; gap: 2px; }
.qadmin .c { text-align: center; }
@media (max-width: 760px) {
    .qadmin__head { display: none; }
    .qadmin__row { grid-template-columns: 30px minmax(0, 1fr) 40px 40px; }
    .qadmin__row > :nth-child(5) { display: none; }
    .qadmin__actions { grid-column: 1 / -1; }
}

.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.colorpick { width: 64px; height: 36px; padding: 2px; border: 1px solid var(--slate-300); border-radius: 8px; background: var(--white); cursor: pointer; }
.logoedit { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logoedit img { max-height: 48px; max-width: 180px; border: 1px solid var(--slate-200); border-radius: 6px; padding: 4px; background: #fff; }
.nselect { min-height: 34px; padding: 6px 8px; border: 1px solid var(--slate-300); border-radius: 6px; font: inherit; background: var(--white); }
.tdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.lremarks p { white-space: pre-wrap; }
