/* =========================================================================
   KIVENTIS Demos – dichtes ERP-Interface
   Scharfkantig (0 Radius), keine Schatten, 26 px Zeilenhöhe,
   Zahlen in tabular-nums, Rohdaten in JetBrains Mono.
   ========================================================================= */

:root {
  --paper: #f6f3ec;
  --paper-2: #efeade;
  --white: #fffdf8;
  --ink: #16181c;
  --ink-2: #2b2f35;
  --muted: #5c626b;
  --rule: #d7d0c1;
  --rule-strong: #b9b1a0;
  --accent: #0e5d54;
  --accent-ink: #0b4a43;
  --accent-soft: #e3ece9;
  --alert: #93401f;
  --alert-soft: #f6e7de;
  --warn: #7a5a12;
  --warn-soft: #f5ecd6;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

p {
  margin: 0;
}

/* ---------- Kopfzeile ---------------------------------------------------- */

.appbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  min-height: 46px;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid #000;
}

.appbar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  white-space: nowrap;
}

.appbar__brand img {
  width: 20px;
  height: 20px;
  display: block;
}

.appbar__sep {
  width: 1px;
  height: 20px;
  background: #3a3d43;
  flex: none;
}

.appbar h1,
.appbar__title {
  font-size: 13.5px;
  font-weight: 500;
  color: #e8e2d6;
  letter-spacing: 0.01em;
}

.appbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: #b6b0a4;
}

.appbar__right a {
  color: #e8e2d6;
  text-decoration: none;
  border-bottom: 1px solid #4a4d53;
}

.appbar__right a:hover {
  border-bottom-color: #e8e2d6;
}

@media (max-width: 860px) {
  .appbar {
    gap: 10px;
    padding: 0 10px;
  }
  .appbar h1 {
    font-size: 12.5px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .appbar__right > span {
    display: none;
  }
  .pane__body {
    padding-inline: 10px;
  }
}

/* ---------- Werkzeugleiste ---------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 22px;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--rule-strong);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.field > span {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.field select,
.field input[type="text"],
.field input[type="date"],
.field input[type="number"] {
  font: inherit;
  font-size: 13px;
  padding: 4px 6px;
  min-height: 28px;
  border: 1px solid var(--rule-strong);
  background: var(--white);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: flex-end;
}

.btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.btn--ghost {
  background: var(--white);
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn--ghost:hover {
  background: var(--paper-2);
  border-color: var(--ink);
  color: var(--ink);
}

.btn kbd,
.keyhint kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: inherit;
  opacity: 0.85;
}

.btn--ghost kbd {
  border-color: var(--rule-strong);
}

/* ---------- Arbeitsfläche ------------------------------------------------ */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  min-height: calc(100vh - 46px - 132px);
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

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

.pane + .pane {
  border-left: 1px solid var(--rule-strong);
}

@media (max-width: 1100px) {
  .pane + .pane {
    border-left: 0;
    border-top: 1px solid var(--rule-strong);
  }
}

.pane__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.pane__head strong {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.13em;
}

.pane__head .count {
  margin-left: auto;
  font-family: var(--mono);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-2);
}

.pane__body {
  padding: 14px 16px 18px;
  overflow: auto;
}

/* ---------- Belegliste --------------------------------------------------- */

.docs {
  border-top: 1px solid var(--rule-strong);
}

.doc {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-top: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.doc:hover {
  background: var(--paper-2);
}

.doc[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.doc__bar {
  align-self: stretch;
  background: var(--rule-strong);
}

.doc[aria-selected="true"] .doc__bar {
  background: var(--accent);
}

.doc__title {
  font-weight: 600;
  font-size: 13px;
}

.doc__meta {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}

.doc__sum {
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: right;
}

.doc__sum small {
  display: block;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Tabellen ----------------------------------------------------- */

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.grid caption {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 0 6px;
}

table.grid thead th {
  position: sticky;
  top: 0;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule-strong);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  padding: 5px 8px;
  white-space: nowrap;
  z-index: 1;
}

table.grid tbody td {
  height: 26px;
  padding: 2px 8px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.grid tbody tr:nth-child(even) td {
  background: #fbf9f4;
}

table.grid tbody tr.is-selected td {
  background: var(--accent-soft);
}

table.grid tbody tr.is-error td {
  background: var(--alert-soft);
}

table.grid td.num,
table.grid th.num {
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
}

table.grid td.mono {
  font-family: var(--mono);
}

table.grid td.editable {
  cursor: text;
}

table.grid td.editable input {
  width: 100%;
  font: inherit;
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
  padding: 1px 3px;
  border: 1px solid var(--accent);
  background: var(--white);
}

/* ---------- Badges ------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid;
  white-space: nowrap;
}

.badge--ok {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.badge--warn {
  color: var(--warn);
  border-color: #d9c18a;
  background: var(--warn-soft);
}

.badge--err {
  color: var(--alert);
  border-color: #d9a58c;
  background: var(--alert-soft);
}

.badge--mute {
  color: var(--muted);
  border-color: var(--rule-strong);
  background: var(--paper-2);
}

/* ---------- Inspektor ---------------------------------------------------- */

.inspector {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #12141a;
  color: #d9d4c8;
  min-height: 0;
}

.inspector__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: #0b0d11;
  border-bottom: 1px solid #262a31;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8f9299;
}

.inspector__bar .legend {
  margin-left: auto;
  display: flex;
  gap: 12px;
  letter-spacing: 0;
  text-transform: none;
  font-size: 10.5px;
}

.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  vertical-align: middle;
}

.inspector__body {
  flex: 1;
  overflow: auto;
  padding: 10px 0 40px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  min-height: 240px;
  max-height: 62vh;
}

.line {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  padding-right: 14px;
  white-space: pre;
}

.line:hover {
  background: #1b1f27;
}

.line__no {
  text-align: right;
  color: #5b6068;
  user-select: none;
  padding-right: 6px;
  border-right: 1px solid #262a31;
}

.line__txt {
  overflow-x: auto;
  scrollbar-width: none;
}

.line__txt::-webkit-scrollbar {
  display: none;
}

.t-bgr,
.t-bvd00,
.t-bkk {
  color: #7fd1c2;
}

.t-bbk,
.t-bvd01,
.t-edi {
  color: #d8c48a;
}

.t-bbs,
.t-bvd02 {
  color: #c9c3b6;
}

.t-seg {
  color: #c39b7a;
}

.t-skipped {
  color: #6a6f78;
  font-style: italic;
}

.inspector__empty {
  padding: 18px;
  color: #6a6f78;
  font-family: var(--sans);
  font-size: 12.5px;
}

/* ---------- Statusleiste ------------------------------------------------- */

.statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  padding: 8px 16px;
  background: var(--paper-2);
  border-top: 1px solid var(--rule-strong);
  font-size: 11.5px;
  color: var(--muted);
}

.statusbar .kpi {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.statusbar .kpi b {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
}

.statusbar .state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Meldungen ---------------------------------------------------- */

.messages {
  margin-top: 12px;
  border-top: 1px solid var(--rule-strong);
  font-size: 12px;
}

.msg {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--rule);
}

.msg__icon {
  font-weight: 700;
  text-align: center;
}

.msg--err .msg__icon {
  color: var(--alert);
}

.msg--warn .msg__icon {
  color: var(--warn);
}

.msg--ok .msg__icon {
  color: var(--accent);
}

.msg code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--paper-2);
  padding: 0 3px;
}

/* ---------- Hilfen ------------------------------------------------------- */

.keyhints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 6px 16px 8px;
  font-size: 11px;
  color: var(--muted);
  background: var(--white);
  border-top: 1px solid var(--rule);
}

.keyhints kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  border: 1px solid var(--rule-strong);
  background: var(--paper-2);
  padding: 1px 5px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  max-width: 68ch;
}

.section-title {
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 6px;
}

/* ---------- Detailkarte (Konditionen) ------------------------------------ */

.detail {
  border: 1px solid var(--rule-strong);
  background: var(--white);
  padding: 12px;
  margin-top: 12px;
}

.detail dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 14px;
  margin: 0;
  font-size: 12.5px;
}

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

.detail dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Ergänzungen aus den Demos ------------------------------------ */

.summary-toggle {
  cursor: pointer;
}

.swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  vertical-align: middle;
}

.swatch--head {
  background: #7fd1c2;
}

.swatch--pos {
  background: #c9c3b6;
}

.grid--tight {
  margin-top: 8px;
}

.hint--tight {
  margin-top: 8px;
}

.hint--wide {
  margin-top: 24px;
}

.section-title--first {
  margin-top: 0;
}

.text-missing {
  color: #93401f;
}
