:root {
  --bg0: #0e1217;
  --bg1: #171d26;
  --ink: #f4efe6;
  --ink-soft: #b7b0a4;
  --line: rgba(244, 239, 230, 0.12);
  --orange: #e8683a;
  --amber: #e8a54b;
  --teal: #3ecfbf;
  --rose: #e36b6b;
  --ok: #6bcf8e;
  --warn: #e8a54b;
  --bad: #e36b6b;
  --panel: color-mix(in srgb, var(--bg1) 88%, #000);
  --radius: 18px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", var(--font);
  --max: 1080px;
  --pad: clamp(1rem, 3vw, 1.75rem);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font);
  background: var(--bg0);
}

body {
  position: relative;
  line-height: 1.5;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(232, 165, 75, 0.18), transparent 60%),
    radial-gradient(800px 480px at 100% 0%, rgba(62, 207, 191, 0.12), transparent 55%),
    linear-gradient(165deg, #141a22 0%, #0e1217 48%, #10161d 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  pointer-events: none;
}

.top {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.1rem var(--pad) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
}

/* App-Mark: goldene 3D-Fläche + rote Spitze */
.app-mark {
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  display: block;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--line), 0 8px 22px rgba(0, 0, 0, 0.4);
}

.brand-text {
  display: grid;
  gap: 0.12rem;
  line-height: 1.15;
}

.brand-text strong {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.company-lockup {
  --company-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32em;
  font-size: var(--company-size);
  line-height: 1;
}

/* Firmen-Mark = gleiche Höhe wie LINDIC.NET-Schrift */
.lindic-mark {
  --s: 1em;
  position: relative;
  display: block;
  width: var(--s);
  height: var(--s);
  flex: 0 0 auto;
  transform: rotate(45deg);
}

.lindic-mark::before {
  position: absolute;
  inset: 12%;
  border: 0.12em solid var(--ink-soft);
  content: "";
}

.lindic-mark i {
  position: absolute;
  width: 0.22em;
  height: 0.22em;
  background: var(--orange);
}

.lindic-mark i:first-child { top: 0; left: calc(50% - 0.11em); }
.lindic-mark i:nth-child(2) { right: 0; bottom: calc(50% - 0.11em); }
.lindic-mark i:last-child { bottom: 0; left: calc(50% - 0.11em); }

.brand-text small,
.company-lockup .lindic-lockup,
.top-tag,
.muted,
.hint {
  color: var(--ink-soft);
}

.company-lockup .lindic-lockup {
  font-size: inherit;
  line-height: 1;
}

.lindic-lockup {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lindic-lockup span,
.brand-text .lindic-lockup span {
  color: var(--orange);
  margin-left: -0.05em;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.install-banner {
  max-width: var(--max);
  margin: 0.85rem auto 0;
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid color-mix(in srgb, var(--teal) 40%, var(--line));
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(62, 207, 191, 0.12), rgba(232, 165, 75, 0.08));
  width: calc(100% - 2 * var(--pad));
}

.install-banner[hidden] { display: none !important; }

.install-banner-copy {
  display: grid;
  gap: 0.2rem;
  min-width: min(100%, 16rem);
}

.install-banner-copy strong {
  font-family: var(--display);
  letter-spacing: -0.02em;
}

.install-banner-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.install-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

body.is-pwa .install-banner,
body.is-pwa #btn-install-header {
  display: none !important;
}

.top-tag {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn.small {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(32rem, calc(100vw - 1.5rem));
  width: 100%;
}

.modal::backdrop {
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  margin: 0;
  padding: 1.25rem 1.35rem 1.4rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1a222d, #121820);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.modal-close {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.auth-tabs {
  margin: 0.9rem 0 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.field {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.7rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.field input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  padding: 0.7rem 0.9rem;
}

.recovery-box,
.device-list {
  margin-top: 0.85rem;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
  background: rgba(232, 165, 75, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.account-card {
  max-width: min(560px, 96vw);
  max-height: min(88vh, 900px);
  overflow: auto;
}

.account-section {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.account-section h3 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.05rem;
}

.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  font-family: var(--font);
}

.device-row:last-child { border-bottom: 0; }

.usage-list {
  display: grid;
  gap: 0.75rem;
}

.usage-card {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}

.usage-dl {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

#emco-actions:not([hidden]) {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem var(--pad) 3rem;
  display: grid;
  gap: 1.25rem;
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.lede {
  margin: 1rem 0 0;
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: 1.08rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, #fff), var(--panel));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  padding: clamp(1.1rem, 2.5vw, 1.5rem);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.panel-head p {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
}

.upload-grid {
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 0.75rem;
}

.mode-tabs {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mode-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-tab.is-active {
  color: #1a1208;
  background: linear-gradient(135deg, var(--amber), #c67a28);
  border-color: transparent;
}

.mode-pane { margin-top: 0.9rem; }

.drop {
  display: grid;
  gap: 0.35rem;
  min-height: 7.2rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px dashed color-mix(in srgb, var(--amber) 45%, var(--line));
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.drop-wide {
  min-height: 8.2rem;
  align-content: center;
}

.drop:hover,
.drop.is-drag {
  border-color: var(--amber);
  background: rgba(232, 165, 75, 0.08);
  transform: translateY(-1px);
}

.drop-soft {
  border-color: var(--line);
}

.drop-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--amber);
}

.drop-soft .drop-kicker { color: var(--teal); }

.drop-name {
  font-weight: 600;
  word-break: break-word;
}

.drop-sub {
  font-size: 0.88rem;
  color: var(--ink-soft);
  max-width: 40rem;
}

.callout {
  margin-bottom: 0.85rem;
  padding: 0.95rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.callout-warn {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--line));
  background: rgba(232, 165, 75, 0.08);
}

.callout strong {
  display: block;
  font-family: var(--display);
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.callout p {
  margin: 0 0 0.55rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.callout p:last-child { margin-bottom: 0; }

.stem-list {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.45rem;
}

.stem-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(9rem, 0.8fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
}

.stem-file {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stem-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.stem-role {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
}

.stem-remove {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.stem-remove:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--bad) 45%, var(--line));
}

.row-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 0.7rem 1.15rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, var(--amber), #c67a28);
  color: #1a1208;
  border-color: transparent;
}

.btn.soft:hover { border-color: color-mix(in srgb, var(--teal) 50%, var(--line)); }

.hint { margin: 0; font-size: 0.88rem; }

.meters {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.meter {
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}

.meter .label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

.meter .value {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.issues,
.chain {
  margin-top: 1rem;
  display: grid;
  gap: 0.55rem;
}

.issue,
.step {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
}

.issue strong,
.step strong { font-family: var(--display); letter-spacing: -0.01em; }

.issue[data-level="bad"] { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.issue[data-level="warn"] { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.issue[data-level="ok"] { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }

.badge {
  display: inline-flex;
  width: fit-content;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.bad { background: rgba(227, 107, 107, 0.18); color: #ffc0c0; }
.badge.warn { background: rgba(232, 165, 75, 0.18); color: #ffd59a; }
.badge.ok { background: rgba(107, 207, 142, 0.16); color: #b7f0cb; }

.chat {
  margin-top: 1rem;
  display: grid;
  gap: 0.65rem;
  max-height: 22rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.bubble {
  max-width: min(42rem, 92%);
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

.bubble.bot {
  background: rgba(62, 207, 191, 0.08);
  border-color: color-mix(in srgb, var(--teal) 35%, var(--line));
}

.bubble.user {
  margin-left: auto;
  background: rgba(232, 165, 75, 0.1);
  border-color: color-mix(in srgb, var(--amber) 40%, var(--line));
}

.chat-form {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
}

.chat-form input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font: inherit;
  padding: 0.75rem 1.05rem;
}

.chat-form input:focus {
  outline: 2px solid color-mix(in srgb, var(--teal) 55%, transparent);
  outline-offset: 1px;
}

.chips {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chips button {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.chips button:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line));
}

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

.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad) 2.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.foot p { margin: 0 0 0.45rem; }

@media (max-width: 860px) {
  .upload-grid,
  .meters,
  .stem-row { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
  .chat-form { grid-template-columns: 1fr; }
}
