/* Content OS - rustige editor, geen marketingwebsite */

:root {
  --bg: #fbfbfa;
  --panel: #ffffff;
  --ink: #1c1c1a;
  --ink-soft: #55554f;
  --ink-faint: #86867d;
  --line: #e4e3de;
  --line-strong: #d2d1ca;
  --accent: #2f5d50;
  --accent-soft: #eef3f1;
  --warn: #8a5a12;
  --warn-soft: #fdf3e3;
  --bad: #93331f;
  --bad-soft: #fbeeea;
  --good: #2f5d50;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
small { color: var(--ink-faint); }

/* ---------- layout ---------- */

.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
/* voorkomt dat brede tabellen of lange woorden de hele layout oprekken */
.app > *, .grid > *, .editor > *, .card, .stat, .list-item { min-width: 0; }
.pre, .preview, p, td, th, h1, h2, h3, h4 { overflow-wrap: anywhere; }

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { font-weight: 600; letter-spacing: -.01em; font-size: 1.05rem; }
.brand small { display: block; font-weight: 400; font-size: .78rem; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--radius);
  color: var(--ink-soft); text-decoration: none; font-size: .92rem;
}
.nav a:hover { background: #f2f1ee; color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav a .badge { margin-left: auto; }
.nav .ico { width: 16px; text-align: center; opacity: .75; }

.main { padding: 26px 30px 80px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--ink-soft); max-width: 62ch; margin: 0; }

/* ---------- bouwstenen ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card h3 { margin-bottom: .3em; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- statistiekbalk ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--panel); padding: 13px 15px; }
.stat .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.stat .value { font-size: 1.35rem; font-weight: 600; margin-top: 2px; }
.stat .value.small { font-size: 1rem; font-weight: 500; }
.stat .sub { font-size: .8rem; color: var(--ink-soft); }

/* ---------- knoppen ---------- */

button, .btn {
  font: inherit;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  padding: 6px 11px;
  border-radius: var(--radius);
  cursor: pointer;
  line-height: 1.4;
}
button:hover, .btn:hover { background: #f4f3f0; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #274c42; }
button.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
button.ghost:hover { background: #f2f1ee; }
button.small { padding: 3px 8px; font-size: .84rem; }
button.danger { color: var(--bad); border-color: #e8d3cd; }

.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- formulieren ---------- */

label { display: block; font-size: .82rem; color: var(--ink-soft); margin-bottom: 3px; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=url], select, textarea {
  font: inherit; width: 100%; padding: 7px 9px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field { margin-bottom: 10px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.check { display: flex; align-items: center; gap: 7px; font-size: .9rem; color: var(--ink); }
.check input { width: auto; }

/* ---------- badges en labels ---------- */

.badge {
  display: inline-block; font-size: .72rem; padding: 2px 7px; border-radius: 20px;
  background: #f0efec; color: var(--ink-soft); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: #d8e5e0; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #f0dfc2; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: #f0d4cc; }
.badge.demo { background: #f5f0e2; color: #7a6520; border-color: #e6dcc0; }

.meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-faint); }
.meta b { color: var(--ink-soft); font-weight: 500; }

/* ---------- contentkaarten ---------- */

.post-card { display: flex; flex-direction: column; gap: 10px; }
.post-card .when { font-size: .82rem; color: var(--ink-soft); font-weight: 500; }
.post-card .title { font-weight: 600; font-size: 1.02rem; }
.post-card .preview {
  white-space: pre-wrap; font-size: .9rem; color: var(--ink-soft);
  background: #fafaf8; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; max-height: 190px; overflow: hidden; position: relative;
}
.post-card .preview.empty { color: var(--ink-faint); font-style: italic; }
.scores { display: flex; gap: 6px; flex-wrap: wrap; }
.score { font-size: .74rem; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--ink-soft); }
.score b { color: var(--ink); }
.score.ok { border-color: #cfe0d9; background: #f2f7f5; }
.score.bad { border-color: #efd5cd; background: #fcf1ee; }

.why { font-size: .85rem; background: var(--accent-soft); border-left: 2px solid var(--accent); padding: 8px 10px; border-radius: 0 4px 4px 0; color: #2c4a42; }
.visual-note { font-size: .85rem; background: #fbf8f2; border-left: 2px solid #d8c9a5; padding: 8px 10px; border-radius: 0 4px 4px 0; }

/* ---------- editor ---------- */

.editor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.editor textarea.body { min-height: 480px; font-size: .96rem; }
.panel-section { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.panel-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.issue { border-left: 2px solid var(--line-strong); padding: 4px 0 4px 10px; margin-bottom: 8px; font-size: .88rem; }
.issue.hoog { border-color: var(--bad); }
.issue.midden { border-color: var(--warn); }
.issue .q { color: var(--ink-faint); font-style: italic; }

/* ---------- lijsten ---------- */

.list { display: flex; flex-direction: column; }
.list-item { padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item h4 { margin: 0 0 2px; font-size: .95rem; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); font-weight: 500; }
.table-wrap { overflow-x: auto; }

/* ---------- inbox ---------- */

.quick-capture { display: flex; gap: 8px; margin-bottom: 18px; }
.quick-capture input { flex: 1; padding: 10px 12px; }

/* ---------- vragen ---------- */

.question { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel); margin-bottom: 10px; }
.question .q { font-weight: 500; margin-bottom: 6px; }
.question .reason { font-size: .82rem; color: var(--ink-faint); margin-bottom: 8px; }

/* ---------- toast en modal ---------- */

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius);
  font-size: .88rem; max-width: 380px; box-shadow: 0 4px 14px rgba(0,0,0,.16);
}
.toast.error { background: var(--bad); }
.toast.ok { background: var(--accent); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(28,28,26,.35);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto;
}
.modal { background: var(--panel); border-radius: 8px; width: min(720px, 100%); padding: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.18); }

/* ---------- diversen ---------- */

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty-state h3 { color: var(--ink); }
.loading { color: var(--ink-faint); padding: 20px 0; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.notice { background: #fbf8f2; border: 1px solid #ece2cc; border-radius: var(--radius); padding: 10px 12px; font-size: .88rem; margin-bottom: 14px; }
.notice.bad { background: var(--bad-soft); border-color: #f0d4cc; }
.notice.ok { background: var(--accent-soft); border-color: #d8e5e0; }

.mono { font-family: var(--mono); font-size: .82rem; }
.muted { color: var(--ink-faint); }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--ink-soft); padding: 7px 10px; }
.tabs button.active { border-bottom-color: var(--accent); color: var(--ink); font-weight: 500; }

.bar { height: 6px; background: #eceae5; border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* ---------- mobiel ---------- */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: column;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 12px;
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 6px 8px; font-size: .86rem; }
  .main { padding: 16px 14px 60px; }
  .grid.two, .grid.three, .editor { grid-template-columns: 1fr; }
  .quick-capture { flex-direction: column; }
}
