/* QCS-Personalportal – Oberfläche (mobil zuerst) */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #16212b;
  --muted: #5b6876;
  --line: #d8dee5;
  --brand: #0b4f6c;
  --brand-strong: #083c52;
  --brand-soft: #e3eff4;
  --ok: #1d6b3a;
  --ok-soft: #e4f3e9;
  --warn: #8a5a00;
  --warn-soft: #fdf2d8;
  --error: #a32020;
  --error-soft: #fbe6e6;
  --radius: 10px;
  --nav-height: 60px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
}

body.signed-in { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }

a { color: var(--brand); }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }

.muted { color: var(--muted); }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: .5rem; top: .5rem; background: var(--surface); padding: .5rem; z-index: 20; }

:focus-visible { outline: 3px solid #f0a202; outline-offset: 2px; }

/* Kopfzeile */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1rem;
  padding-top: calc(.6rem + env(safe-area-inset-top));
  background: var(--brand);
  color: #fff;
}

.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 600; }
.brand-mark {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px;
  background: #fff; color: var(--brand); font-weight: 800;
}

.logout { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.whoami { font-size: .9rem; opacity: .9; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Navigation: am Handy als Leiste unten, am PC in der Kopfzeile */
.mainnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.mainnav a {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  color: var(--muted); text-decoration: none; font-size: .72rem;
}
.mainnav a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.icon { width: 1.5rem; height: 1.5rem; }

main { max-width: 60rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
main:focus { outline: none; }

/* Bausteine */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.card-narrow { max-width: 26rem; margin: 1rem auto; }

.stack { display: flex; flex-direction: column; gap: .5rem; }
.stack label { font-weight: 600; margin-top: .5rem; }
.stack label small { font-weight: 400; color: var(--muted); }
.stack .btn { margin-top: 1rem; }

input[type="text"], input[type="password"], input[type="date"], input[type="month"], input[type="time"],
input[type="datetime-local"], input[type="file"], select, textarea {
  width: 100%;
  font: inherit;
  padding: .65rem .75rem;
  min-height: 2.75rem;
  border: 1px solid #9aa7b4;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: .55rem 1rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  color: var(--brand); background: var(--surface);
  border: 1px solid var(--brand); border-radius: 8px;
}
.btn:hover { background: var(--brand-soft); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-danger { color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-soft); }
.btn-quiet { min-height: 2.25rem; padding: .3rem .75rem; color: #fff; background: transparent; border-color: rgba(255, 255, 255, .6); }
.btn-quiet:hover { background: rgba(255, 255, 255, .15); }
.btn-small { min-height: 2.25rem; padding: .3rem .7rem; font-size: .9rem; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

.notice { padding: .75rem 1rem; border-radius: 8px; border: 1px solid transparent; margin: 0 0 1rem; }
.notice-ok { background: var(--ok-soft); border-color: #b6dcc3; color: var(--ok); }
.notice-info { background: var(--brand-soft); border-color: #bcd6e0; color: var(--brand-strong); }
.notice-warn { background: var(--warn-soft); border-color: #ecd49a; color: var(--warn); }
.notice-error { background: var(--error-soft); border-color: #eab9b9; color: var(--error); }

.tiles { display: grid; gap: .75rem; margin-top: 1rem; }
.tile {
  display: block; padding: 1rem 1.1rem; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.tile:hover { border-color: var(--brand); }
.tile h2 { margin: 0 0 .25rem; color: var(--brand); }
.tile p { margin: 0; color: var(--muted); }

.facts { display: grid; grid-template-columns: 1fr; gap: .1rem 1rem; margin: 1rem 0; }
.facts dt { color: var(--muted); font-size: .85rem; margin-top: .6rem; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--brand-soft); color: var(--brand-strong); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error { background: var(--error-soft); color: var(--error); }

.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.15rem;
  padding: .6rem .8rem; background: #fff; border: 1px dashed var(--warn); border-radius: 8px;
  user-select: all; overflow-wrap: anywhere;
}

/* Listen: am Handy als Karten, am PC als Tabelle */
.list { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: .6rem; }
.list > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.list a.row-link { font-weight: 600; text-decoration: none; }
.list .meta { color: var(--muted); font-size: .9rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }

.subnav { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 1rem; }
.subnav a { padding: .4rem .8rem; border-radius: 999px; text-decoration: none; border: 1px solid var(--line); background: var(--surface); }
.subnav a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.grid-2 { display: grid; gap: 1rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: .5rem 0; }
legend { font-weight: 600; padding: 0 .35rem; }
.check { display: flex; align-items: center; gap: .5rem; min-height: 2.5rem; font-weight: 400; margin: 0; }
.check input { width: 1.2rem; height: 1.2rem; }

@media (min-width: 48rem) {
  body.signed-in { padding-bottom: 0; }
  .mainnav { position: static; height: auto; padding: 0; background: transparent; border: 0; gap: .25rem; flex: 0 1 auto; }
  .mainnav a { flex: none; flex-direction: row; gap: .4rem; padding: .45rem .8rem; border-radius: 8px; color: #dbe9ef; font-size: .95rem; }
  .mainnav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .16); }
  .mainnav .icon { width: 1.15rem; height: 1.15rem; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .facts { grid-template-columns: 12rem 1fr; }
  .facts dt { margin-top: 0; font-size: 1rem; }
  .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; }
  h1 { font-size: 1.75rem; }
}

[hidden] { display: none !important; }
.card > h1:first-child, .card > h2:first-child { margin-top: 0; }
