/* ===========================================================================
   NexusCrawler — IronPulse-Komponenten (Portal)
   Baut auf tokens.css auf. Layout: dunkle Sidebar + Topbar + Content.
   ========================================================================== */

html { background: var(--bg); }
body {
  font-family: var(--sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: rgba(230,57,70,.18); color: var(--ink); }

/* ============ Typo-Utilities ============ */
.mono { font-family: var(--mono); }
.overline {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ============ App-Layout ============ */
.app { display: flex; min-height: 100vh; }
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.content {
  padding: 26px 32px 48px;
  width: 100%;
  max-width: 1280px;
}
/* Burger-Toggle: nur mobil sichtbar (Markup in base.html) */
.burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex: none;
}
.burger svg { width: 18px; height: 18px; stroke: currentColor; }

.side-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 26, 24, 0.5);
  z-index: 29;
}

@media (max-width: 900px) {
  .main { margin-left: 0; }
  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .side-backdrop { display: block; }
  body.nav-open { overflow: hidden; }
  .burger { display: inline-flex; }
}

/* ============ Sidebar ============ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--ink);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 14px;
  gap: 18px;
  overflow-y: auto;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff5a52, var(--red) 55%, var(--red-deep));
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(230,57,70,.35);
  flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; stroke: #fff; }
.brand-name {
  font-family: var(--mono);
  font-size: 15px; font-weight: 800;
  letter-spacing: .16em;
  color: #fff;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 8.5px; letter-spacing: .22em;
  color: var(--side-faint);
  margin-top: 4px;
  text-transform: uppercase;
}

.side-label {
  font-family: var(--mono);
  font-size: 9px; font-weight: 700; letter-spacing: .24em;
  color: var(--side-faint);
  padding: 4px 8px 0;
  text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 10px;
  border-radius: 10px;
  border-left: 3px solid transparent;
  color: var(--side-text);
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s;
}
.nav-item svg { width: 17px; height: 17px; stroke: currentColor; opacity: .85; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.05); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(230,57,70,.22), rgba(230,57,70,.07));
  border-left-color: var(--red);
  color: #fff;
}
.nav-item.active svg { stroke: var(--red); opacity: 1; }
.nav-item.admin { color: var(--gold); }
.nav-item.admin.active {
  background: linear-gradient(90deg, rgba(232,163,61,.22), rgba(232,163,61,.07));
  border-left-color: var(--gold);
  color: #fff;
}
.nav-item.admin.active svg { stroke: var(--gold); }
.nav-item .grow { flex: 1; }

.badge {
  font-family: var(--mono);
  font-size: 9px; font-weight: 700;
  padding: 3px 7px;
  border-radius: 20px;
  background: #33302c;
  color: var(--side-text);
  white-space: nowrap;
}
.badge.red { background: var(--red); color: #fff; }

/* Sidebar-Fußzeile: Nutzer */
.side-user {
  margin-top: auto;
  display: flex; align-items: center; gap: 11px;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--side-border);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  font-family: var(--mono);
}
.side-user .avatar { background: linear-gradient(135deg, #ff5a52, var(--red-deep)); }
.side-user .name { font-size: 12px; font-weight: 700; color: #fff; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .role { font-size: 10px; color: var(--side-faint); margin-top: 2px; }
.side-user .logout {
  margin-left: auto;
  background: none; border: 0; cursor: pointer;
  color: var(--side-faint);
  display: grid; place-items: center;
  padding: 6px; border-radius: 8px;
}
.side-user .logout:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-user .logout svg { width: 16px; height: 16px; stroke: currentColor; }

/* ============ Topbar ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px 14px;
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.page-title h1 {
  font-family: var(--mono);
  font-size: 19px; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.page-title .sub { font-size: 11px; color: var(--text-soft); margin-top: 3px; font-weight: 500; }
.page-title .rule { width: 150px; height: 3px; background: var(--red); margin-top: 8px; border-radius: 2px; }
.spacer { flex: 1; }

/* Operator-Chip in der Topbar */
.op-chip {
  font-family: var(--mono);
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  padding: 6px 10px; border-radius: 20px;
  background: rgba(232,163,61,.14);
  border: 1px solid rgba(232,163,61,.4);
  color: #a86e14;
  white-space: nowrap;
}

/* ============ Buttons ============ */
.btn {
  font-family: var(--sans);
  font-size: 12px; font-weight: 700;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition-base);
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; flex-shrink: 0; }
.btn.ghost { background: var(--beige); border-color: var(--tan); }
.btn.ghost:hover { background: var(--tan); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #33302c; }
.btn.primary {
  background: var(--red); color: #fff;
  box-shadow: 0 6px 16px rgba(230,57,70,.35);
}
.btn.primary:hover { background: var(--red-deep); }
.btn.primary:active { transform: translateY(1px); }
.btn.outline-danger { background: #fff; border-color: rgba(230,57,70,.4); color: var(--red); }
.btn.outline-danger:hover { background: rgba(230,57,70,.06); }
.btn.sm { padding: 7px 11px; font-size: 11px; border-radius: 9px; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ============ Karten ============ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title {
  font-family: var(--mono);
  font-size: 12.5px; font-weight: 800; letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text);
}
.card-sub { font-size: 11.5px; color: var(--text-soft); margin-top: 4px; font-weight: 500; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Eck-Nieten (Deko-Punkte in den Kartenecken) */
.riveted::before, .riveted::after {
  content: '';
  position: absolute;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--tan);
}
.riveted::before { top: 10px; right: 10px; }
.riveted::after  { bottom: 10px; left: 10px; }

/* Dunkles Hero-Panel (z.B. Briefing-Kopf) */
.panel-dark {
  position: relative;
  background: var(--panel);
  border-radius: var(--r-lg);
  color: #f2efe9;
  overflow: hidden;
}
.panel-dark::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--red), var(--orange-hot));
}

/* ============ Pills / Chips ============ */
.pill {
  font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .04em;
  padding: 4px 9px; border-radius: 20px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  text-transform: uppercase;
}
.pill.ok      { background: rgba(56,168,101,.13);  color: var(--green); }
.pill.warn    { background: rgba(224,140,0,.13);   color: var(--orange); }
.pill.err     { background: rgba(230,57,70,.12);   color: var(--red); }
.pill.js      { background: rgba(124,111,219,.14); color: var(--purple); }
.pill.info    { background: rgba(74,144,217,.12);  color: var(--blue); }
.pill.neutral { background: var(--beige);          color: var(--text-soft); }
.pill.on-dark { background: rgba(255,255,255,.1);  color: #e8e4dc; }

.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  animation: ip-pulse 1.6s ease-out infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes ip-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(230,57,70,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(230,57,70,0); }
  100% { box-shadow: 0 0 0 0 rgba(230,57,70,0); }
}

/* ============ Formulare ============ */
.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 9px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--tan);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--sans);
  font-size: 13px; font-weight: 500;
  color: var(--text);
}
.field::placeholder { color: var(--text-faint); font-weight: 400; }
.field:focus { outline: none; border-color: var(--red); box-shadow: var(--ring-brand); }
select.field { appearance: auto; }
.hint { font-size: 10.5px; color: var(--text-faint); margin-top: 5px; font-weight: 500; line-height: 1.5; }

input[type="checkbox"] { accent-color: var(--red); }

/* Wochentags-Kacheln */
.day-pick {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; padding: 9px 12px;
  border: 1px solid var(--tan);
  border-radius: 9px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  background: var(--surface); color: var(--text-soft);
  cursor: pointer;
  transition: var(--transition-base);
}
.day-pick:hover { border-color: var(--red); }
.day-pick.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ============ Tabellen (Roster-Stil) ============ */
table.roster { width: 100%; border-collapse: collapse; }
.roster th {
  font-family: var(--mono);
  font-size: 8px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.roster td { padding: 11px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 12.5px; }
.roster tr:last-child td { border-bottom: 0; }
.roster tbody tr:hover { background: #faf8f4; }
.roster .mono-cell { font-family: var(--mono); font-size: 10.5px; color: var(--text-soft); white-space: nowrap; }

/* ============ Hinweis-Boxen ============ */
.note-box {
  font-size: 12px; font-weight: 500; line-height: 1.55;
  border-radius: var(--r-md);
  padding: 12px 14px;
  border: 1px solid var(--tan);
  background: var(--beige);
  color: var(--text-soft);
}
.note-box.ok   { background: rgba(56,168,101,.08);  border-color: rgba(56,168,101,.3);  color: #23744a; }
.note-box.warn { background: rgba(224,140,0,.08);   border-color: rgba(224,140,0,.3);   color: #9c6200; }
.note-box.err  { background: rgba(230,57,70,.06);   border-color: rgba(230,57,70,.3);   color: var(--red-deep); }
.note-box.info { background: rgba(74,144,217,.07);  border-color: rgba(74,144,217,.3);  color: #2d6cab; }

/* ============ Beige Inset-Reihen (Renewal-Stil) ============ */
.inset-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--beige);
  border: 1px solid var(--tan);
  border-radius: var(--r-md);
  padding: 12px 14px;
}

/* ============ Zahlen / KPI ============ */
.kpi-num { font-family: var(--mono); font-weight: 800; }
.tnum, td, th { font-variant-numeric: tabular-nums; }

/* ============ Sonstiges ============ */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
:focus-visible { outline: none; box-shadow: var(--ring-brand); border-radius: 8px; }
a.plain-link { color: var(--text-soft); text-decoration: none; font-weight: 600; font-size: 12px; }
a.plain-link:hover { color: var(--red); }
.see-all { font-size: 11.5px; font-weight: 700; color: var(--red); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
