/* =========================================================================
   DPP Passport Platform – Designsystem
   Self-hosted, kein Build-Schritt nötig. Keine externen Requests (DSGVO).
   Ästhetik: warmes "Regulatory-Tech" – Papierton, tiefes Petrolgrün, Serif-Display.
   ========================================================================= */

/* ---------- Self-hosted Fonts ---------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/assets/webfonts/fraunces-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('/assets/webfonts/fraunces-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('/assets/webfonts/fraunces-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/assets/webfonts/hanken-grotesk-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('/assets/webfonts/hanken-grotesk-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('/assets/webfonts/hanken-grotesk-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('/assets/webfonts/hanken-grotesk-latin-700-normal.woff2') format('woff2');
}

/* ---------- Design Tokens ---------- */
:root {
  --paper:       #f5f2ea;
  --surface:     #fffdf8;
  --surface-2:   #faf7f0;
  --ink:         #1a1e1b;
  --ink-soft:    #5c635c;
  --ink-faint:   #8b918a;
  --line:        #e4ddcf;
  --line-strong: #d4ccba;

  --accent:      #1f5d4c;
  --accent-700:  #154236;
  --accent-soft: #e7f0ec;
  --amber:       #b5742a;
  --amber-soft:  #f6ecdd;
  --danger:      #a23b2e;
  --danger-soft: #f4e3df;
  --ok:          #2e7d5b;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius:    10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(26,30,27,.05), 0 1px 3px rgba(26,30,27,.04);
  --shadow-md: 0 4px 14px rgba(26,30,27,.08);
  --sidebar-w: 256px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  /* feiner Papier-Grain als atmosphärische Tiefe */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-700); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; margin: 0; color: var(--ink); }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }

/* ---------- Layout-Shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--accent-700);
  color: #e8efe9;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.35rem 1.4rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #2c7a63, #1f5d4c);
  color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.brand__name { font-family: var(--font-display); font-size: 1.08rem; color: #fff; line-height: 1.1; }
.brand__sub  { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #9fc1b4; }

.nav { padding: 1rem .75rem; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav__label { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #79a294; padding: .9rem .65rem .35rem; }
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .7rem; border-radius: 8px;
  color: #cfe0d8; font-size: .92rem; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.nav-item i { width: 18px; text-align: center; font-size: .95rem; color: #8fb3a6; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.is-active { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.is-active i { color: #fff; }
.nav-item.is-disabled { opacity: .45; cursor: default; }
.nav-item .soon { margin-left: auto; font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: #7ea596; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: .05rem .4rem; }

.sidebar__foot { padding: 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.09); font-size: .78rem; color: #9fc1b4; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px; display: flex; align-items: center; gap: 1rem;
  padding: 0 1.6rem; background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-family: var(--font-display); font-size: 1.15rem; }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: .6rem; font-size: .88rem; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-700);
  display: grid; place-items: center; font-weight: 600; font-size: .82rem;
}

.content { padding: 1.9rem 1.6rem 3rem; max-width: 1180px; width: 100%; }
.content__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.content__head .lede { color: var(--ink-soft); font-size: .95rem; margin-top: .35rem; }

.hamburger { display: none; background: none; border: 0; font-size: 1.2rem; color: var(--ink); cursor: pointer; }

/* ---------- Cards / Grid ---------- */
.grid { display: grid; gap: 1rem; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__body { padding: 1.2rem 1.3rem; }
.card__head { padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card__head h3 { font-size: 1rem; }

.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .85; }
.stat__label { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.stat__value { font-family: var(--font-display); font-size: 2.1rem; font-weight: 500; margin-top: .25rem; line-height: 1; }
.stat__meta  { font-size: .8rem; color: var(--ink-soft); margin-top: .5rem; }
.stat__icon  { position: absolute; right: 1rem; top: 1rem; color: var(--accent); opacity: .22; font-size: 1.4rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-body); font-size: .9rem; font-weight: 600;
  padding: .58rem 1.05rem; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .04s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-700); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.05rem; }
.label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink); margin-bottom: .4rem; }
.input {
  width: 100%; font-family: var(--font-body); font-size: .95rem;
  padding: .62rem .8rem; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink); transition: border-color .14s, box-shadow .14s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line);
}
.badge--ok     { background: var(--accent-soft); color: var(--accent-700); border-color: transparent; }
.badge--amber  { background: var(--amber-soft);  color: var(--amber);      border-color: transparent; }
.badge--danger { background: var(--danger-soft); color: var(--danger);     border-color: transparent; }
.badge--role   { background: #fff; color: var(--accent-700); border-color: var(--line-strong); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); padding: .55rem .75rem; border-bottom: 1px solid var(--line); font-weight: 600; }
.table td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .82em; color: var(--ink-soft); }

.empty { text-align: center; color: var(--ink-faint); padding: 2rem 1rem; font-size: .9rem; }

/* ---------- Repeater (Objekt-Listen) ---------- */
.repeater__row { display: flex; gap: .6rem; align-items: flex-end; padding: .6rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .55rem; background: var(--surface-2); flex-wrap: wrap; }
.repeater__cell { flex: 1 1 130px; min-width: 110px; }
.repeater__lbl { display: block; font-size: .72rem; color: var(--ink-faint); margin-bottom: .25rem; }
.repeater__del { flex: 0 0 auto; padding: .5rem .65rem; color: var(--danger); }
.repeater__row input[type="checkbox"] { width: 18px; height: 18px; }

/* ---------- Flash ---------- */
.flash { padding: .7rem 1rem; border-radius: 8px; font-size: .88rem; margin-bottom: 1rem; }
.flash--error { background: var(--danger-soft); color: var(--danger); }

/* ---------- Auth screen ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth__aside {
  background: linear-gradient(165deg, var(--accent-700), #0f2e26);
  color: #e8efe9; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth__aside::after {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 39.5H40M39.5 0V40' stroke='%23ffffff' stroke-opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
}
.auth__brand { display: flex; align-items: center; gap: .7rem; position: relative; }
.auth__pitch { position: relative; }
.auth__pitch h2 { font-size: 1.9rem; color: #fff; max-width: 18ch; line-height: 1.2; }
.auth__pitch p { color: #b5ccc2; max-width: 36ch; margin-top: 1rem; }
.auth__points { position: relative; display: flex; flex-direction: column; gap: .65rem; font-size: .9rem; color: #cfe0d8; }
.auth__points div { display: flex; gap: .6rem; align-items: center; }
.auth__points i { color: #6fae97; }
.auth__form { display: grid; place-items: center; padding: 2rem; background: var(--paper); }
.auth__card { width: 100%; max-width: 360px; }
.auth__card h1 { font-size: 1.6rem; margin-bottom: .4rem; }
.auth__card .lede { color: var(--ink-soft); margin-bottom: 1.6rem; font-size: .92rem; }
.auth__hint { margin-top: 1.2rem; font-size: .8rem; color: var(--ink-faint); text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-md); }
  .sidebar.is-open { transform: translateX(0); }
  .hamburger { display: block; }
  .grid--4, .grid--2 { grid-template-columns: 1fr; }
}

/* ---------- Öffentlicher Resolver ---------- */
body.resolver { background: var(--paper); min-height: 100vh; }
.resolver__wrap { max-width: 680px; margin: 0 auto; padding: 2rem 1.1rem 3rem; }
.resolver__hero { text-align: center; padding: 1.5rem 0 1rem; }
.resolver__issuer { color: var(--accent-700); font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.resolver__hero h1 { font-family: var(--font-display); font-size: 1.8rem; line-height: 1.15; margin: .2rem 0 .7rem; }
.resolver__meta { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.trust { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; font-weight: 600; }
.trust--ok { background: var(--accent-soft); color: var(--accent-700); }
.trust--warn { background: var(--amber-soft); color: #92600a; }
.trust--bad { background: var(--danger-soft); color: var(--danger); }
.trust--view { background: var(--surface-2); color: var(--ink-soft); }
.resolver__notice { background: var(--amber-soft); color: #92600a; border-radius: var(--radius-sm); padding: .7rem 1rem; font-size: .88rem; margin-bottom: 1rem; }
.resolver__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: .5rem 1.2rem; }
.resolver__hint { display: flex; gap: .55rem; align-items: flex-start; color: var(--ink-faint); font-size: .82rem; padding: 1rem .3rem 0; }
.resolver__links { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.2rem; font-size: .8rem; color: var(--ink-faint); flex-wrap: wrap; }
.resolver__foot { text-align: center; color: var(--ink-faint); font-size: .78rem; margin-top: 2rem; }
