/* RechnerCheck – Design: Serverraum-Ästhetik
   Tinte (Sidebar) + kühle Arbeitsfläche, Teal als Primär,
   Monospace für Hostnames, IPs, Zahlen. */

:root {
  --ink: #101820;
  --ink-soft: #1b2732;
  --ink-line: #2a3947;
  --paper: #eef1f3;
  --surface: #ffffff;
  --teal: #0e6e64;
  --teal-hover: #0b5a52;
  --teal-soft: #e3f0ee;
  --amber: #b26b00;
  --green: #1e7a45;
  --red: #b03a2e;
  --text: #1c252c;
  --muted: #63717c;
  --sidebar-w: 248px;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --font-display: "Space Grotesk", var(--font-body);
}

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--text);
  font-size: .925rem;
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

h1, h2, h3, .h4, .h5, .h6, .display-5 {
  font-family: var(--font-display);
  letter-spacing: -.01em;
}

.text-amber { color: var(--amber) !important; }
.text-green { color: var(--green) !important; }

/* ---------- App-Shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink);
  color: #cfd8de;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.2rem;
  padding: .25rem .5rem;
}
.sidebar-brand i { font-size: 1.35rem; color: #5fd0c3; }
.sidebar-brand strong { font-weight: 700; color: #fff; }
.sidebar-brand span { font-weight: 500; color: #9fb0bc; }

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: #aebcc6;
  border-radius: .5rem;
  padding: .55rem .75rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.sidebar .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.sidebar .nav-link:hover { background: var(--ink-soft); color: #fff; }
.sidebar .nav-link.active {
  background: var(--teal);
  color: #fff;
}
.sidebar .nav-link:focus-visible { outline: 2px solid #5fd0c3; outline-offset: 2px; }

.sidebar-footer {
  border-top: 1px solid var(--ink-line);
  padding-top: .9rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 .25rem;
}
.sidebar-user .username { font-weight: 600; color: #fff; font-size: .88rem; }
.sidebar-user .role-label { font-size: .74rem; color: #8fa1ad; font-family: var(--font-mono); }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: .5rem;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid #dde3e7;
  padding: .85rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}
.topbar-meta { color: var(--muted); font-size: .8rem; }

.content {
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 991.98px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row !important;
    align-items: center;
    gap: 1rem;
    padding: .6rem 1rem;
    flex-wrap: wrap;
  }
  .sidebar .nav { flex-direction: row !important; flex-wrap: wrap; }
  .sidebar .nav-link span { display: none; }
  .sidebar .nav-link i { width: auto; }
  .sidebar-footer { border: 0; padding: 0; margin-left: auto; }
  .sidebar-user .username, .sidebar-user .role-label { display: none; }
}

/* ---------- Auth-Seiten ---------- */

.auth-body {
  background: var(--ink);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-wrap { width: 100%; max-width: 430px; }
.auth-card {
  background: var(--surface);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.auth-card-wide { max-width: 640px; }
.auth-wrap .auth-card-wide { max-width: none; }
.auth-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.auth-brand i { color: var(--teal); font-size: 1.4rem; }
.auth-brand strong { color: var(--text); }
.code-input { font-size: 1.5rem; letter-spacing: .35em; }

.qr-box {
  background: #fff;
  border: 1px solid #dde3e7;
  border-radius: .75rem;
  padding: .75rem;
  display: inline-block;
}
.qr-box img, .qr-box canvas { display: block; }

/* ---------- Statistik-Karten ---------- */

.stat-card .card-body { padding: 1.1rem 1.25rem; }
.stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: .35rem;
}
.stat-value {
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
}
.stat-sub { font-size: 1.1rem; color: var(--muted); font-weight: 400; }
.stat-foot { font-size: .78rem; margin-top: .35rem; }

/* ---------- Rack-Zeilen (Signatur) ---------- */

.rack-row {
  padding: .85rem 1.25rem;
  border-bottom: 1px solid #e7ebee;
  color: inherit;
  transition: background .12s ease;
}
.rack-row:last-child { border-bottom: 0; }
.rack-row:hover { background: var(--teal-soft); }

.rack-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .05);
}
.led-green { background: var(--green); box-shadow: 0 0 0 3px rgba(30, 122, 69, .18); }
.led-amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(178, 107, 0, .18); }
.led-off { background: #b7c1c9; }

.rack-name {
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text);
}
.rack-meta {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .1rem;
}
.rack-progress { min-width: 120px; }
.rack-pct { font-weight: 600; font-size: .95rem; color: var(--teal); }
.rack-count { display: block; font-size: .72rem; color: var(--muted); }

.segment-bar {
  display: flex;
  gap: 2px;
  margin: .3rem 0 .15rem;
}
.seg {
  height: 7px;
  flex: 1;
  border-radius: 1px;
  background: #d9e0e5;
}
.seg-on { background: var(--teal); }
.seg-green { background: var(--green); }

/* ---------- Aufgaben ---------- */

.task-title { color: var(--text); }
.task-erledigt .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #b9c4cb; }
.task-uebersprungen .task-title { color: var(--muted); }
.task-note {
  background: #fff8ec;
  border-left: 3px solid var(--amber);
  padding: .35rem .6rem;
  border-radius: 0 .35rem .35rem 0;
}

.overall-progress { height: .55rem; background: #dde4e8; }
.overall-progress .progress-bar { background: var(--teal); }

/* ---------- Aktivitätsfeed ---------- */

.activity-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.activity-feed li {
  padding: .5rem 0 .5rem .95rem;
  border-left: 2px solid #dfe5e9;
  position: relative;
  font-size: .85rem;
}
.activity-feed li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: .95rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}

/* ---------- Leerzustände ---------- */

.empty-state i {
  font-size: 2.2rem;
  color: #aebac3;
}

/* ---------- Buttons & Karten ---------- */

.btn-primary {
  --bs-btn-bg: var(--teal);
  --bs-btn-border-color: var(--teal);
  --bs-btn-hover-bg: var(--teal-hover);
  --bs-btn-hover-border-color: var(--teal-hover);
  --bs-btn-active-bg: var(--teal-hover);
  --bs-btn-active-border-color: var(--teal-hover);
  --bs-btn-disabled-bg: #8fb5b0;
  --bs-btn-disabled-border-color: #8fb5b0;
}
.btn-outline-primary {
  --bs-btn-color: var(--teal);
  --bs-btn-border-color: var(--teal);
  --bs-btn-hover-bg: var(--teal);
  --bs-btn-hover-border-color: var(--teal);
  --bs-btn-active-bg: var(--teal-hover);
  --bs-btn-active-border-color: var(--teal-hover);
}

.card { border-radius: .75rem; overflow: clip; }
.card-header { border-bottom: 1px solid #e7ebee; font-size: .9rem; }

.table > :not(caption) > * > * { padding: .8rem .75rem; }

.recovery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .25rem .75rem;
  font-size: .85rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Dokumente ---------- */

.dropzone {
  border: 2px dashed #b9c4cb;
  border-radius: .75rem;
  background: #f7f9fa;
  padding: 1.4rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone i { font-size: 1.8rem; color: var(--teal); display: block; margin-bottom: .35rem; }
.dropzone-text { display: block; }
.dropzone-hint { display: block; margin-top: .2rem; }
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--teal);
  background: var(--teal-soft);
  outline: none;
}
.dropzone.dragover {
  border-color: var(--teal);
  background: var(--teal-soft);
  border-style: solid;
}
.dropzone.uploading { pointer-events: none; opacity: .75; }
.dropzone-progress { height: .4rem; margin-top: .75rem; background: #dde4e8; }
.dropzone-progress .progress-bar { background: var(--teal); transition: width .15s ease; }

.doc-icon { color: var(--muted); flex-shrink: 0; }
.doc-link {
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: color .12s ease, text-decoration-color .12s ease;
}
.doc-link:hover, .doc-link:focus-visible {
  color: var(--teal);
  text-decoration-color: var(--teal);
}
.doc-enter { animation: doc-in .25s ease; }
@keyframes doc-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.doc-preview-image { background: #f2f4f5; overflow: auto; }
.doc-preview-image img { max-height: 68vh; }
.doc-preview-frame { height: 75vh; background: #f2f4f5; }
.doc-preview-text {
  font-family: var(--font-mono);
  font-size: .8rem;
  background: #f7f9fa;
  max-height: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.doc-no-preview-icon { font-size: 2.4rem; color: #aebac3; }
