/* Lizenzserver – Oberfläche */
:root {
  --bg: #f4f5f7; --surface: #fff; --line: #e3e5ea; --line-strong: #8b919c; --ink: #15171c; --ink-2: #3b404a; --muted: #5b616c;
  --brand: #3337c9; --brand-hover: #2a2eaa; --brand-soft: #e9eafc; --ok: #146c34; --ok-bg: #e5f5ea; --warn: #8a4b00; --warn-bg: #fdf1dc;
  --grace: #9a3a00; --grace-bg: #ffe9d9; --bad: #b3261e; --bad-bg: #fdeceb; --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif; color: var(--ink); background: var(--bg); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
p { margin: 0 0 .8rem; }
a { color: var(--brand); }
code, pre, .key { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin: .3rem 0 0; }
.opt { font-weight: 400; color: var(--muted); }
.center { text-align: center; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -100px; z-index: 10; background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px; }
.skip:focus { top: 1rem; }

/* Grundgerüst */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1rem 1.1rem; }
.sidebar .brand { border-bottom: 1px solid var(--line); }
.brand strong { display: block; font-size: 1rem; }
.brand small { display: block; color: var(--muted); font-size: .82rem; }
.brand-mark { width: 40px; height: 40px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; flex: none; }
.sidebar ul { list-style: none; margin: 0; padding: .7rem .35rem; display: grid; gap: .2rem; }
.sidebar nav a { display: block; padding: .6rem .85rem; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.sidebar nav a:hover { background: #f1f2f5; color: var(--ink); }
.sidebar nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: .9rem 1rem 1rem; }
.who { margin: 0 0 .4rem; font-size: .85rem; }
.who strong, .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; cursor: pointer; }
.linkbtn:hover { color: var(--bad); }
.content { padding: 2rem 2.25rem 4rem; max-width: 1120px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-head .muted { margin: .35rem 0 0; }
.back { margin: 0 0 .6rem; font-size: .9rem; }
.back a { color: var(--muted); }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.35rem; margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.highlight { border-color: #c5c7f4; box-shadow: inset 4px 0 0 var(--brand); }
.form-card { max-width: 52rem; }
.danger-zone { border-color: #f2c3bf; }
.cards4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.2rem; }
.stat { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem 1.15rem; margin: 0; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--line-strong); }
.stat.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.stat .label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.stat .val { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat .val.small { font-size: 1.02rem; font-weight: 600; overflow-wrap: anywhere; }
.stat.warn .val { color: var(--warn); } .stat.grace .val { color: var(--grace); } .stat.bad .val { color: var(--bad); }
.sub { display: block; font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.warn-text { color: var(--warn); font-weight: 600; }

/* Tabelle */
.toolbar { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; padding: .75rem .9rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input { max-width: 18rem; min-height: 38px; }
.toolbar .btn { min-height: 38px; padding: .35rem .9rem; }
.chip { margin-right: auto; background: var(--brand-soft); color: var(--brand); padding: .25rem .4rem .25rem .7rem; border-radius: 99px; font-size: .85rem; font-weight: 600; display: inline-flex; gap: .35rem; align-items: center; }
.chip a { text-decoration: none; font-size: 1.1rem; line-height: 1; padding: 0 .3rem; border-radius: 99px; }
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .85rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table thead th { font-size: .8rem; font-weight: 600; color: var(--ink-2); background: #fafbfc; white-space: nowrap; }
.card:not(.flush) .table thead th { background: none; padding-top: .3rem; }
.table tbody tr:hover { background: #fafbff; }
.row-warn td { background: #fffaf2; }
.cust { display: block; font-weight: 700; color: var(--ink); text-decoration: none; margin-bottom: .3rem; }
.cust:hover { color: var(--brand); text-decoration: underline; }
.keychip { display: inline-block; font-size: .78rem; background: #f0f1f4; border-radius: 5px; padding: .1rem .45rem; color: var(--ink-2); letter-spacing: .02em; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem !important; }
.pill { display: inline-block; font-size: .8rem; font-weight: 700; padding: .12rem .6rem; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.grace { background: var(--grace-bg); color: var(--grace); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
h1 .pill { font-size: .85rem; }

/* Formulare */
.field { margin-bottom: .95rem; }
.field label, .check { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .92rem; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: .5rem .7rem; min-height: 42px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid var(--brand-soft); outline-offset: 0; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; min-height: 0; vertical-align: -3px; margin: 0 .45rem 0 0; accent-color: var(--brand); }
input[type="file"] { padding: .4rem; }
.check { font-weight: 500; margin: .2rem 0 .9rem; }
.code-input { font: 600 1.35rem ui-monospace, monospace; letter-spacing: .25em; text-align: center; max-width: 14rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.grid2 > .card { margin-bottom: 1rem; }
.span2 { grid-column: 1 / -1; }
.row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.row .field { margin-bottom: 0; }
.row .grow { flex: 1 1 16rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .3rem; }
.stack .field { margin-bottom: .85rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px; padding: .5rem 1.05rem; font: 600 .95rem system-ui, sans-serif; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f4f5f8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.small { min-height: 32px; padding: .2rem .65rem; font-size: .85rem; }
.btn.block { width: 100%; }

.flash { background: var(--ok-bg); border: 1px solid #9fd3b0; color: #0f4d26; padding: .75rem 1rem; border-radius: 8px; font-weight: 600; margin-bottom: 1.1rem; }
.flash.err { background: var(--bad-bg); border-color: #f0b4ae; color: #8c1d17; }
.flash.warn { background: var(--warn-bg); border-color: #f0cf94; color: #6b3a00; font-weight: 500; }
.flash p { margin: 0 0 .5rem; }
.keyline { margin: .5rem 0 0; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.key { font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; background: #f0f1f4; padding: .2rem .55rem; border-radius: 6px; user-select: all; }
pre { background: #15171c; color: #eef0f4; padding: 1rem; border-radius: 8px; white-space: pre-wrap; word-break: break-all; font-size: .85rem; }
details summary { cursor: pointer; color: var(--brand); font-weight: 600; margin-top: .6rem; }
details.add { margin-top: 1rem; }
details.add form { margin-top: .9rem; }
.inline-details summary { margin: 0; font-size: .9rem; color: var(--bad); }
.inline-details form { margin-top: .5rem; }
.codes { display: grid; grid-template-columns: repeat(4, max-content); gap: .4rem 1rem; list-style: none; padding: 0; margin: .4rem 0 0; }
.codes code { font-size: 1rem; font-weight: 700; }
.tfa { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.tfa img { border: 1px solid var(--line); border-radius: 8px; }
.tfa ol { margin: 0 0 .8rem; padding-left: 1.2rem; }

/* Anmeldeseiten */
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 26rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem 1.75rem 1.75rem; box-shadow: 0 20px 50px -30px rgba(20, 24, 40, .35); }
.auth-card .brand { padding: 0 0 1.2rem; margin-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.auth-card h1 { font-size: 1.35rem; margin-bottom: .6rem; }

/* Mobil */
@media (max-width: 64rem) {
  .cards4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 48rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); min-width: 0; }
  .sidebar nav { min-width: 0; }
  .sidebar .brand { border-bottom: 0; padding-bottom: .4rem; }
  .sidebar ul { display: flex; overflow-x: auto; padding: .3rem .6rem .6rem; gap: .25rem; }
  .sidebar nav a { white-space: nowrap; padding: .5rem .75rem; }
  .sidebar-foot { position: absolute; top: .9rem; right: 1rem; border: 0; padding: 0; text-align: right; }
  .who { display: none; }
  .content { padding: 1.25rem 1rem 3rem; }
  .grid2 { grid-template-columns: 1fr; }
  .codes { grid-template-columns: repeat(2, max-content); }
  .table.lic thead, .card.flush .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table.lic tr, .card.flush .table tr { display: block; padding: .8rem .9rem; border-bottom: 1px solid var(--line); }
  .table.lic td, .card.flush .table td { display: block; position: relative; padding: .25rem 0 .25rem 7.5rem; border: 0; min-height: 1.9rem; }
  .table.lic td::before, .card.flush .table td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: .3rem; width: 7rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
  .card.flush .table.lic td:first-child { padding-left: 0; margin-bottom: .3rem; }
  .card.flush .table.lic td:first-child::before { content: none; }
  .card.flush .table td:not([data-label]) { padding-left: 0; }
  .toolbar input { max-width: none; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (forced-colors: active) { .pill, .btn, .card { border: 1px solid CanvasText; } }
