/* structure first design system for the BPMN Modeller.
   Brand values from structure-first.de: navy, gold accent, Playfair Display for titles, Inter for text.
   Fonts are self-hosted (SIL Open Font License), so no page calls Google. */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/fonts/inter-latin.woff2) format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/fonts/playfair-700-latin.woff2) format('woff2'); }

:root {
  --navy-950: #0a1a33; --navy-900: #0f2444; --navy-800: #183462; --navy-600: #2a4a8a;
  --navy-200: #bcc9e8; --navy-100: #dfe6f4; --navy-50: #f0f3f9;
  --ink: #0f172a; --ink-2: #334155; --ink-3: #5b6578;
  --line: #e3e8f0; --line-2: #eef1f6; --bg: #f7f8fa; --card: #fff;
  --gold: #c5a55a; --gold-ink: #8a6d1f; --gold-50: #faf5e8;
  --ok: #157347; --ok-50: #e9f6ef; --err: #b42318; --err-50: #fef1f0; --warn: #9a5b00; --warn-50: #fdf3e2;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --r: 10px; --r-lg: 14px;
  --sh-1: 0 1px 2px rgba(15,36,68,.05);
  --sh-2: 0 1px 2px rgba(15,36,68,.04), 0 8px 24px rgba(15,36,68,.08);
  --sh-3: 0 24px 64px rgba(10,26,51,.22);
  --focus: 0 0 0 3px rgba(42,74,138,.18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; }
body { font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-600); }
:focus-visible { outline: 2px solid var(--navy-600); outline-offset: 2px; }
code { font: 500 .9em ui-monospace, 'SFMono-Regular', Menlo, monospace; background: var(--navy-50); padding: 1px 5px; border-radius: 5px; }

/* PS monogram with the gold rule, as on structure-first.de */
.mono { display: inline-grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px;
  background: var(--navy-900); color: #fff; font: 700 14px/1 var(--serif); letter-spacing: .02em; position: relative; }
.mono::after { content: ''; position: absolute; left: 24%; right: 24%; bottom: 19%; height: 1.5px; background: var(--gold); }
.mono.light { background: #fff; color: var(--navy-900); }
.mono.lg { width: 48px; height: 48px; border-radius: 12px; font-size: 20px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r); font-size: 14px; font-weight: 500; white-space: nowrap;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { flex-shrink: 0; }
.btn-primary { background: var(--navy-900); color: #fff; box-shadow: var(--sh-1); }
.btn-primary:hover:not(:disabled) { background: var(--navy-800); }
.btn-secondary { background: #fff; color: var(--ink-2); border-color: var(--line); box-shadow: var(--sh-1); }
.btn-secondary:hover:not(:disabled) { border-color: var(--navy-200); color: var(--navy-900); }
.btn-cancel { background: transparent; color: var(--ink-2); }
.btn-cancel:hover:not(:disabled) { background: var(--navy-50); }
.btn-danger { background: #fff; color: var(--err); border-color: #f3c9c4; }
.btn-danger:hover:not(:disabled) { background: var(--err-50); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--navy-50); color: var(--navy-900); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; height: 44px; font-size: 15px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3); cursor: pointer; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--navy-50); color: var(--navy-900); }
.link-btn { background: none; border: 0; padding: 0; color: var(--navy-600); font-weight: 500; cursor: pointer; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

/* Form fields */
.field { margin-bottom: 16px; text-align: left; }
.field > label, .field-row > label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field input, .field textarea, .field select, .input {
  display: block; width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; color: var(--ink); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { height: auto; min-height: 80px; padding: 10px 14px; resize: vertical; line-height: 1.5; }
.field select, select.input { appearance: none; padding-right: 36px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none' stroke='%235b6578' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center; }
.field input:focus, .field textarea:focus, .field select:focus, .input:focus { border-color: var(--navy-600); box-shadow: var(--focus); }
.field input:disabled { background: var(--bg); color: var(--ink-3); }
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: #94a0b4; }
.field .hint { margin-top: 6px; font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-row .link, .field-row .link-btn { font-size: 14px; margin: 0 0 6px; }

/* Messages */
.msg { display: none; margin-top: 16px; padding: 10px 14px; border-radius: var(--r); font-size: 14px; line-height: 1.45; text-align: left; }
.msg.error { display: block; background: var(--err-50); color: var(--err); border: 1px solid #f6d3cf; }
.msg.info { display: block; background: var(--ok-50); color: var(--ok); border: 1px solid #cbe9d8; }

/* Pill tags */
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 500; background: var(--navy-50); color: var(--navy-800); white-space: nowrap; }
.pill.warn { background: var(--warn-50); color: var(--warn); }
.pill.err { background: var(--err-50); color: var(--err); }

/* Modal */
.overlay { display: none; position: fixed; inset: 0; z-index: 100; padding: 16px; align-items: center; justify-content: center;
  background: rgba(10,26,51,.45); backdrop-filter: blur(4px); }
.overlay.open { display: flex; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 28px; border-radius: 16px;
  background: #fff; box-shadow: var(--sh-3); animation: sf-pop .16s ease-out; }
.modal h2 { margin-bottom: 18px; font: 700 22px/1.25 var(--serif); color: var(--navy-900); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes sf-pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }

/* ── Auth pages: login, invitation, magic link, reset ───────────────────── */
body.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px;
  background: radial-gradient(circle, #dde3ec 1px, transparent 1.2px) 0 0 / 22px 22px, var(--bg); }
.auth .card { width: min(420px, 100%); padding: 36px 32px 30px; border: 1px solid var(--line); border-radius: 18px;
  background: #fff; box-shadow: var(--sh-2); text-align: left; }
.auth .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth .brand-name { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.auth .brand-sub { font: 700 13px/1.2 var(--serif); color: var(--gold-ink); letter-spacing: .02em; }
.auth h1 { margin-bottom: 8px; font: 700 30px/1.2 var(--serif); color: var(--navy-900); letter-spacing: -.005em; }
.auth .sub { margin-bottom: 24px; font-size: 15px; color: var(--ink-3); line-height: 1.5; }
.auth .btn:not(.secondary):not(.link) { width: 100%; height: 44px; font-size: 15px; background: var(--navy-900); color: #fff; box-shadow: var(--sh-1); }
.auth .btn:not(.secondary):not(.link):hover:not(:disabled) { background: var(--navy-800); }
.auth .btn.secondary { width: 100%; height: 44px; font-size: 15px; background: #fff; color: var(--ink-2); border-color: var(--line); box-shadow: var(--sh-1); }
.auth .btn.secondary:hover:not(:disabled) { border-color: var(--navy-200); color: var(--navy-900); }
.auth .link { display: inline-block; margin-top: 18px; padding: 0; border: 0; background: none; color: var(--navy-600);
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; }
.auth .link:hover { text-decoration: underline; }
.auth .field-row .link { margin: 0 0 6px; }
.auth .or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-3); font-size: 14px; }
.auth .or::before, .auth .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth #code { height: 52px; text-align: center; font-size: 24px; font-weight: 600; letter-spacing: .4em; font-variant-numeric: tabular-nums; }
.auth .step { display: none; }
.auth .step.active { display: block; }
.auth footer { margin-top: 22px; font-size: 14px; color: var(--ink-3); }
.auth footer a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line); }
.auth footer a:hover { border-color: var(--ink-3); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--ink-3); cursor: pointer; }
.pw-eye:hover { background: var(--navy-50); color: var(--navy-900); }
@media (max-width: 480px) {
  body.auth { justify-content: flex-start; padding-top: 24px; }
  .auth .card { padding: 28px 22px 24px; border-radius: 16px; }
  .auth h1 { font-size: 26px; }
}
