/* digioffice-beheer — Fase 1 styles. Geen framework. */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e1e6ed;
  --text: #1a2438;
  --text-dim: #6b7388;
  --accent: #0066cc;
  --accent-dark: #004f9f;
  --green: #1f9d55;
  --yellow: #d97706;
  --red: #dc2626;
  --grey: #9ca3af;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.brand { font-size: 18px; font-weight: 600; color: var(--accent-dark); }
.user-info { font-size: 13px; color: var(--text-dim); }

main { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }

.persistence-warning { background: #fef3c7; color: #92400e; border-bottom: 2px solid #f59e0b; padding: 10px 24px; font-size: 13px; text-align: center; }
.persistence-warning strong { color: #78350f; }

#loading { color: var(--text-dim); text-align: center; padding: 64px 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
h1 { margin: 0; font-size: 24px; font-weight: 600; }
h2 { margin: 32px 0 12px; font-size: 16px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }

.btn-primary, .btn-link { font: inherit; cursor: pointer; }
.btn-primary { background: var(--accent); color: white; border: none; padding: 8px 16px; border-radius: var(--radius); font-weight: 500; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: var(--grey); cursor: wait; }
.btn-link { background: none; border: none; color: var(--accent); padding: 4px 8px; }
.btn-link:hover { text-decoration: underline; }
.btn-danger { background: var(--red); color: white; border: none; padding: 8px 16px; border-radius: var(--radius); font-weight: 500; font: inherit; cursor: pointer; font-weight: 500; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { background: var(--grey); cursor: wait; }

.detail-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.install-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.install-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.install-card:hover, .install-card:focus { border-color: var(--accent); box-shadow: var(--shadow); outline: none; }
.install-name { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.install-id { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; color: var(--text-dim); margin-bottom: 12px; word-break: break-all; }
.install-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meta-item { font-size: 12px; color: var(--text-dim); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-grey { background: #e5e7eb; color: #4b5563; }

.placeholder { color: var(--text-dim); padding: 32px; text-align: center; background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--border); }
.error { color: var(--red); background: #fee2e2; padding: 12px 16px; border-radius: var(--radius); margin-top: 12px; }

.heartbeats { margin-top: 24px; }
.hb-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.hb-table th, .hb-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.hb-table th { background: var(--bg); font-weight: 600; font-size: 12px; text-transform: uppercase; color: var(--text-dim); letter-spacing: .05em; }
.hb-table tr:last-child td { border-bottom: none; }
.hb-table .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.hb-table .num { text-align: right; }
.hb-table .gw-up { color: var(--green); font-weight: 500; }
.hb-table .gw-down { color: var(--red); font-weight: 500; }

.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.modal { background: var(--surface); border-radius: 8px; padding: 24px; max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.modal h2 { margin-top: 0; margin-bottom: 16px; color: var(--text); text-transform: none; letter-spacing: normal; font-size: 18px; }
.modal label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 500; }
.modal label.mt { margin-top: 16px; }
.modal input[type=text], .modal input[type=email] { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.modal input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.modal .warn { color: var(--yellow); font-weight: 500; font-size: 13px; }
.secret-box { background: var(--bg); border: 1px solid var(--border); padding: 10px 12px; border-radius: var(--radius); word-break: break-all; user-select: all; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.snippet { background: #1e293b; color: #e2e8f0; padding: 12px 16px; border-radius: var(--radius); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; overflow-x: auto; white-space: pre; margin: 0; }

.copy-wrap { position: relative; }
.copy-wrap .secret-box, .copy-wrap .snippet { padding-right: 80px; }
.copy-btn { position: absolute; top: 6px; right: 6px; padding: 4px 10px; font-size: 11px; font-weight: 500; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--accent); transition: background .15s, color .15s; }
.copy-btn:hover { background: var(--bg); }
.copy-btn.copied { background: var(--green); color: white; border-color: var(--green); }
.copy-wrap .snippet + .copy-btn { background: rgba(255,255,255,.1); color: #e2e8f0; border-color: rgba(255,255,255,.2); }
.copy-wrap .snippet + .copy-btn:hover { background: rgba(255,255,255,.2); }
.copy-wrap .snippet + .copy-btn.copied { background: var(--green); color: white; border-color: var(--green); }

/* ── Fase 2: nav, statistieken, secret-rotatie ── */
.nav { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.nav-item { font: inherit; cursor: pointer; background: none; border: none; padding: 8px 16px; color: var(--text-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.topbar-actions { display: flex; gap: 8px; }
.btn-secondary { font: inherit; cursor: pointer; background: var(--surface); color: var(--accent); border: 1px solid var(--accent); padding: 8px 16px; border-radius: var(--radius); font-weight: 500; }
.btn-secondary:hover { background: var(--bg); }
.btn-secondary:disabled { color: var(--grey); border-color: var(--grey); cursor: wait; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; margin-bottom: 8px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.stat-card.good .stat-value { color: var(--green); }
.stat-card.warn .stat-value { color: var(--yellow); }
.stat-card.bad .stat-value { color: var(--red); }

/* ── Fase 3: feedback-aggregaat ── */
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar input[type=text], .filter-bar select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.filter-bar input[type=text] { min-width: 220px; }
.filter-bar input:focus, .filter-bar select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.hb-table td.link { color: var(--accent); cursor: pointer; }
.hb-table td.link:hover { text-decoration: underline; }

/* ── Fase 4: updates (signing-keys + commands) ── */
.hint { color: var(--text-dim); font-size: 13px; margin: 0 0 16px; max-width: 720px; }
.keys-box, .cmd-box { margin-bottom: 12px; }
.pem-area { width: 100%; min-height: 140px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; resize: vertical; }
.pem-area:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.allow-updates-row { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; }
.switch-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; }

/* ── Fase 6: DigiOffice-core ── */
.do-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.do-head h1 { margin: 0; }
.do-head-right { display: flex; align-items: center; gap: 12px; }
.do-updated { font-size: 12px; color: var(--text-dim); }
.do-viewsel { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; background: var(--surface); color: var(--text); }
.do-viewsel:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.do-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 20px; align-items: start; }
.do-layout.full { grid-template-columns: 1fr; }
.do-layout.full .do-versions { display: none; }
@media (max-width: 1100px) { .do-layout { grid-template-columns: 1fr; } }
.do-main { min-width: 0; overflow-x: auto; }
/* "Per omgeving" grid in de versie-overzicht-weergave */
.do-vergrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 16px; }

.do-table { font-size: 13px; }
.do-table th, .do-table td { padding: 7px 10px; white-space: nowrap; }
.do-table tbody tr:hover { background: var(--bg); }
.do-table tr.row-warn { background: #fffbeb; }
.do-table tr.row-bad  { background: #fef2f2; }
.do-table tr.row-bad:hover { background: #fee2e2; }
.do-omg { font-weight: 600; }
.do-omg.link { color: var(--accent); cursor: pointer; }
.do-omg.link:hover { text-decoration: underline; }
.do-redsince { color: var(--red); font-weight: 600; font-size: 12px; }

.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }
.dot-grey { background: var(--grey); }

.hb-table td.cell-warn { background: #fef3c7; color: #92400e; font-weight: 600; }
.hb-table td.cell-bad { background: #fee2e2; color: #991b1b; font-weight: 600; }
.do-table td.num { text-align: right; }

/* Versie-referentiepaneel */
.do-versions { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); position: sticky; top: 16px; }
.do-versions h2 { margin: 0 0 10px; font-size: 12px; }
.do-verlist { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; }
.do-verrow { display: flex; justify-content: space-between; gap: 8px; padding: 3px 6px; border-radius: 4px; font-size: 12px; }
.do-verrow:nth-child(even) { background: var(--bg); }
.do-vercode { font-weight: 600; }
.do-vercode.link { color: var(--accent); cursor: pointer; }
.do-vercode.link:hover { text-decoration: underline; }
.do-verval { color: var(--text-dim); }
.do-verval.cell-warn { background: #fef3c7; color: #92400e; padding: 0 4px; border-radius: 3px; }
.do-vermax { font-size: 11px; color: var(--text-dim); margin: 10px 0 0; }

/* ── Monitor-weergave (groot/wandscherm, donker NOC-thema) ── */
.do-monitor { background: #0c1320; color: #e8edf5; border-radius: 8px; padding: 18px 20px; min-height: 70vh; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.do-mon-empty { color: #aeb6c4; padding: 40px; text-align: center; }
.do-mon-kpi { display: flex; align-items: flex-end; gap: 32px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.do-mon-kpi .kpi { display: flex; flex-direction: column; }
.do-mon-kpi .kpi-val { font-size: 44px; font-weight: 700; line-height: 1; }
.do-mon-kpi .kpi-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .65; margin-top: 4px; }
.do-mon-kpi .kpi.bad .kpi-val { color: #f87171; }
.do-mon-kpi .kpi.down .kpi-val { color: #cbd5e1; }
.do-mon-kpi .kpi.warn .kpi-val { color: #fbbf24; }
.do-mon-kpi .kpi.ok .kpi-val { color: #4ade80; }
.do-mon-meta { margin-left: auto; text-align: right; font-size: 13px; opacity: .8; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.do-mon-fs { background: rgba(255,255,255,.1); color: #e8edf5; border: 1px solid rgba(255,255,255,.2); padding: 6px 12px; border-radius: var(--radius); font: inherit; cursor: pointer; }
.do-mon-fs:hover { background: rgba(255,255,255,.2); }

.do-mon-sec { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #aeb6c4; margin: 18px 0 8px; font-weight: 600; }
.do-montiles { display: grid; gap: 8px; align-items: stretch; }
.do-montiles-big { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.do-montiles-sm  { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.montile { border-radius: 6px; padding: 8px 10px; min-height: 42px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; border: 1px solid rgba(0,0,0,.25); color: #fff; }
.montile:hover { outline: 2px solid rgba(255,255,255,.5); }
.montile:focus { outline: 2px solid #fff; }
.montile .mt-code { font-weight: 700; letter-spacing: .02em; }
.montile .mt-ver { opacity: .85; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.montile .mt-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.montile .mt-tag { font-weight: 600; padding: 1px 6px; border-radius: 8px; background: rgba(0,0,0,.3); white-space: nowrap; }
.montile .mt-since { opacity: .85; margin-top: 2px; }

/* Compacte "Gezond"-tegels. */
.do-montiles-sm .montile { min-height: 36px; padding: 5px 9px; }
.do-montiles-sm .mt-code { font-size: 14px; }
.do-montiles-sm .mt-ver  { font-size: 13px; font-weight: 600; opacity: 1; }

/* Grote "Aandacht"-tegels met grote tekst. */
.do-montiles-big .montile { min-height: 80px; padding: 12px 14px; }
.do-montiles-big .mt-code { font-size: 24px; }
.do-montiles-big .mt-ver  { font-size: 19px; font-weight: 700; opacity: 1; }
.do-montiles-big .mt-tag  { font-size: 12px; padding: 2px 8px; }
.do-montiles-big .mt-since { font-size: 12px; }
.do-montiles-big .mt-bad .mt-code, .do-montiles-big .mt-down .mt-code { font-size: 28px; }

.montile.mt-ok   { background: #1f7a3d; }
.montile.mt-warn { background: #b45309; }
.montile.mt-bad  { background: #c01d1d; }
.montile.mt-down { background: #3f3f46; border-left: 4px solid #ef4444; }
.mt-search { margin-top: 4px; }
.mt-search .search-pill { margin-left: 0; }

/* Search-app pill (cross-stream indicator) */
.search-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 10px; margin-left: 8px; vertical-align: middle; white-space: nowrap; }
.search-pill .sp-dot { width: 7px; height: 7px; border-radius: 50%; }
.search-pill.sp-on    { background: #d1fae5; color: #065f46; }
.search-pill.sp-on .sp-dot    { background: #1f9d55; }
.search-pill.sp-traag { background: #fef3c7; color: #92400e; }
.search-pill.sp-traag .sp-dot { background: #d97706; }
.search-pill.sp-off   { background: #fee2e2; color: #991b1b; }
.search-pill.sp-off .sp-dot   { background: #dc2626; }

/* ── Fase 7: gebruiksstatistieken (piekuren-grafiek) ── */
.usage-hours { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding: 8px 4px 0; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.usage-hour { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.usage-hour-bar { width: 70%; min-height: 1px; background: var(--accent); border-radius: 2px 2px 0 0; transition: height .15s; }
.usage-hour-label { font-size: 10px; color: var(--text-dim); margin-top: 4px; }
