/* 03-components.css — Panels, buttons, forms, notices, badges, tables, tiles, composer, checklist, dialogs.
   Part of the portal stylesheet; index.html loads the parts in order (01 to 12), so the cascade is
   the same as one file. */

/* ---------- Panels ---------- */
.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: var(--space-5);
  backdrop-filter: blur(8px);
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 40px;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
}
.panel-heading h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.panel-heading h2 svg { width: 18px; height: 18px; color: var(--primary); }
.panel-heading .muted { max-width: 760px; }
.panel-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.panel > h2 { margin-bottom: var(--space-3); }
.panel-attention { border-color: var(--warn-border); background: color-mix(in srgb, var(--warn-bg) 70%, var(--surface)); }
.error-card { border-color: var(--danger-border); }
.empty { display: grid; justify-items: center; gap: 6px; padding: 26px 16px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.empty svg { width: 26px; height: 26px; opacity: 0.6; }

/* ---------- Buttons (Office style) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--btn-top), var(--btn-bottom));
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(17, 20, 24, 0.04), inset 0 1px 0 color-mix(in srgb, var(--btn-top) 82%, transparent);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}
.btn:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 7px 18px rgba(30, 16, 20, 0.1); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: progress; transform: none; box-shadow: none; }
.btn-primary { background: var(--button-primary); border-color: var(--brand-primary); color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 25%, transparent); }
.btn-primary:hover { border-color: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: var(--danger-border); background: linear-gradient(180deg, var(--btn-top), var(--danger-bg)); }
.btn-danger:hover { border-color: var(--danger); }
.btn-link { min-height: 30px; padding: 5px 9px; border-color: transparent; background: transparent; box-shadow: none; color: var(--primary); font-weight: 650; }
.btn-link:hover { background: var(--primary-soft); border-color: transparent; transform: none; box-shadow: none; }
.btn-icon { width: 38px; padding: 0; }
td .btn { min-height: 30px; padding: 5px 9px; font-size: 12px; }

/* ---------- Forms ---------- */
input, select, textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: 8px 10px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
}
textarea { resize: vertical; min-height: 96px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, .side-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
  border-color: var(--primary);
}
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; flex: 0 0 auto; accent-color: var(--primary); }
.field { display: grid; gap: 5px; }
.field-label { font-weight: 700; font-size: 13px; }
.field-wide { grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; align-items: start; }
.form-actions, .composer-actions, .action-bar, .dialog-actions, .choices { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.action-bar { margin-top: 0; }
.composer-actions { justify-content: space-between; }
.composer-actions:has(> :only-child) { justify-content: flex-end; }
.form-error { color: var(--danger); margin: 0; min-height: 1.2em; }
.check { display: flex; gap: 8px; align-items: center; min-height: var(--control-height); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 16px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inline-form select { width: auto; flex: 1 1 200px; }
.code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
pre.code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow: auto; max-height: 420px; white-space: pre-wrap; }
.secret-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.secret-box code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; word-break: break-all; }
.secrets { display: grid; gap: 8px; margin-bottom: 16px; }
.secret-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; flex-wrap: wrap; background: var(--surface); }
.secret-row .hint { margin: 2px 0 0; }
.links { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.qr { width: 220px; height: 220px; display: block; margin: 8px 0; }

/* ---------- Sign-in (Office style card) ---------- */
body.signed-out { display: block; background: var(--signed-out-bg); }
body.signed-out .sidebar, body.signed-out .topbar, body.signed-out .mobile-appbar { display: none; }
body.signed-out main { padding: 24px; min-height: 100vh; display: grid; place-items: center; }
body.signed-out .view-host { width: 100%; max-width: 440px; }
.auth-card { display: grid; gap: 14px; padding: 28px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-float); }
.product-logo { width: min(320px, 100%); height: auto; justify-self: center; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 6px; background: #ffffff; }
.auth-card h1 { font-size: 24px; }

/* ---------- Notices, toasts ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; }
.notice ul { margin: 6px 0; padding-left: 20px; flex-basis: 100%; }
/* Text next to the icon, also when it is long. */
.notice > :is(svg, i) + span { flex: 1 1 240px; min-width: 0; }
.notice-warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.notice-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); margin: 12px 0 0; }
.notice-progress { align-items: center; background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 300; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-float); }
.toast-success { background: var(--ok); }
.toast-error { background: var(--danger); }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .btn:hover { transform: none; } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--badge-border); font-size: 12px; font-weight: 700; background: var(--badge-bg); color: var(--badge-ink); white-space: nowrap; }
.status-bezig, .status-wachtrij, .status-publiceren, .status-bezig_publiceren, .status-gepland { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.status-verduidelijken, .status-wacht_op_klant, .status-wacht_op_keuze, .status-ter_controle, .status-wacht_op_budget, .status-klaargezet { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.status-live, .status-afgerond { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.status-mislukt, .status-afgewezen { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.badge-internal { background: var(--internal-bg); border-color: var(--internal-border); color: var(--internal-ink); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 82%, transparent); border-radius: var(--radius); }
.panel .table-wrap { margin: 0; }
.panel .table-wrap + .table-wrap, .panel .table-wrap + ul { margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--th-bg); }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
td select { min-width: 150px; }

/* ---------- Tiles, meter, site cards ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); }
.tile { display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 18px; text-decoration: none; color: inherit; transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
a.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 24%, transparent); box-shadow: 0 16px 44px rgba(30, 16, 20, 0.1); }
.tile-value { font-size: 28px; font-weight: 850; color: var(--primary); }
.tile-label { color: var(--muted); font-weight: 600; }
.budget-line { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.meter { height: 10px; background: var(--meter-track); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--ok); }
.meter span.high { background: #d99a00; }
.meter span.full { background: var(--danger); }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.site-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none; transition: border-color 0.16s ease, box-shadow 0.16s ease; }
.site-card:hover { border-color: color-mix(in srgb, var(--primary) 35%, transparent); box-shadow: var(--shadow-soft); }
.site-card-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.site-card-icon svg { width: 20px; height: 20px; }
.site-card-body { display: grid; gap: 1px; flex: 1; min-width: 0; }
.site-card-body strong { color: var(--primary-dark); }
.site-card > svg { color: var(--muted); }

/* ---------- Request thread ---------- */
.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.attachment { display: grid; gap: 4px; text-decoration: none; color: inherit; max-width: 220px; }
.attachment img { width: 200px; height: 150px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); }
.attachment video { width: 320px; max-width: 100%; border-radius: 6px; background: #000; }
.attachment-video { max-width: 340px; }
.attachment-file { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; background: var(--surface); }
.caption { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.file-icon { font-size: 1.4rem; }
.admin-panel { border-style: dashed; }
.plain { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; font-size: 13px; }

/* ---------- Composer, file picker ---------- */
.composer { display: grid; gap: 10px; }
.file-picker { display: grid; gap: 8px; justify-items: start; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; width: 100%; }
.file-list li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; background: var(--surface); }
.file-list img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.file-name { flex: 1; overflow-wrap: anywhere; }
.source-images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.source-image { display: grid; gap: 4px; justify-items: center; cursor: pointer; }
.source-image img { width: 90px; height: 70px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
details > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 800; }
details > summary svg { color: var(--primary); }
details[open] > summary { margin-bottom: 10px; }

/* ---------- System checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.check-icon { font-weight: 800; width: 1.2em; }
.check-ok .check-icon { color: var(--ok); }
.check-fail .check-icon { color: var(--danger); }
.test-output { margin-top: 12px; }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-float); }
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(17, 20, 24, 0.45); }
.dialog-form { padding: 22px; display: grid; gap: 12px; max-height: calc(100vh - 64px); overflow: auto; }
.dialog-actions { justify-content: flex-end; }
