/* ============================================================
   KONSOLE — enterprise console design system
   Signatur → Interessent · SAP B1 companion
   IBM Plex Sans / IBM Plex Mono · graphite on bone · cobalt
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* neutrals — cool graphite on bone-white */
  --bg:        #F4F5F7;
  --bg-2:      #ECEEF2;
  --surface:   #FFFFFF;
  --surface-2: #FAFBFC;
  --ink:       #11151C;
  --ink-2:     #2C333E;
  --muted:     #5A6472;
  --faint:     #8B95A4;
  --line:      #E4E7EC;
  --line-2:    #D2D7DF;

  /* accent — cobalt (overridable via appearance panel) */
  --accent:     #2348D9;
  --accent-ink: #1A37AD;
  --accent-2:   #EAEEFE;
  --accent-3:   #F4F6FF;

  --ok:    #137a4b;
  --ok-2:  #E3F3EB;
  --warn:  #B5641A;
  --warn-2:#FBEEDD;
  --err:   #C0392B;
  --err-2: #FBE8E5;

  --conf-high: #137a4b;
  --conf-mid:  #B5641A;
  --conf-low:  #C0392B;

  --shadow-xs: 0 1px 2px rgba(17,21,28,.05);
  --shadow-sm: 0 1px 3px rgba(17,21,28,.06), 0 1px 2px rgba(17,21,28,.04);
  --shadow:    0 4px 12px -4px rgba(17,21,28,.10), 0 2px 6px -2px rgba(17,21,28,.06);
  --shadow-lg: 0 18px 48px -16px rgba(17,21,28,.24), 0 6px 16px -8px rgba(17,21,28,.12);
  --shadow-pop: 0 24px 60px -16px rgba(17,21,28,.30);

  --r-sm: 7px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;
  --serif: 'IBM Plex Sans', system-ui, sans-serif;
  --disp: 'IBM Plex Sans', system-ui, sans-serif;

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --pad: 26px;
  --gap: 22px;
}

[data-density="compact"] { --pad: 18px; --gap: 15px; }

*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg);
  font-size: 14.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: #fff; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: var(--accent-ink); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 100px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }

/* ── Shell ── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink); color: #C3C7D0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid #000; z-index: 40;
}
.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
}
/* Gradient mark — cobalt console badge */
.sb-logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(150deg, var(--accent), var(--accent-ink));
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 600; font-size: 17px; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 4px 12px -4px rgba(35,72,217,.7);
}
.sb-brand .nm {
  font-weight: 600; font-size: 14px;
  color: #fff; letter-spacing: -.01em; line-height: 1.15; white-space: nowrap;
}
.sb-brand .nm .k { color: var(--accent); }
.sb-brand .sub { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.35); margin-top: 3px; }

.sb-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sb-sec { font-family: var(--mono); font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase; color: rgba(255,255,255,.28); padding: 14px 12px 7px; }
.sb-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 6px;
  color: rgba(255,255,255,.6); font-size: 13.7px; font-weight: 500; cursor: pointer;
  border: none; background: transparent; text-align: left; width: 100%;
  transition: color .12s; white-space: nowrap;
}
.sb-item svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.sb-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-item.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 14px -4px rgba(26,80,216,.55);
}
.sb-item.active svg { opacity: 1; }
.sb-badge {
  margin-left: auto; font-family: var(--mono); font-size: 10px; font-weight: 600;
  background: rgba(255,255,255,.14); color: #fff; border-radius: 100px; padding: 1px 7px;
}

.sb-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sb-conn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
}
.sb-conn .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sb-conn .dot.up   { background: #34D17E; box-shadow: 0 0 0 3px rgba(52,209,126,.18); }
.sb-conn .dot.down { background: #E5614C; box-shadow: 0 0 0 3px rgba(229,97,76,.18); }
.sb-conn .lbl { font-size: 11.5px; line-height: 1.4; min-width: 0; }
.sb-conn .lbl b { color: #fff; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-conn .lbl span { font-family: var(--mono); font-size: 9.5px; color: rgba(255,255,255,.3); display: block; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.tb-title { font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; white-space: nowrap; flex: none; }
.tb-title .crumb { color: var(--faint); font-weight: 400; }
.tb-spacer { flex: 1; }

/* Company switcher */
.company-switch { position: relative; }
.cs-btn {
  display: flex; align-items: center; gap: 9px; padding: 7px 11px 7px 12px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface);
  cursor: pointer; transition: border-color .14s, box-shadow .14s;
}
.cs-btn:hover { border-color: var(--faint); box-shadow: var(--shadow-xs); }
.cs-ico {
  width: 24px; height: 24px; border-radius: 6px; flex: none; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 600; font-size: 10px; color: #fff; letter-spacing: 0;
}
.cs-meta { text-align: left; line-height: 1.15; }
.cs-meta b { font-size: 12.7px; font-weight: 600; white-space: nowrap; }
.cs-meta span { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--faint); white-space: nowrap; }
.cs-chev { width: 14px; height: 14px; color: var(--faint); }
.cs-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 280px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); padding: 7px; z-index: 50; display: none;
}
.cs-menu.open { display: block; animation: pop .14s ease both; }
.cs-menu .head { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 8px 10px 6px; }
.cs-opt {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  cursor: pointer; width: 100%; border: none; background: transparent; text-align: left;
}
.cs-opt:hover { background: var(--bg); }
.cs-opt b { font-size: 13px; font-weight: 600; display: block; }
.cs-opt span { font-family: var(--mono); font-size: 10px; color: var(--faint); display: block; }
.cs-opt .check { margin-left: auto; color: var(--accent); width: 16px; height: 16px; display: none; }
.cs-opt.selected .check { display: block; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
  cursor: pointer; transition: .14s; flex: none;
}
.icon-btn:hover { border-color: var(--faint); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

.content { flex: 1; overflow-y: auto; }
.page { max-width: 1200px; margin: 0 auto; padding: 30px 28px 60px; }
.page.narrow { max-width: 880px; }

.view { display: none; }
.view.active { display: block; }

/* ── Typography ── */
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -.018em; color: var(--ink); }
h1 { font-family: var(--disp); font-size: 26px; line-height: 1.12; letter-spacing: -.025em; }
h2 { font-family: var(--disp); font-size: 19px; line-height: 1.18; letter-spacing: -.02em; }
h3 { font-size: 15px; }
.eyebrow { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); }
.lede { color: var(--muted); font-size: 14.5px; margin: 0; }
.mono { font-family: var(--mono); }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin-bottom: 5px; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: var(--pad); }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px var(--pad); border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15.5px; }
.card-head .sub { color: var(--faint); font-size: 12.5px; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ── Forms ── */
label.fld {
  display: block; font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px;
}
.input, input[type=text], input[type=password], input:not([type]), select, textarea {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 10px 12px; transition: border-color .14s, box-shadow .14s;
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--faint); }
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-2);
}
textarea { resize: vertical; line-height: 1.55; }
select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235A6472' stroke-width='1.7' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.mono-in { font-family: var(--mono); font-size: 13px; letter-spacing: -.01em; }
.field { display: flex; flex-direction: column; }
.field > label.fld { margin-bottom: 6px; }

/* ── Buttons ── */
.btn {
  font-family: var(--sans); font-weight: 600; font-size: 13.7px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  padding: 10px 18px; border-radius: var(--r); display: inline-flex; align-items: center; gap: 8px;
  transition: transform .1s, box-shadow .15s, background .14s, border-color .14s, color .14s, opacity .14s;
  box-shadow: 0 4px 14px -5px rgba(35,72,217,.55); white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); transform: translateY(-1px); box-shadow: 0 8px 20px -6px rgba(35,72,217,.6); }
.btn:active { transform: translateY(0); }
.btn:disabled { background: var(--bg-2); border-color: var(--line-2); color: var(--faint); cursor: not-allowed; box-shadow: none; transform: none; }
.btn.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: var(--bg); border-color: var(--faint); color: var(--ink); box-shadow: none; }
.btn.subtle { background: var(--accent-2); color: var(--accent-ink); border-color: transparent; box-shadow: none; }
.btn.subtle:hover { background: var(--accent-3); border-color: var(--accent-2); }
.btn.sm { padding: 7px 13px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.lg { padding: 13px 24px; font-size: 15px; }
.btn.block { width: 100%; justify-content: center; }
.btn.danger { background: var(--err); border-color: var(--err); box-shadow: none; }
.btn.danger:hover { background: #a52f23; border-color: #a52f23; }

.linkish { color: var(--accent-ink); font-weight: 500; cursor: pointer; background: none; border: none; padding: 0; font-size: inherit; font-family: inherit; text-decoration: none; }
.linkish:hover { text-decoration: underline; }

/* ── Pills ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 100px; white-space: nowrap;
}
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.lead    { background: var(--accent-2); color: var(--accent-ink); }
.pill.ok      { background: var(--ok-2);   color: var(--ok);   }
.pill.warn    { background: var(--warn-2); color: var(--warn); }
.pill.err     { background: var(--err-2);  color: var(--err);  }
.pill.neutral { background: var(--bg-2);   color: var(--muted); }

.tag-sap {
  font-family: var(--mono); font-size: 10.5px; color: var(--accent-ink);
  background: var(--accent-3); border: 1px solid var(--accent-2); border-radius: 6px; padding: 1px 6px;
}

/* ── Animations ── */
@keyframes pop   { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rise  { from { transform: translateY(14px); } to { transform: none; } }
@keyframes fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes popin { from { transform: scale(.7); } to { transform: scale(1); } }

.rise { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.fade { animation: fade .4s ease both; }
.d1 { animation-delay: .04s; } .d2 { animation-delay: .1s; } .d3 { animation-delay: .16s; }
.d4 { animation-delay: .22s; } .d5 { animation-delay: .28s; }

.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: var(--line-2); border-top-color: var(--accent); }

.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--line) 37%, var(--bg-2) 63%); background-size: 800px 100%; animation: shimmer 1.4s infinite linear; border-radius: 6px; }

/* ── Utilities ── */
.row   { display: flex; align-items: center; gap: 12px; }
.col   { display: flex; flex-direction: column; }
.grow  { flex: 1; }
.divider { height: 1px; background: var(--line); border: none; margin: 0; }
.kbd   { font-family: var(--mono); font-size: 10.5px; background: var(--bg-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid2 .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* ═══ CREATE VIEW ═══ */
.create-grid {
  display: grid; grid-template-columns: minmax(360px, .82fr) 1.18fr;
  gap: var(--gap); align-items: start;
}
@media (max-width: 1080px) { .create-grid { grid-template-columns: 1fr; } }

.sig-card { align-self: start; }
.sig-wrap { border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.sig-area {
  width: 100%; height: 300px; border: none; background: transparent;
  padding: 14px 15px; font-size: 13px; line-height: 1.7; resize: vertical; display: block;
  font-family: var(--mono);
}
.sig-area:focus { outline: none; }
.sig-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 13px; border-top: 1px dashed var(--line-2);
  font-size: 10.5px; color: var(--faint); background: var(--surface);
}

/* Signature map */
.sig-map { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface-2); overflow: hidden; font-size: 12.5px; line-height: 1.6; }
.sig-line { position: relative; padding: 2px 13px 2px 36px; border-left: 3px solid transparent; transition: background .12s, border-color .12s; }
.sig-line.mapped { cursor: default; }
.sig-line.blank { padding-top: 1px; padding-bottom: 1px; }
.sig-ln-num { position: absolute; left: 10px; top: 2px; width: 16px; text-align: right; color: var(--faint); font-size: 10.5px; line-height: 1.6; user-select: none; font-family: var(--mono); }
.sig-ln-txt { display: block; color: var(--ink-2); line-height: 1.6; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); }
.sig-line.hot { background: var(--accent-3); border-left-color: var(--accent); }
.sig-line.hot .sig-ln-txt { color: var(--accent-ink); font-weight: 500; }
.sig-line.hot .sig-ln-num { color: var(--accent); }

/* Empty / loading states */
.record-card { min-height: 400px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 400px; text-align: center; padding: 40px; gap: 6px; }
.empty-ico { width: 58px; height: 58px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); margin-bottom: 16px; }
.empty-ico svg { width: 26px; height: 26px; }
.load-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: var(--pad); }
.load-row { display: flex; flex-direction: column; gap: 7px; }

/* Confidence summary */
.conf-summary {
  display: flex; align-items: center; gap: 24px;
  padding: 15px var(--pad); background: linear-gradient(180deg, var(--accent-3), var(--surface));
  border-bottom: 1px solid var(--line);
}
.cs-stat { display: flex; align-items: center; gap: 11px; }
.cs-stat b { font-size: 14px; display: block; line-height: 1.2; }
.cs-stat .mono { font-size: 10.5px; color: var(--faint); }
.cs-meter { flex: 1; max-width: 300px; margin-left: auto; }
.meter-track { height: 7px; border-radius: 100px; background: var(--bg-2); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--conf-high), #1aa063); transform-origin: left; transition: width .4s ease; }
.cs-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 10.5px; color: var(--muted); font-family: var(--mono); }
.cs-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cs-legend .d { width: 7px; height: 7px; border-radius: 50%; }

/* Field rows */
.cfields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.cfield { display: flex; flex-direction: column; gap: 6px; border-radius: var(--r); transition: background .12s, box-shadow .12s; padding: 2px; }
.cfield.wide { grid-column: 1 / -1; }
.cfield.hot { background: var(--accent-3); box-shadow: 0 0 0 5px var(--accent-3), 0 0 0 6px var(--accent-2); }
.cfield.invalid .input, .cfield.invalid input { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-2); }
.cf-top { display: flex; align-items: center; gap: 8px; }
.cf-ico { width: 24px; height: 24px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); flex: none; }
.cf-ico svg { width: 14px; height: 14px; }
.cf-top .fld { flex: 1; margin: 0; }
.cf-conf { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 9.5px; font-weight: 500; padding: 2px 7px; border-radius: 100px; white-space: nowrap; }
.cf-conf .d { width: 6px; height: 6px; border-radius: 50%; }
.cf-conf.ok   { background: var(--ok-2);   color: var(--ok);   }
.cf-conf.warn { background: var(--warn-2); color: var(--warn); }
.cf-conf.err  { background: var(--err-2);  color: var(--err);  }
.cf-src { font-size: 10.5px; color: var(--faint); display: flex; align-items: center; gap: 5px; font-style: italic; padding-left: 2px; min-width: 0; }
.cf-src .src-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-err { font-size: 10.5px; color: var(--err); display: flex; align-items: center; gap: 5px; padding-left: 2px; }
.cf-merge { display: inline-flex; align-items: center; font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: .03em; padding: 2px 8px; border-radius: 100px; text-transform: lowercase; white-space: nowrap; }
.cf-merge.neu     { background: var(--ok-2);   color: var(--ok);   }
.cf-merge.changed { background: var(--warn-2); color: var(--warn); }

/* Duplicate banner */
.dup-banner { display: flex; gap: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--warn-2); border: 1px solid #EBC79A; }
.dup-ico { width: 34px; height: 34px; border-radius: 9px; background: #F3D7A8; color: #92561a; display: grid; place-items: center; flex: none; }
.dup-ico svg { width: 18px; height: 18px; }
.dup-title { font-weight: 600; font-size: 13.5px; color: #8a5316; }
.dup-body { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.dup-match { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 9px 12px; background: var(--surface); border: 1px solid #EBC79A; border-radius: 9px; flex-wrap: wrap; }
.dup-match .code { font-size: 11px; font-family: var(--mono); background: var(--bg-2); padding: 2px 7px; border-radius: 5px; color: var(--muted); }
.dup-match b { font-size: 13px; }
.dup-match .mail { font-size: 11px; font-family: var(--mono); color: var(--faint); margin-left: auto; }
.dup-actions { display: flex; gap: 10px; margin-top: 13px; flex-wrap: wrap; }
.dup-ack { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ok); background: var(--ok-2); padding: 8px 12px; border-radius: 9px; font-family: var(--mono); }
.merge-ack { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--warn-2); border: 1px solid #EBC79A; color: var(--ink-2); font-size: 13px; }
.merge-ack b { color: #8a5316; }
.btn.merge-btn { background: var(--warn); border-color: var(--warn); box-shadow: 0 4px 14px -5px rgba(181,100,26,.5); }
.btn.merge-btn:hover { background: #9a5415; border-color: #9a5415; }

/* Master defaults */
.master-block { display: flex; flex-direction: column; gap: 14px; }
.mb-head { display: flex; align-items: center; justify-content: space-between; }
.master-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }

/* Create bar */
.createbar { display: flex; align-items: flex-end; gap: 18px; }
.validate-note { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--err); font-weight: 500; }

/* Result / banner */
.result-banner { padding: 10px 14px; border-radius: var(--r); font-size: 13px; display: flex; align-items: center; gap: 9px; font-family: var(--mono); min-height: 20px; }
.result-banner.ok { background: var(--ok-2); color: var(--ok); }
.result-banner.err { background: var(--err-2); color: var(--err); }

/* Success state */
.success-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 40px; min-height: 440px; }
.success-ring { width: 80px; height: 80px; animation: popin .5s cubic-bezier(.2,.9,.3,1.2) both; }
.success-svg { width: 80px; height: 80px; }
.sc-ring { fill: none; stroke: var(--ok); stroke-width: 2.5; opacity: .25; }
.sc-check { fill: none; stroke: var(--ok); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 0; }
.success-code { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); }
.success-code .lbl { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-family: var(--mono); }
.success-code .val { font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: .01em; font-family: var(--mono); }

/* ═══ SETUP VIEW ═══ */
.setup-layout { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .setup-layout { grid-template-columns: 1fr; } }
.setup-nav { position: sticky; top: calc(var(--topbar-h) + 24px); display: flex; flex-direction: column; gap: 2px; }
.setup-nav button {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  border: none; background: transparent; text-align: left; cursor: pointer;
  color: var(--muted); font-size: 13.5px; font-weight: 500; width: 100%;
  transition: color .12s;
}
.setup-nav button svg { width: 16px; height: 16px; flex: none; }
.setup-nav button:hover { background: var(--bg-2); color: var(--ink); }
.setup-nav button.on { background: var(--accent-2); color: var(--accent-ink); font-weight: 600; }

.setup-sec + .setup-sec { margin-top: 20px; }

/* Company list */
.comp-row-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 14px 10px; border: none; background: transparent; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .14s;
}
.comp-row-btn:last-child { border-bottom: none; }
.comp-row-btn:hover { background: var(--accent-3); }
.comp-row-btn b { display: block; font-size: 14.5px; }
.comp-row-meta { font-size: 11px; color: var(--faint); font-family: var(--mono); }

/* Company detail */
.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer;
  border: none; background: transparent; padding: 0; margin-bottom: 14px;
  transition: color .14s;
}
.back-link:hover { color: var(--accent-ink); }
.back-link svg { width: 15px; height: 15px; }
.comp-detail-head { display: flex; align-items: center; gap: 14px; padding: 20px var(--pad); }
.comp-detail-head h2 { margin-bottom: 2px; }

/* Detail tabs */
.detail-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 16px 0 20px; }
.detail-tab {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px;
  border: none; background: transparent; cursor: pointer; font-size: 13.5px; font-weight: 500;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .12s; white-space: nowrap;
}
.detail-tab svg { width: 15px; height: 15px; }
.detail-tab:hover { color: var(--ink); }
.detail-tab.on { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* Mapping table */
.map-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); }
.maptable { width: 100%; border-collapse: collapse; min-width: 640px; }
.maptable thead th {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); font-weight: 500; text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.maptable td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.maptable tr:last-child td { border-bottom: none; }
.maptable tr.off td { opacity: .4; }
.maptable tr:hover td { background: var(--bg); }
.cell {
  width: 100%; border: 1px solid transparent; background: transparent;
  border-radius: 7px; padding: 7px 9px; font-size: 13px; transition: .15s;
}
.cell:hover { background: var(--surface); border-color: var(--line); }
.cell:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
.c-key { font-family: var(--mono); font-size: 12.5px; }
.c-target { font-family: var(--mono); font-size: 12.5px; color: var(--accent-ink); }
.cbx { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.rowdel { border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 7px; width: 28px; height: 28px; cursor: pointer; display: grid; place-items: center; transition: .15s; }
.rowdel:hover { border-color: var(--err); color: var(--err); background: var(--err-2); }
.rowdel svg { width: 14px; height: 14px; }

/* UDF chips */
.udf-block { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.udf-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.udf-head svg { width: 15px; height: 15px; color: var(--accent-ink); }
.udf-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.udf-chip {
  font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 100px; padding: 5px 12px; cursor: pointer; color: var(--accent-ink);
  display: inline-flex; align-items: center; gap: 7px; transition: .14s;
}
.udf-chip:hover { border-color: var(--accent); background: var(--accent-2); }
.udf-chip .p { color: var(--faint); font-weight: 600; }

/* ═══ HISTORY VIEW ═══ */
.history-table { width: 100%; border-collapse: collapse; }
.history-table th { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; background: var(--bg); }
.history-table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: var(--accent-3); }
.h-code { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.h-name { font-weight: 500; }
.h-sub  { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.h-when { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ═══ ONBOARDING VIEW ═══ */
.ob-wrap { max-width: 720px; margin: 0 auto; }
.ob-rail { display: flex; gap: 0; margin-bottom: 28px; }
.ob-step { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-right: 12px; position: relative; }
.ob-step .bar { height: 4px; border-radius: 100px; background: var(--line-2); transition: background .3s; }
.ob-step.done .bar { background: var(--ok); }
.ob-step.active .bar { background: var(--accent); }
.ob-step .lab { display: flex; align-items: center; gap: 8px; }
.ob-step .num {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  background: var(--bg-2); color: var(--muted); border: 1px solid var(--line-2);
}
.ob-step.active .num { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-2); }
.ob-step.done .num { background: var(--ok); color: #fff; border-color: var(--ok); }
.ob-step .lab span { font-size: 12px; font-weight: 500; color: var(--muted); }
.ob-step.active .lab span { color: var(--ink); font-weight: 600; }
.ob-panel { padding: var(--pad); }
.ob-hero { text-align: center; padding: 16px 0 6px; }
.ob-hero .glyph { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 18px; background: linear-gradient(150deg, var(--accent), var(--accent-ink)); display: grid; place-items: center; color: #fff; box-shadow: 0 16px 40px -12px rgba(35,72,217,.6); }
.ob-hero .glyph svg { width: 34px; height: 34px; }
.ob-nav { display: flex; align-items: center; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.ob-split { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 760px) { .ob-split { grid-template-columns: 1fr; } }
.ob-aside { background: var(--bg); border-radius: var(--r-lg); padding: 22px; border: 1px solid var(--line); }
.ob-aside h4 { font-size: 12px; font-family: var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 12px; }
.ob-aside ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.ob-aside li { display: flex; gap: 10px; font-size: 13px; color: var(--ink-2); }
.ob-aside li svg { width: 16px; height: 16px; color: var(--accent); flex: none; margin-top: 2px; }
.field-stack { display: flex; flex-direction: column; gap: 14px; }
.test-result { margin-top: 14px; padding: 12px 14px; border-radius: var(--r); font-size: 13px; display: flex; align-items: center; gap: 9px; }
.test-result.ok  { background: var(--ok-2);  color: var(--ok);  }
.test-result.err { background: var(--err-2); color: var(--err); }
.test-result.run { background: var(--bg);    color: var(--muted); }
.seg { display: inline-flex; background: var(--bg-2); border-radius: var(--r); padding: 3px; gap: 3px; }
.seg button { border: none; background: transparent; padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; transition: .14s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page { padding: 20px 16px 40px; }
}
@media (max-width: 640px) {
  .create-grid, .cfields-grid, .master-grid { grid-template-columns: 1fr; }
  .cfield.wide { grid-column: 1; }
}

/* ═══ APPEARANCE PANEL (Darstellung anpassen) ═══ */
.tweaks-scrim {
  position: fixed; inset: 0; background: rgba(17,21,28,.32);
  opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 60;
}
.tweaks-scrim.open { opacity: 1; pointer-events: auto; }
.tweaks-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 320px; max-width: 86vw;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop); z-index: 61;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.2,.7,.2,1);
  display: flex; flex-direction: column;
}
.tweaks-panel.open { transform: none; }
.tweaks-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px var(--pad); border-bottom: 1px solid var(--line);
}
.tweaks-head .ttl { font-weight: 600; font-size: 15px; }
.tweaks-head .sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); display: block; margin-top: 2px; }
.tweaks-head .x { margin-left: auto; }
.tweaks-body { padding: var(--pad); display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.tweaks-sec { font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tw-swatches { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.tw-swatch {
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; flex: none;
  border: 2px solid transparent; position: relative; transition: transform .12s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.tw-swatch:hover { transform: translateY(-2px); }
.tw-swatch.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--bg), inset 0 1px 0 rgba(255,255,255,.25); }
.tw-swatch.on::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
