/* Nedap brand colours on a neutral ground. Orange means one thing: a prototype you haven't opened yet. */
:root {
  --nedap-blue: #023a4f;
  --nedap-orange: #ff6c37;
  --orange-text: #b8431a;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e2e5e9;
  --muted: #4b5f6b;
  --accent-bg: #e6eef1;
  --track: #e6e9ed;
  --ok-bg: #d9f2e3;
  --ok: #1d6b45;
  --danger: #b3261e;
  --radius: 10px;
  --page: 64rem;
  --gutter: 24px;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  color: var(--nedap-blue);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 16px; }
a { color: inherit; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 40px 0 12px; }
h3 { font-size: 16px; margin: 0; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
code { background: var(--accent-bg); padding: 1px 6px; border-radius: 4px; }

/* Top bar and page share one container, so the logo and the title start on one edge */
.topbar, main { width: 100%; max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.topbar-wrap { background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; font-size: 14px; }
.topbar .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; font-size: 16px; white-space: nowrap; }
.topbar .brand img { height: 18px; }
.topbar .brand span::before { content: "/ "; color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar form { margin: 0; }
/* The selector may shrink, so the top bar never runs past a phone's edge */
.context { min-width: 0; max-width: 40vw; }
.context-switch { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 10px 5px 12px; border: 1px solid #cdd3d9; border-radius: 8px; background: var(--panel); color: inherit; font-size: 14px; font-weight: 500; }
.context-switch:hover, .context-switch:focus-visible { border-color: var(--nedap-blue); }
.context-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-switch svg { flex: none; }
.context-static { color: var(--muted); }
/* The dropdown controller places the menu under its button; without script the browser centres it */
.context-menu:popover-open[style*="top"] { position: absolute; inset: auto; margin: 0; }
.context-menu { width: max-content; max-width: calc(100vw - 32px); max-height: 70vh; overflow: auto; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); color: inherit; box-shadow: 0 8px 24px rgba(2, 58, 79, .14); }
.menu-heading { margin: 8px 10px 4px; font-size: 12px; color: var(--muted); }
.context-menu form { margin: 0; }
.menu-item { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: inherit; font-weight: 400; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--track); }
.menu-item[aria-current="true"] { font-weight: 600; }

main { padding-top: 32px; padding-bottom: 64px; }
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 24px; background: var(--accent-bg); }
.flash.alert { background: #fbe9e7; color: var(--danger); }

/* Buttons: 8px corners everywhere, Nedap blue */
.button, button, input[type=submit] {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--nedap-blue);
  background: var(--nedap-blue); color: #fff; font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.button.secondary, button.secondary { background: transparent; color: var(--nedap-blue); }
.button.danger, button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.link-button { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; font-weight: 400; white-space: nowrap; }

/* Landing: title row and the finding */
.title-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 24px; margin-bottom: 24px; }
.subline { margin: 0; font-size: 14px; color: var(--muted); }
.segmented { display: flex; padding: 3px; border-radius: 999px; background: var(--track); font-size: 14px; }
.segmented a { white-space: nowrap; padding: 4px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); }
.segmented a.current { background: var(--panel); color: var(--nedap-blue); font-weight: 600; }
.finding { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px;
  padding: 12px 16px; background: #fff1ea; border-radius: var(--radius); }
.finding p { margin: 0; }
.finding a:not(.button) { font-weight: 600; }

/* Landing: tiles all the same width, so no prototype looks more important than another */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.tile .question { margin: 0 0 4px; color: var(--muted); }
.tag { display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--track); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag.popular { background: var(--ok-bg); color: var(--ok); }
.unopened { color: var(--orange-text); font-weight: 600; }
.unopened::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--nedap-orange); vertical-align: 1px; }
.keep-link { font-size: 14px; color: var(--muted); }
.run-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; }
.run-meta span { white-space: nowrap; }
.run-meta .ends { font-weight: 600; }
.progress { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--nedap-blue); }
.requested { margin: 0; color: var(--muted); }
.tile footer { display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--rule, #eef0f2); }
.tile .open { font-weight: 600; text-decoration: none; }
.tile .open:hover { text-decoration: underline; }

/* Landing: ended list and idea box */
.ended { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.ended li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; }
.ended li + li { border-top: 1px solid var(--border); }
.ended-actions { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.idea-box { display: flex; align-items: center; justify-content: space-between; gap: 32px; margin-top: 40px; padding: 24px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.idea-box h2 { margin: 0 0 4px; }
.idea-box p { margin: 0; font-size: 14px; }
.idea-form { display: flex; gap: 8px; flex: 1; max-width: 28rem; }
.idea-form input[type=text] { flex: 1; }

/* The "keep it running" dialog */
.modal { width: min(30rem, calc(100vw - 32px)); border: 0; border-radius: var(--radius); padding: 24px; color: inherit; }
.modal::backdrop { background: rgba(2, 58, 79, .45); }
.modal h2 { margin: 0; }
.modal p { margin: 0; font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Forms and tables, mostly for Admin */
form.stack { display: grid; gap: .75rem; max-width: 32rem; }
form.inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
label { display: grid; gap: 4px; font-size: 14px; }
input[type=text], input[type=date], input[type=number], textarea, select { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: inherit; }
.errors { color: var(--danger); }
table { font-size: 14px; width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
tr.expired td { background: #fdf3f2; }
td form { display: inline; }
nav.admin { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
nav.admin a.current { font-weight: 600; }

.login { max-width: 26rem; margin: 4rem auto; text-align: center; }
.login .button { display: block; width: 100%; margin: .75rem 0; }


@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .topbar { gap: 12px; }
  .topbar .who { display: none; }
  .tiles { grid-template-columns: 1fr; }
  .idea-box { flex-direction: column; align-items: stretch; }
  .idea-form { max-width: none; }
  .ended li { flex-direction: column; align-items: flex-start; }
}
