/* Postvak – kleuren uit de Obsidian-vault (ITS Theme, accent #F26419, links #00A383). */

:root {
  --bg-outer: #0b0f13;
  --bg-sidebar: #0d1014;
  --bg-surface: #1a1e24;
  --bg-raised: #252c36;
  --bg-hover: #232a34;
  --bg-unread: #20262e;
  --border: #2f3b4d;
  --border-soft: #242c38;
  --text: #cfd7dd;
  --text-strong: #eef2f5;
  --text-muted: #97a1b9;
  --text-faint: #6f7b92;
  --accent: #f26419;
  --accent-hover: #ff6400;
  --accent-soft: rgba(242, 100, 25, .16);
  --on-accent: #fff;
  --link: #00a383;
  --star: #f6ae2d;
  --danger: #ff5a4f;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --radius: 14px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "New York", ui-serif, "Iowan Old Style", Palatino, Georgia, serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-outer: #efe9df;
    --bg-sidebar: #efe9df;
    --bg-surface: #ffffff;
    --bg-raised: #f7f3ec;
    --bg-hover: #f4efe6;
    --bg-unread: #ffffff;
    --border: #e6dccb;
    --border-soft: #efe7d9;
    --text: #303437;
    --text-strong: #000000;
    --text-muted: #636363;
    --text-faint: #8c8c8c;
    --accent-soft: rgba(242, 100, 25, .14);
    --link: #00806a;
    --star: #e79a0e;
    --danger: #c62828;
    --shadow: 0 10px 30px rgba(60, 40, 10, .18);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg-outer: #efe9df;
  --bg-sidebar: #efe9df;
  --bg-surface: #ffffff;
  --bg-raised: #f7f3ec;
  --bg-hover: #f4efe6;
  --bg-unread: #ffffff;
  --border: #e6dccb;
  --border-soft: #efe7d9;
  --text: #303437;
  --text-strong: #000000;
  --text-muted: #636363;
  --text-faint: #8c8c8c;
  --accent-soft: rgba(242, 100, 25, .14);
  --link: #00806a;
  --star: #e79a0e;
  --danger: #c62828;
  --shadow: 0 10px 30px rgba(60, 40, 10, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-outer);
  color: var(--text);
  font: 14px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.fill { fill: currentColor; }

/* ---------- indeling ---------- */

.app {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top" "side main";
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.app.sidebar-closed { grid-template-columns: 0 minmax(0, 1fr); }
.app.sidebar-closed .sidebar { visibility: hidden; }

.topbar { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; width: 200px; flex: none; font: 600 21px/1 var(--font-serif); color: var(--text-strong); letter-spacing: .2px; text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }

.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text-muted); flex: none; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-strong); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }

.search { flex: 1; max-width: 720px; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 6px 0 14px; background: var(--bg-raised); border: 1px solid transparent; border-radius: 24px; color: var(--text-muted); }
.search:focus-within { background: var(--bg-surface); border-color: var(--accent); }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--text-strong); font-size: 15px; }
.search input::placeholder { color: var(--text-faint); }
.search input::-webkit-search-cancel-button { display: none; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.me { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 600; margin-left: 6px; }

/* ---------- zijbalk ---------- */

.sidebar { grid-area: side; overflow-y: auto; padding: 6px 10px 24px 10px; background: var(--bg-sidebar); }
.nav-item { display: flex; align-items: center; gap: 14px; height: 36px; padding: 0 12px 0 16px; border-radius: 18px; color: var(--text); text-decoration: none; position: relative; }
.nav-item a { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; height: 100%; color: inherit; text-decoration: none; }
.nav-item:hover { background: var(--bg-hover); }
.avatar .tick { display: none; }
.avatar .tick .icon { width: 18px; height: 18px; stroke-width: 3; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .nav-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .nav-count { font-size: 12px; font-weight: 600; }
.nav-item .dot { width: 12px; height: 12px; border-radius: 4px; margin: 0 4px; flex: none; }
.nav-item .nav-more { width: 28px; height: 28px; margin-right: -6px; border-radius: 50%; display: none; place-items: center; color: var(--text-muted); }
.nav-item:hover .nav-more, .nav-item .nav-more:focus-visible { display: grid; }
.nav-item .nav-more:hover { background: var(--border); color: var(--text-strong); }
.nav-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 4px; padding: 0 6px 0 16px; font: 600 13px/1 var(--font-serif); letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); }
.nav-empty { padding: 6px 16px; color: var(--text-faint); font-size: 13px; }
.scrim { display: none; }

/* ---------- hoofdvlak ---------- */

.main { grid-area: main; display: flex; flex-direction: column; min-height: 0; margin: 0 14px 14px 0; background: var(--bg-surface); border-radius: var(--radius); overflow: hidden; outline: 0; }
.toolbar { display: flex; align-items: center; gap: 2px; min-height: 48px; padding: 4px 10px; border-bottom: 1px solid var(--border-soft); flex: none; }
.toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 8px; }
.toolbar .grow { flex: 1; }
.toolbar .range { color: var(--text-muted); font-size: 13px; margin: 0 6px; white-space: nowrap; }
.toolbar .title { font: 600 15px/1 var(--font-serif); color: var(--text-strong); margin: 0 10px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check { width: 40px; height: 40px; display: inline-grid; place-items: center; flex: none; border-radius: 50%; }
.check:hover { background: var(--bg-hover); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; cursor: pointer; }

.progress { height: 2px; background: transparent; flex: none; overflow: hidden; }
.progress.on::after { content: ""; display: block; height: 100%; width: 40%; background: var(--accent); animation: slide 1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }

/* ---------- gesprekkenlijst ---------- */

.row { position: relative; display: flex; align-items: center; height: 42px; padding: 0 12px 0 6px; border-bottom: 1px solid var(--border-soft); color: var(--text-muted); }
.row.unread { background: var(--bg-unread); color: var(--text-strong); }
.row.unread .people, .row.unread .subject, .row.unread time { font-weight: 700; }
.row:hover { background: var(--bg-hover); box-shadow: inset 3px 0 0 var(--accent); z-index: 1; }
.row.selected { background: var(--accent-soft); }
.row.focus { box-shadow: inset 3px 0 0 var(--accent); }
.row .avatar-btn { display: none; }
.row-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 100%; color: inherit; text-decoration: none; padding-left: 6px; }
.people { width: 190px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .n { color: var(--text-faint); font-weight: 400; font-size: 12px; margin-left: 4px; }
.people .draft { color: var(--danger); }
.content { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.subject { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 40px; }
.snippet { overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; color: var(--text-faint); font-weight: 400; }
.meta { display: flex; align-items: center; gap: 8px; flex: none; font-size: 12px; color: var(--text-muted); min-width: 64px; justify-content: flex-end; }
.meta .icon { width: 16px; height: 16px; }
.row-actions { display: none; position: absolute; right: 8px; top: 0; bottom: 0; align-items: center; padding-left: 28px; background: linear-gradient(90deg, transparent, var(--bg-hover) 26px); }
.row-actions .icon-btn { width: 34px; height: 34px; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; line-height: 1; white-space: nowrap; flex: none; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.chip.plain { background: var(--bg-raised); color: var(--text-muted); border: 1px solid var(--border); }
.chip button { margin-right: -4px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; color: inherit; opacity: .75; }
.chip button:hover { opacity: 1; background: rgba(0, 0, 0, .2); }
.chip button .icon { width: 11px; height: 11px; stroke-width: 3; }

.empty { display: grid; place-items: center; text-align: center; padding: 64px 24px; color: var(--text-muted); }
.empty h2 { font: 600 19px/1.3 var(--font-serif); color: var(--text); margin: 0 0 6px; }
.empty p { margin: 0; max-width: 420px; }

@media (hover: hover) {
  .row:hover .row-actions { display: flex; }
  .row:hover .meta { visibility: hidden; }
}

/* ---------- gesprek lezen ---------- */

.reader { padding: 6px 28px 40px 28px; max-width: 1040px; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 16px 0 14px 52px; }
.thread-head h1 { font: 500 23px/1.25 var(--font-serif); color: var(--text-strong); margin: 0; overflow-wrap: anywhere; }
.thread-head .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.thread-head .chip { height: 22px; font-size: 12px; }

.msg { border-top: 1px solid var(--border-soft); }
.msg:first-child { border-top: 0; }
.msg-head { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 16px; flex: none; }
.msg-who { flex: 1; min-width: 0; }
.msg-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.msg-name { font-weight: 700; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-email { color: var(--text-faint); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-sub { color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-date { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; flex: none; }
.msg.unread-mark .msg-name::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 8px; }
.msg-body { padding: 0 0 22px 52px; }
.msg-body .plain { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.55; color: var(--text); }
.msg-body .plain .q { color: var(--text-faint); }
.mail-frame { display: block; width: 100%; height: 120px; border: 0; border-radius: 10px; background: #fff; }
.notice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 8px 12px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; color: var(--text-muted); }
.notice .icon { width: 17px; height: 17px; }
.link-btn { color: var(--link); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.att { display: flex; align-items: center; gap: 10px; width: 230px; max-width: 100%; padding: 9px 12px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; }
.att:hover { border-color: var(--accent); }
.att .ext { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .3px; background: var(--accent); color: var(--on-accent); flex: none; }
.att .att-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att .att-size { font-size: 12px; color: var(--text-muted); }
.att > span:nth-child(2) { min-width: 0; flex: 1; }
.loading { padding: 40px; text-align: center; color: var(--text-muted); }

/* ---------- lagen: menu, venster, melding ---------- */

.pop { position: fixed; z-index: 50; min-width: 250px; max-width: 320px; max-height: min(70vh, 480px); display: flex; flex-direction: column; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.pop h3 { margin: 0; padding: 12px 14px 8px; font: 600 14px/1 var(--font-serif); color: var(--text-strong); }
.pop-search { margin: 0 10px 6px; height: 34px; padding: 0 10px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; outline: 0; }
.pop-search:focus { border-color: var(--accent); }
.pop-list { overflow-y: auto; padding: 2px 6px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 8px; border-radius: 8px; text-align: left; color: var(--text); }
.pop-item:hover { background: var(--bg-hover); }
.pop-item input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.pop-item .dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.pop-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item.danger { color: var(--danger); }
.pop-foot { display: flex; gap: 8px; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--border); }

.btn { height: 36px; padding: 0 16px; border-radius: 18px; font-weight: 600; color: var(--text); }
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .55); }
.modal { width: min(440px, 100%); background: var(--bg-raised); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; }
.modal h2 { margin: 0 0 14px; font: 600 19px/1.2 var(--font-serif); color: var(--text-strong); }
.modal p { margin: 0 0 16px; color: var(--text-muted); }
.field { display: block; margin-bottom: 16px; font-size: 13px; color: var(--text-muted); }
.field input[type="text"] { display: block; width: 100%; height: 40px; margin-top: 6px; padding: 0 12px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 9px; outline: 0; color: var(--text-strong); font-size: 15px; }
.field input[type="text"]:focus { border-color: var(--accent); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin: 8px 0 20px; }
.swatch { position: relative; aspect-ratio: 1; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch .icon { display: none; width: 16px; height: 16px; stroke-width: 3; }
.swatch:has(input:checked) { outline: 2px solid var(--text-strong); outline-offset: 2px; }
.swatch:has(input:checked) .icon { display: block; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-actions .left { margin-right: auto; }
.form-error { color: var(--danger); font-size: 13px; margin: -8px 0 14px; }

.toasts { position: fixed; z-index: 70; left: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; min-height: 44px; padding: 8px 10px 8px 16px; background: #303437; color: #eef2f5; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: rise .18s ease-out; }
.toast.error { background: #7a1f1a; }
.toast button { color: #ffa100; font-weight: 700; padding: 6px 8px; border-radius: 6px; }
.toast button:hover { background: rgba(255, 255, 255, .08); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* ---------- tablet: zijbalk als uitschuifmenu ---------- */

@media (max-width: 1000px) {
  .app, .app.sidebar-closed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .sidebar, .app.sidebar-closed .sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: 280px; padding-top: calc(16px + env(safe-area-inset-top)); visibility: visible; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .app.drawer-open .sidebar { transform: none; }
  .app.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .5); }
  .main { margin: 0 10px 10px 10px; }
  .brand { width: auto; }
  .brand span { display: none; }
  .people { width: 150px; }
}

/* ---------- telefoon ---------- */

@media (max-width: 640px) {
  .topbar { padding: 6px 8px; min-height: 54px; gap: 4px; }
  .brand { display: none; }
  .search { height: 42px; }
  .main { margin: 0; border-radius: 0; }
  .toolbar { padding: 2px 4px; }
  .toolbar .check { display: none; }
  .toolbar.has-selection .check { display: inline-grid; }

  .row { height: auto; align-items: flex-start; padding: 10px 12px 10px 10px; gap: 10px; }
  .row .check { display: none; }
  .row .avatar-btn { display: grid; flex: none; margin-top: 2px; border-radius: 50%; }
  .row .avatar-btn .tick { display: none; }
  .row.selected .avatar-btn .avatar { background: var(--accent) !important; color: var(--on-accent) !important; }
  .row.selected .avatar-btn .letter { display: none; }
  .row.selected .avatar-btn .tick { display: grid; }
  .row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "people meta" "content content"; gap: 2px 8px; padding-left: 0; align-items: baseline; }
  .people { grid-area: people; width: auto; font-size: 15px; }
  .meta { grid-area: meta; min-width: 0; }
  .content { grid-area: content; display: block; white-space: normal; }
  .content .chips { display: inline; }
  .content .chip { vertical-align: 1px; margin-right: 5px; }
  .subject { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .snippet { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .snippet .dash { display: none; }
  .row:hover { box-shadow: none; }

  .reader { padding: 0 14px 32px; }
  .thread-head { padding: 14px 0 10px; }
  .thread-head h1 { font-size: 20px; }
  .msg-body { padding-left: 0; }
  .msg-email { display: none; }
  .pop { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); max-width: none; max-height: 70vh; }
  .toasts { left: 10px; right: 10px; }
  .att { width: 100%; }
}

/* ---------- opstellen ---------- */

.compose-btn { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 24px 0 18px; margin: 2px 0 14px 2px; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 15px; }
.compose-btn:hover { background: var(--accent-hover); }
.fab { display: none; position: fixed; z-index: 30; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); place-items: center; }
.fab .icon { width: 24px; height: 24px; }

.compose { position: fixed; z-index: 45; right: 24px; bottom: 0; width: min(600px, calc(100vw - 48px)); height: min(680px, calc(100dvh - 76px)); display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 14px 14px 0 0; box-shadow: var(--shadow); }
.compose-head { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 4px 0 16px; background: var(--bg-raised); border-radius: 13px 13px 0 0; flex: none; }
.compose-title { font: 600 14px/1 var(--font-serif); color: var(--text-strong); }
.compose-status { flex: 1; font-size: 12px; color: var(--text-faint); }
.compose-fields { flex: none; padding: 0 16px; }
.rcpt-row { position: relative; display: flex; align-items: flex-start; gap: 8px; min-height: 40px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.rcpt-label { width: 30px; flex: none; color: var(--text-muted); font-size: 13px; line-height: 28px; }
.rcpt-box { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: text; }
.rcpt-chips { display: contents; }
.rcpt-box input { flex: 1; min-width: 120px; height: 28px; padding: 0; background: none; border: 0; outline: 0; color: var(--text-strong); font-size: 15px; }
.rcpt-row .link-btn { line-height: 28px; font-size: 13px; flex: none; }
.rcpt { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 28px; padding: 0 4px 0 11px; border-radius: 14px; background: var(--bg-raised); border: 1px solid var(--border); font-size: 13px; color: var(--text-strong); }
.rcpt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcpt button, .catt button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--text-muted); flex: none; }
.rcpt button:hover, .catt button:hover { background: var(--border); color: var(--text-strong); }
.rcpt button .icon, .catt button .icon { width: 12px; height: 12px; stroke-width: 2.6; }
.compose-subject { display: block; width: 100%; height: 44px; padding: 0; background: none; border: 0; border-bottom: 1px solid var(--border-soft); outline: 0; color: var(--text-strong); font-size: 15px; }
.compose-subject::placeholder { color: var(--text-faint); }
.compose-editor { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; outline: 0; font-size: 15px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.compose-editor blockquote { margin: 0 0 0 .6em !important; padding-left: .9em !important; border-left: 2px solid var(--border) !important; color: var(--text-muted); }
.compose-editor a { color: var(--link); }
.compose-editor img { max-width: 100%; height: auto; }
.compose-atts { flex: none; display: flex; flex-wrap: wrap; gap: 6px; max-height: 104px; overflow-y: auto; padding: 0 16px; }
.compose-atts:not(:empty) { padding-bottom: 10px; }
.catt { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 6px 0 10px; border-radius: 8px; background: var(--bg-raised); border: 1px solid var(--border); font-size: 13px; }
.catt > .icon { width: 15px; height: 15px; color: var(--text-muted); }
.catt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); }
.catt-size { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.compose-foot { flex: none; display: flex; align-items: center; gap: 2px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) 16px; border-top: 1px solid var(--border-soft); }
.compose-foot .btn.primary { margin-right: 8px; padding: 0 20px; }
.compose-foot .fmt { font-size: 16px; font-family: var(--font-serif); }
.compose-foot .grow { flex: 1; }
.suggest { position: absolute; z-index: 5; left: 38px; right: 0; top: 100%; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.suggest-item { display: flex; flex-direction: column; width: 100%; padding: 7px 12px; text-align: left; }
.suggest-item.active, .suggest-item:hover { background: var(--accent-soft); }
.s-name { color: var(--text-strong); font-weight: 600; }
.s-email { color: var(--text-muted); font-size: 12.5px; }

.reply-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px 0 0 52px; }
.btn.outline { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); color: var(--text); }
.btn.outline .icon { width: 17px; height: 17px; }
.msg-head .icon-btn { width: 34px; height: 34px; margin-left: -4px; }

@media (max-width: 1000px) {
  .fab { display: grid; }
  body.composing .fab { display: none; }
  .compose-btn { margin-bottom: 12px; }
}
@media (max-width: 640px) {
  .compose { inset: 0; width: auto; height: auto; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .compose-head { border-radius: 0; height: 50px; }
  .compose-foot .fmt.extra { display: none; }
  .reply-bar { padding-left: 0; }
  .reply-bar .btn { flex: 1; justify-content: center; padding: 0 10px; }
}

/* ---------- instellingen: filters en doorsturen ---------- */

.settings { max-width: 800px; padding: 20px 28px 56px; }
.settings .notice { margin-bottom: 16px; }
.card { border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px 20px; margin-bottom: 18px; }
.card h2 { margin: 0 0 6px; font: 600 18px/1.3 var(--font-serif); color: var(--text-strong); }
.muted { margin: 0 0 14px; color: var(--text-muted); max-width: 640px; }
.rules { margin: 10px 0 16px; }
.rule { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.rule input[type="checkbox"], .opt input[type="checkbox"], .lab-opt input { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.rule-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rule-name { font-weight: 700; color: var(--text-strong); }
.rule-when { color: var(--text); }
.rule-then { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.rule.off .rule-text { opacity: .5; }
.rule .icon-btn { width: 34px; height: 34px; margin-top: -4px; }
.rule-empty { padding: 14px 0; border-top: 1px solid var(--border-soft); color: var(--text-faint); }
.inp { height: 38px; padding: 0 10px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 9px; outline: 0; color: var(--text-strong); font-size: 14px; max-width: 100%; }
.inp:focus { border-color: var(--accent); }
select.inp { padding-right: 6px; }
.fwd-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }
.fwd-form .field .inp { display: block; width: 100%; margin-top: 6px; }
.fwd-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.modal.wide { width: min(640px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; }
.field.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cond { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.cond input.inp { flex: 1; min-width: 150px; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 36px; flex-wrap: wrap; color: var(--text); }
.opt input[type="checkbox"] { margin: 0; }
.opt .inp { flex: 1; min-width: 180px; }
.opt-labels { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 0 0 8px 0; }
.lab-opt { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.lab-opt input { margin: 0; }

@media (max-width: 640px) {
  .settings { padding: 14px 14px 48px; }
  .fwd-form { grid-template-columns: minmax(0, 1fr); }
  .cond select.inp { flex: 1; }
}

/* ---------- inloggen en installatie ---------- */

body.locked .app, body.locked .fab, body.locked #compose { display: none; }
.auth { position: fixed; inset: 0; z-index: 55; overflow-y: auto; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom)); background: var(--bg-outer); }
.auth-card { width: min(430px, 100%); background: var(--bg-surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px 28px 26px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font: 600 20px/1 var(--font-serif); color: var(--text-strong); }
.auth-brand img { width: 30px; height: 30px; border-radius: 8px; }
.auth-card h1 { margin: 0 0 10px; font: 600 24px/1.2 var(--font-serif); color: var(--text-strong); }
.auth-note { margin: 0 0 18px; color: var(--text-muted); line-height: 1.5; }
.auth-foot { margin: 16px 0 0; color: var(--text-faint); font-size: 12.5px; line-height: 1.5; }
.auth-center { text-align: center; margin: 0 0 4px; }
.auth-card .field input, .modal .field input[type="email"], .modal .field input[type="password"] { display: block; width: 100%; height: 44px; margin-top: 6px; padding: 0 12px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px; outline: 0; color: var(--text-strong); font-size: 16px; }
.auth-card .field input:focus { border-color: var(--accent); }
.btn.big { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 46px; border-radius: 23px; font-size: 15px; margin-top: 10px; }
.btn.big .icon { width: 19px; height: 19px; }
.auth-card .opt.remember { margin: 12px 0 2px; }
.auth-card .form-error { margin: 10px 0 0; }
.auth-alt { margin-top: 18px; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.auth-alt summary { cursor: pointer; color: var(--link); font-weight: 600; margin-bottom: 14px; list-style-position: inside; }
.auth-alt:not([open]) summary { margin-bottom: 0; }
form .auth-alt { margin: 0 0 16px; padding-top: 12px; }
.qr { display: grid; place-items: center; margin: 0 0 14px; }
.qr img { width: 200px; height: 200px; padding: 10px; background: #fff; border-radius: 12px; }
.auth-foot code { font: 600 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); word-spacing: 2px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.codes code { padding: 9px 0; text-align: center; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 9px; font: 600 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-strong); letter-spacing: .5px; }
.auth-row { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-row .btn { flex: 1; }
.btn[disabled] { cursor: default; }

button.me { cursor: pointer; border: 0; font: inherit; font-weight: 600; }
button.me:hover { filter: brightness(1.1); }
.acct { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.acct-name { font-weight: 700; color: var(--text-strong); overflow-wrap: anywhere; }
.acct-mail { color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }
a.pop-item { text-decoration: none; }
.rule > .icon { margin-top: 2px; color: var(--text-muted); }
.rule .btn.danger { height: 32px; padding: 0 12px; margin-top: -2px; }

@media (max-width: 640px) {
  .auth { place-items: start center; padding-left: 12px; padding-right: 12px; }
  .auth-card { padding: 24px 20px 22px; border-radius: 16px; }
}

/* kleine correcties inlogschermen */
a.btn { text-decoration: none; }
.btn.outline { justify-content: center; }
.auth-card form { margin-top: 16px; }
.auth-card h1 + .btn.big { margin-top: 14px; }

/* ---------- als geïnstalleerde app ---------- */

html, body { overscroll-behavior: none; }
.steps { margin: 0 0 16px; padding-left: 22px; color: var(--text); line-height: 1.6; }
.steps li { margin-bottom: 6px; }

/* iOS zoomt in op invoervelden met kleinere letters dan 16px; dat voorkomen we op aanraakschermen. */
@media (pointer: coarse) {
  input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, .compose-editor, .inp { font-size: 16px !important; }
  .row { -webkit-touch-callout: none; }
}

/* Los venster op de Mac (Safari “Zet in Dock”): ruimte voor de vensterknoppen linksboven. */
@media (display-mode: standalone) and (min-width: 1001px) {
  .topbar { padding-left: max(10px, env(titlebar-area-x, 0px)); }
}
