/* ============================================================
   SanctioDesk – Design System
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --sd-sidebar-w:      200px;
  --sd-sidebar-bg:     #2C2C2A;
  --sd-logo-text:      #F1EFE8;
  --sd-logo-sub:       #5F5E5A;
  --sd-logo-border:    #444441;
  --sd-section-label:  #5F5E5A;
  --sd-item-text:      #888780;
  --sd-item-hover:     #444441;
  --sd-item-active-bg: #185FA5;
  --sd-item-active-tx: #FFFFFF;
  --sd-topbar-h:       52px;
  --sd-body-bg:        #F5F7FA;
  --sd-card-border:    rgba(0,0,0,0.09);
  --primary:           #185FA5;
  --primary-hover:     #124d8a;
}

/* ── Bootstrap overrides ─────────────────────────────────────── */
:root {
  --bs-primary: #185FA5;
  --bs-primary-rgb: 24,95,165;
}
.bg-primary            { background-color: var(--primary) !important; }
.text-primary          { color: var(--primary) !important; }
.border-primary        { border-color: var(--primary) !important; }
.btn-primary           { background-color: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active    { background-color: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }
.btn-outline-primary   { color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-outline-primary:hover { background-color: var(--primary) !important; color: #fff !important; }
.form-control:focus,
.form-select:focus     { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24,95,165,.15); }
.navbar.bg-primary     { background-color: var(--primary) !important; }

/* ── Base ───────────────────────────────────────────────────── */
body { font-size: 0.9rem; background: var(--sd-body-bg); color: #1c1c1a; }

/* ── Layout ─────────────────────────────────────────────────── */
.sd-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sd-sidebar {
  width: var(--sd-sidebar-w);
  background: var(--sd-sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .22s ease;
  flex-shrink: 0;
}

/* Logo */
.sd-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 0.9rem 0.9rem;
  border-bottom: 1px solid var(--sd-logo-border);
  flex-shrink: 0;
}
.sd-logo-icon { font-size: 1.3rem; color: var(--primary); flex-shrink: 0; }
.sd-logo-name { font-size: 0.95rem; font-weight: 700; color: var(--sd-logo-text); letter-spacing: .01em; line-height: 1.2; }
.sd-logo-sub  { font-size: 0.65rem; color: var(--sd-logo-sub); letter-spacing: .04em; text-transform: uppercase; }

/* Nav */
.sd-nav { flex: 1; padding: 0.5rem 0.6rem 0.5rem; display: flex; flex-direction: column; gap: 1px; }

.sd-nav-section {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sd-section-label);
  padding: 0.85rem 0.5rem 0.2rem;
  font-weight: 600;
}

.sd-nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.65rem;
  border-radius: 6px;
  color: var(--sd-item-text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background .14s, color .14s;
  position: relative;
  white-space: nowrap;
}
.sd-nav-item i { font-size: 15px; width: 16px; flex-shrink: 0; }
.sd-nav-item:hover  { background: var(--sd-item-hover); color: #ccc; }
.sd-nav-item.active { background: var(--sd-item-active-bg); color: var(--sd-item-active-tx); }
.sd-nav-item.active i { color: var(--sd-item-active-tx); }

.sd-nav-badge {
  margin-left: auto;
  background: #e03131;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Main area ───────────────────────────────────────────────── */
.sd-main {
  margin-left: var(--sd-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  background: var(--sd-body-bg);
}

/* ── Topbar ──────────────────────────────────────────────────── */
.sd-topbar {
  height: var(--sd-topbar-h);
  background: #fff;
  border-bottom: 0.5px solid rgba(0,0,0,.1);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sd-toggle { background: none; border: none; font-size: 1.2rem; color: #666; padding: 4px 6px; cursor: pointer; }

.sd-search { flex: 1; max-width: 380px; position: relative; }
.sd-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #aaa; font-size: .85rem; pointer-events: none; }
.sd-search-input {
  width: 100%;
  padding: 0.35rem 0.75rem 0.35rem 2rem;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  background: #F0F2F5;
  outline: none;
  transition: box-shadow .15s, background .15s;
  color: #333;
}
.sd-search-input::placeholder { color: #aaa; }
.sd-search-input:focus { background: #fff; box-shadow: 0 0 0 2px rgba(24,95,165,.2); }

.sd-topbar-right { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }

/* Bell */
.sd-bell-wrap { position: relative; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; transition: background .14s; }
.sd-bell-wrap:hover { background: #f0f2f5; }
.sd-bell { font-size: 1.1rem; color: #555; }
.sd-bell-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: #e03131; border-radius: 50%; border: 1.5px solid #fff; }

/* User button */
.sd-user-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: none; border: none;
  padding: 5px 8px; border-radius: 7px;
  cursor: pointer; transition: background .14s;
}
.sd-user-btn:hover { background: #f0f2f5; }
.sd-user-btn::after { display: none; }
.sd-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sd-uname  { font-size: 0.82rem; font-weight: 600; color: #1c1c1a; }
.sd-urole  { font-size: 0.7rem; color: #888; }

/* ── Content ─────────────────────────────────────────────────── */
.sd-alerts  { padding: 0.75rem 1.25rem 0; }
.sd-content { padding: 1.25rem; flex: 1; }
.sd-footer  { text-align: center; font-size: .78rem; color: #aaa; padding: 0.75rem; border-top: 0.5px solid rgba(0,0,0,.08); background: #fff; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  border: 0.5px solid var(--sd-card-border) !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.04) !important;
  background: #fff;
}
.card-header {
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  background: #fff !important;
  border-bottom: 0.5px solid var(--sd-card-border) !important;
  border-radius: 8px 8px 0 0 !important;
}
.card-footer {
  background: #fafafa !important;
  border-top: 0.5px solid var(--sd-card-border) !important;
  border-radius: 0 0 8px 8px !important;
}

/* ── Page heading ────────────────────────────────────────────── */
h4, h5 { font-weight: 500; font-size: 15px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  color: #777;
  font-weight: 600;
}
.table-sm td, .table-sm th { vertical-align: middle; }

/* ── Status Pills ────────────────────────────────────────────── */
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-neu          { background: #E6F1FB; color: #0C447C; }
.status-offen        { background: #FAEEDA; color: #633806; }
.status-ueberfaellig { background: #FCEBEB; color: #791F1F; }
.status-mahn         { background: #FCEBEB; color: #791F1F; }
.status-abgeschlossen{ background: #EAF3DE; color: #27500A; }
.status-storniert    { background: #D3D1C7; color: #444441; }

/* ── KPI dot indicator ───────────────────────────────────────── */
.sd-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Misc ────────────────────────────────────────────────────── */
.badge { font-weight: 600; }
.form-label.fw-semibold { color: #333; }
.alert { border-radius: 6px; }
.progress-bar { transition: width .4s ease; }
#sessionWarning { border-top: 3px solid #ffc107; }
.artikel-row, .zeuge-card {
  background: #fff;
  border: 0.5px solid #dee2e6;
  border-radius: 6px;
  padding: 0.5rem;
}
.ergebnis-rot    { color: #dc3545; }
.ergebnis-orange { color: #fd7e14; }
.ergebnis-gelb   { color: #ffc107; }
.ergebnis-gruen  { color: #198754; }

@media (min-width: 992px) {
  .sticky-sidebar { position: sticky; top: calc(var(--sd-topbar-h) + 1rem); }
}
@keyframes pulse-badge { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }
.badge-pulse { animation: pulse-badge 1s infinite; }

/* ── Login page ──────────────────────────────────────────────── */
.sd-login-page {
  min-height: 100vh;
  background: var(--sd-body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.sd-login-box { width: 100%; max-width: 390px; }
.sd-login-logo {
  width: 60px; height: 60px;
  border-radius: 14px;
  background: var(--sd-sidebar-bg);
  color: var(--primary);
  font-size: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Mobile overlay ──────────────────────────────────────────── */
.sd-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1039;
}
.sd-overlay.active { display: block; }

@media (max-width: 991.98px) {
  .sd-sidebar { transform: translateX(-100%); }
  .sd-sidebar.open { transform: translateX(0); }
  .sd-main { margin-left: 0; }
  .sd-content { padding: 1rem; }
}

/* ── Sticky filter + scrollable list ────────────────────────── */
.sd-list-filter-wrap {
  position: sticky;
  top: var(--sd-topbar-h);
  z-index: 30;
  background: var(--sd-body-bg);
  padding-bottom: 0.5rem;
}
.sd-list-scroll {
  max-height: calc(100vh - var(--sd-topbar-h) - 180px);
  overflow-y: auto;
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .sd-sidebar, .sd-topbar, .btn, footer, .no-print { display: none !important; }
  .sd-main { margin-left: 0 !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ccc !important; }
}
