:root {
    --fg: #1c2024;
    --muted: #6b7480;
    --line: #e2e5e9;
    --bg: #ffffff;
    --bg-soft: #f6f7f9;
    --accent: #1f6feb;
    --green: #1a7f37;
    --amber: #9a6700;
    --red: #b42318;
    --radius: 6px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--fg);
    background: var(--bg-soft);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .4rem; color: var(--muted); }
code { background: var(--bg-soft); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }

/* topbar */
.topbar {
    display: flex; align-items: center; gap: 1.25rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 0 1.25rem; height: 52px;
}
.brand { font-weight: 700; color: var(--fg); }
.mainnav { display: flex; gap: .35rem; flex: 1; flex-wrap: wrap; }
.mainnav a {
    color: var(--muted); padding: .3rem .55rem; border-radius: var(--radius); font-size: .92rem;
}
.mainnav a:hover { background: var(--bg-soft); text-decoration: none; }
.mainnav a.active { color: var(--fg); background: var(--bg-soft); font-weight: 600; }
.usermenu { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.usermenu form { margin: 0; }
.who { color: var(--muted); }
.tenantname { font-weight: 600; }
.tenantpick select { padding: .25rem .4rem; }

button.link {
    background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0;
}
button.link:hover { text-decoration: underline; }

/* layout */
.wrap { max-width: 1000px; margin: 1.5rem auto; padding: 0 1.25rem; }
.crumb { color: var(--muted); font-size: .9rem; margin: 0 0 .5rem; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* flash */
.flash { padding: .6rem .85rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash-ok { background: #eaf6ec; border-color: #b7dfc0; color: var(--green); }
.flash-error { background: #fdeceb; border-color: #f2c1bd; color: var(--red); }

/* tables */
table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; background: var(--bg); }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tbody tr:hover { background: var(--bg-soft); }
.row-actions { white-space: nowrap; font-size: .9rem; }
.row-actions form { display: inline; }
.warn-cell { background: #fdf6e3; font-weight: 600; }

/* badges */
.badge {
    display: inline-block; padding: .1rem .45rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.b-green { background: #e6f4ea; color: var(--green); }
.b-blue  { background: #e6effd; color: var(--accent); }
.b-amber { background: #fbf0d9; color: var(--amber); }
.b-grey  { background: #eceef1; color: var(--muted); }

/* tiles */
.tiles { display: flex; gap: 1rem; margin: 1rem 0 1.5rem; flex-wrap: wrap; }
.tile {
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.25rem; min-width: 160px;
}
a.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile-num { font-size: 1.8rem; font-weight: 700; }
.tile-lbl { color: var(--muted); font-size: .85rem; }
.tile-ok .tile-num { color: var(--green); }
.tile-warn { border-color: #f2c1bd; }
.tile-warn .tile-num { color: var(--red); }

/* blocks / kv */
.block { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0; }
.lead { font-size: 1.05rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .5rem 1.5rem; margin: .75rem 0; }
.kv > div { display: flex; gap: .5rem; }
.kv span { color: var(--muted); min-width: 110px; display: inline-block; }
.abstain { color: var(--amber); background: #fbf0d9; padding: .5rem .75rem; border-radius: var(--radius); }
.finding { margin: .3rem 0; }
.md h2 { font-size: 1rem; }
.md p { margin: .4rem 0; }

/* phase stepper (funktioniert ohne body.site — fest verdrahtete Farben) */
.phase-steps { display: flex; gap: 1.25rem; flex-wrap: wrap; margin: 1rem 0 1.5rem; }
.phase-step { flex: 1; min-width: 160px; padding: .9rem 1rem; border-radius: 10px; border: 1px solid var(--line); }
.phase-step .phase-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.6rem; height: 1.6rem; border-radius: 50%; font-weight: 700;
    font-size: .85rem; margin-bottom: .4rem; background: #eceef1; color: var(--muted);
}
.phase-step .phase-label { display: block; font-weight: 700; margin-bottom: .15rem; }
.phase-step .phase-sub { display: block; font-size: .78rem; }
.phase-done { background: #e6f4ea; border-color: #bfe3c8; }
.phase-done .phase-num { background: #1a7f37; color: #fff; }
.phase-current { background: #fff; border-color: #0f766e; box-shadow: 0 0 0 1px #0f766e inset; }
.phase-current .phase-num { background: #0f766e; color: #fff; }
.phase-upcoming { opacity: .55; }

/* struktur-baum (Company -> Site -> Process -> Activity) */
.tree { margin: .5rem 0; }
.tree-node { border-left: 2px solid var(--line); padding-left: 1rem; margin-left: .3rem; }
.tree-node.tree-root { border-left: none; padding-left: 0; margin-left: 0; }
.tree-item {
    display: inline-flex; align-items: center; gap: .4rem; background: var(--bg);
    border: 1px solid var(--line); border-radius: 999px; padding: .25rem .75rem;
    font-size: .88rem; margin: .3rem 0;
}
.tree-item.tree-empty { color: var(--muted); border-style: dashed; background: transparent; }
.tree-children { margin: .25rem 0 .5rem 0; }

/* forms */
.form, .loginbox form { max-width: 640px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1rem; padding: .75rem 1rem 1rem; }
legend { color: var(--muted); font-size: .85rem; padding: 0 .35rem; text-transform: uppercase; letter-spacing: .03em; }
.field { display: block; margin: .6rem 0; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.hint { display: block; color: var(--muted); font-size: .8rem; margin-top: .15rem; }
input, select, textarea {
    width: 100%; padding: .45rem .55rem; border: 1px solid var(--line);
    border-radius: var(--radius); font: inherit; background: var(--bg); color: var(--fg);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe0fb; border-color: var(--accent); }
button, .btn {
    display: inline-block; background: var(--accent); color: #fff; border: 0; cursor: pointer;
    padding: .5rem .9rem; border-radius: var(--radius); font: inherit; font-weight: 600;
}
button:hover, .btn:hover { background: #1a5fd0; text-decoration: none; }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.form-actions a { color: var(--muted); }

.inline-form {
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
    background: var(--bg-soft); padding: .6rem .75rem; border-radius: var(--radius); margin: .5rem 0;
}
.inline-form input[type=text] { width: auto; flex: 1; min-width: 220px; }
.inline-form select { width: auto; }
.checks { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-bottom: .5rem; }
.chk, .checks label { font-size: .9rem; display: flex; align-items: center; gap: .35rem; }
.chk input { width: auto; }

/* login */
.loginbox { max-width: 340px; margin: 4rem auto; background: var(--bg); padding: 1.5rem 1.75rem 2rem; border: 1px solid var(--line); border-radius: var(--radius); }
.loginbox label { display: block; margin: .75rem 0; font-size: .9rem; color: var(--muted); }
.loginbox button { width: 100%; margin-top: .5rem; }

/* =========================================================================
   Öffentliche Seite (marketing) — eigene Tokens, App-UI bleibt unberührt
   ========================================================================= */
body.site {
    --m-primary:      #0f766e;
    --m-primary-deep: #0b4f4a;
    --m-primary-tint: #e6f1ef;
    --m-accent:       #c2620a;
    --m-ink:          #14231f;
    --m-body:         #3c4a46;
    --m-paper:        #fbfaf7;
    --m-mist:         #eef3f1;
    --m-line:         #dde5e2;
    background: var(--m-paper);
    color: var(--m-ink);
    font-size: 16px;
}
body.site a { color: var(--m-primary); }
.wrap-wide { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }

/* --- Header ------------------------------------------------------------- */
.site-head {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .85rem 1.5rem;
    background: rgba(251, 250, 247, .85);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--m-line);
}
.site-brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; color: var(--m-ink); letter-spacing: -.01em; }
.site-brand svg { width: 26px; height: 26px; flex: none; color: var(--m-primary); }
.site-nav { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.site-nav a { color: var(--m-body); font-size: .9rem; font-weight: 500; }
.site-nav a:hover { color: var(--m-ink); text-decoration: none; }
.site-cta {
    background: var(--m-primary); color: #fff !important; padding: .5rem .95rem;
    border-radius: 8px; font-weight: 600; font-size: .9rem;
    box-shadow: 0 1px 2px rgba(15,118,110,.25);
}
.site-cta:hover { background: var(--m-primary-deep); }

/* --- Buttons ---------------------------------------------------------- */
body.site .btn {
    background: var(--m-primary); color: #fff; border-radius: 9px; padding: .7rem 1.3rem;
    font-weight: 600; box-shadow: 0 2px 10px rgba(15,118,110,.22);
}
body.site .btn:hover { background: var(--m-primary-deep); color: #fff; }
body.site .btn-ghost {
    background: transparent; color: var(--m-primary); border: 1.5px solid var(--m-line);
    box-shadow: none;
}
body.site .btn-ghost:hover { background: var(--m-mist); border-color: var(--m-primary); color: var(--m-primary); }

/* --- Hero ----------------------------------------------------------- */
.hero {
    position: relative; overflow: hidden;
    padding: 4.5rem 0 4rem;
    background:
        radial-gradient(120% 90% at 88% 0%, var(--m-primary-tint) 0%, transparent 55%),
        linear-gradient(180deg, var(--m-paper), var(--m-mist));
    border-bottom: 1px solid var(--m-line);
}
.hero .wrap-wide { display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem; align-items: center; }
.kicker {
    display: inline-block; text-transform: uppercase; letter-spacing: .11em;
    font-size: .74rem; font-weight: 700; color: var(--m-primary);
    background: #fff; border: 1px solid var(--m-line); border-radius: 999px;
    padding: .3rem .8rem; margin: 0 0 1.4rem;
}
.hero h1 {
    font-size: clamp(2rem, 4.3vw, 3rem); line-height: 1.12; letter-spacing: -.02em;
    max-width: 16ch; margin: 0 0 1.1rem; color: var(--m-ink);
}
.hero-sub { font-size: 1.13rem; line-height: 1.65; max-width: 52ch; color: var(--m-body); }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.8rem; }
.hero-art { justify-self: center; width: 100%; max-width: 440px; }
.hero-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 18px 40px rgba(11,79,74,.15)); }

/* --- Bands --------------------------------------------------------- */
.band { padding: 4rem 0; border-bottom: 1px solid var(--m-line); }
.band-alt { background: #fff; }
.band h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); letter-spacing: -.015em; margin: 0 0 .5rem; color: var(--m-ink); }
.band > .wrap-wide > p,
.band > .wrap-wide > .lead { font-size: 1.06rem; color: var(--m-body); max-width: 58ch; margin: .3rem 0 0; line-height: 1.6; }
.band > .wrap-wide > .lead { font-size: 1.15rem; }
.section-tag { text-transform: uppercase; letter-spacing: .11em; font-size: .72rem; font-weight: 700; color: var(--m-accent); margin: 0 0 .6rem; }

/* --- Card grids ------------------------------------------------- */
.cols-2, .cols-3, .cols-4 { display: grid; gap: 1.25rem; margin-top: 1.8rem; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.card {
    background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 14px;
    padding: 1.5rem 1.4rem; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.band-alt .card { background: var(--m-paper); }
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(20,35,31,.08); border-color: var(--m-primary-tint); }
.card h3 { color: var(--m-ink); font-size: 1.05rem; margin: .9rem 0 .4rem; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--m-body); font-size: .95rem; line-height: 1.55; }
.card-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 8px;
    background: var(--m-primary-tint); color: var(--m-primary-deep);
    font-weight: 700; font-size: .95rem;
}
.card-ico { width: 32px; height: 32px; color: var(--m-primary); }

/* --- Chain diagram ------------------------------------------- */
.chain-wrap { margin: 2rem 0 .5rem; overflow-x: auto; padding-bottom: .5rem; }
.chain-wrap svg { display: block; min-width: 900px; height: auto; }
.chain-note { color: var(--m-body); font-size: .92rem; margin-top: .5rem; }

/* --- Evidence cards ------------------------------------------ */
.ev {
    background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 14px;
    padding: 1.3rem; border-top: 4px solid var(--m-line);
}
.ev .badge { margin-bottom: .6rem; }
.ev-observed { border-top-color: #1a7f37; }
.ev-derived  { border-top-color: #1f6feb; }
.ev-inferred { border-top-color: #b9700a; }
.ev-unknown  { border-top-color: #8a949c; }
.ev p { margin: 0; color: var(--m-body); font-size: .92rem; line-height: 1.5; }
.ev-ico { width: 26px; height: 26px; float: right; opacity: .8; }

/* --- Decision brief ---------------------------------------- */
.brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 1.8rem; align-items: start; }
.brief-blocks { margin: 0; padding: 0; list-style: none; counter-reset: bb; }
.brief-blocks li {
    counter-increment: bb; position: relative; padding: .55rem 0 .55rem 2.4rem;
    border-bottom: 1px solid var(--m-line); color: var(--m-ink); font-size: .95rem;
}
.brief-blocks li:last-child { border-bottom: 0; }
.brief-blocks li::before {
    content: counter(bb, decimal-leading-zero); position: absolute; left: 0; top: .5rem;
    font-variant-numeric: tabular-nums; font-weight: 700; font-size: .8rem;
    color: var(--m-primary);
}
.brief-visual svg { width: 100%; height: auto; filter: drop-shadow(0 16px 36px rgba(20,35,31,.12)); }

/* --- CTA band --------------------------------------------- */
.band-cta {
    background: linear-gradient(135deg, var(--m-primary-deep), var(--m-primary));
    color: #fff; border: 0; position: relative; overflow: hidden;
}
body.site .band-cta h2 { color: #fff; }
body.site .band-cta .wrap-wide > p,
body.site .band-cta .lead { color: rgba(255,255,255,.92); }
body.site .band-cta .btn { background: #fff; color: var(--m-primary-deep); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
body.site .band-cta .btn:hover { background: #f0f4f3; color: var(--m-primary-deep); }
body.site .band-cta .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
body.site .band-cta .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; border-color: #fff; }
.band-cta .cta-art {
    position: absolute; right: -60px; top: 50%; transform: translateY(-50%);
    width: 320px; opacity: .18; pointer-events: none;
}

/* --- Footer --------------------------------------------- */
.site-foot { padding: 2.5rem 0; font-size: .9rem; background: var(--m-ink); color: rgba(255,255,255,.75); }
.site-foot a { color: rgba(255,255,255,.9); }
.site-foot .foot-brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: #fff; margin-bottom: .6rem; }
.site-foot .foot-brand svg { width: 22px; height: 22px; color: #5eead4; }
.site-foot p { margin: .3rem 0; max-width: 60ch; }
body.site .site-foot .muted { color: rgba(255,255,255,.55); }

@media (max-width: 860px) {
    .hero .wrap-wide { grid-template-columns: 1fr; gap: 2rem; }
    .hero-art { order: -1; max-width: 340px; }
    .brief-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
@media (max-width: 560px) {
    .site-head { flex-wrap: wrap; }
    .site-nav { gap: 1rem; font-size: .85rem; }
}
