/* ============================================================
   Servecta eAkte — CD-basiertes Stylesheet
   Referenz: /Users/lucakohls/Desktop/Servecta/CD/cd.html
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

:root {
  --brand:       #1A56DB;
  --brand-dark:  #1545B0;
  --brand-deep:  #0F3385;
  --brand-light: #4A7AED;
  --brand-pale:  #EBF0FF;
  --black:       #0A0A0A;
  --gray-950:    #0F0F10;
  --gray-900:    #171717;
  --gray-800:    #262626;
  --gray-700:    #3B3B3B;
  --gray-600:    #525252;
  --gray-500:    #6B6B6B;
  --gray-400:    #9A9A9A;
  --gray-300:    #BFBFBF;
  --gray-200:    #E2E2E2;
  --gray-100:    #EBEBEB;
  --gray-75:     #F2F2F1;
  --gray-50:     #F7F7F5;
  --white:       #FFFFFF;
  --success:     #16864E;
  --warning:     #B47818;
  --error:       #B83232;
  --info:        #0E7490;
  --success-bg:  #E2F5EC;
  --warning-bg:  #FDF0DB;
  --error-bg:    #FCE4E4;
  --info-bg:     #E0F4F7;

  --shadow-xs:   0 1px 2px rgba(10,10,10,0.03);
  --shadow-sm:   0 1px 3px rgba(10,10,10,0.05), 0 1px 2px rgba(10,10,10,0.03);
  --shadow-md:   0 4px 12px rgba(10,10,10,0.06), 0 2px 4px rgba(10,10,10,0.04);
  --shadow-lg:   0 12px 32px rgba(10,10,10,0.10), 0 4px 8px rgba(10,10,10,0.05);

  --radius-xs: 6px; --radius-sm: 8px; --radius-md: 10px;
  --radius-lg: 14px; --radius-xl: 18px; --radius-2xl: 22px;

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 72px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14.5px; line-height: 1.55;
  color: var(--gray-900); background: var(--gray-50);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid rgba(26, 86, 219, 0.35); outline-offset: 2px; border-radius: 4px; }

* { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--gray-500); background-clip: padding-box; }

h1, h2, h3, h4 { font-weight: 700; color: var(--black); margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }
p { margin: 0 0 .8em; }
small { color: var(--gray-500); }

button { font-family: inherit; cursor: pointer; }

input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--black); background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  padding: 10px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-light);
  box-shadow: 0 0 0 3px var(--brand-pale);
}
textarea { resize: vertical; min-height: 96px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap; text-decoration: none; background: none; color: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--white); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--white); color: var(--gray-900); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-75); border-color: var(--gray-300); }
.btn-ghost { background: transparent; color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-75); color: var(--black); }
.btn-danger { background: var(--error); color: var(--white); }
.btn-danger:hover { filter: brightness(.95); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; border-radius: 999px;
  background: var(--gray-100); color: var(--gray-800);
}
.chip-brand { background: var(--brand-pale); color: var(--brand-dark); }
.chip-success { background: var(--success-bg); color: var(--success); }
.chip-warning { background: var(--warning-bg); color: var(--warning); }
.chip-danger { background: var(--error-bg); color: var(--error); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-neutral { background: var(--gray-100); color: var(--gray-700); }

.card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 20px; }
.card-hover { transition: border-color .15s, box-shadow .15s; }
.card-hover:hover { border-color: var(--gray-200); box-shadow: var(--shadow-sm); }

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

#app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
#app-shell.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.sidebar {
  background: var(--black); color: #E6E6E6;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 16px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 20px; color: var(--white);
}
.sidebar-brand-logo { flex-shrink: 0; width: 32px; height: 36px; display: flex; align-items: center; justify-content: center; }
.sidebar-brand-logo svg { width: 28px; height: 32px; }
.sidebar-brand-text { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; }
.sidebar-brand-text small {
  display: block; font-weight: 600; font-size: 10px;
  color: var(--brand-light); letter-spacing: 0.15em; text-transform: uppercase; margin-top: 2px;
}

.sidebar-section { margin-top: 14px; }
.sidebar-section-title {
  padding: 0 12px 6px;
  font-size: 10.5px; font-weight: 700;
  color: rgba(255,255,255,.38);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px;
  color: rgba(255,255,255,.78);
  font-weight: 500; font-size: 14px;
  white-space: nowrap;
  transition: background-color .12s, color .12s;
}
.sidebar-link:hover { background: rgba(255,255,255,.06); color: var(--white); text-decoration: none; }
.sidebar-link.active { background: var(--brand); color: var(--white); }
.sidebar-link.active svg { color: var(--white); }
.sidebar-link svg { flex-shrink: 0; color: rgba(255,255,255,.55); }
.sidebar-link-label { overflow: hidden; text-overflow: ellipsis; }
.sidebar-badge {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  background: var(--brand-light); color: var(--white);
}

.sidebar-spacer { flex: 1; }
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 12px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 10px; color: var(--white);
}
.sidebar-user:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar-user-avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: 13px;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11.5px; color: rgba(255,255,255,.55); text-transform: capitalize; }

.sidebar-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 8px; margin-top: 6px;
  border-radius: 8px; background: transparent; border: 0;
  color: rgba(255,255,255,.55); cursor: pointer;
  font-size: 12px; font-family: inherit;
  transition: background-color .12s, color .12s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.06); color: var(--white); }

#app-shell.sidebar-collapsed .sidebar-brand-text,
#app-shell.sidebar-collapsed .sidebar-section-title,
#app-shell.sidebar-collapsed .sidebar-link-label,
#app-shell.sidebar-collapsed .sidebar-user-info,
#app-shell.sidebar-collapsed .sidebar-badge,
#app-shell.sidebar-collapsed .sidebar-toggle-label { display: none; }
#app-shell.sidebar-collapsed .sidebar-link { justify-content: center; padding: 10px; }
#app-shell.sidebar-collapsed .sidebar-user { justify-content: center; }
#app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 6px 0 20px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.main-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(247, 247, 245, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-100);
  height: var(--header-h);
  display: flex; align-items: center;
  padding: 0 28px; gap: 16px;
}
.main-header-title { font-weight: 800; font-size: 17px; color: var(--black); letter-spacing: -0.01em; }
.main-header-subtitle { font-size: 13px; color: var(--gray-500); }
.main-header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 28px 48px; max-width: 1700px; width: 100%; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spacer { flex: 1; }

.text-muted { color: var(--gray-500); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-bold { font-weight: 700; }
.mono { font-family: 'SF Mono', 'Monaco', 'Consolas', monospace; font-size: 12.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.divider { height: 1px; background: var(--gray-100); margin: 16px 0; }

/* ---------- Stats ---------- */

.stat {
  background: var(--white); border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-light) 100%); opacity: .8;
}
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--gray-500); }
.stat-value { font-size: 28px; font-weight: 800; color: var(--black); letter-spacing: -0.02em; line-height: 1.1; }
.stat-hint { font-size: 12.5px; color: var(--gray-500); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-pale); color: var(--brand-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; overflow: hidden; flex-shrink: 0;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, 0.55); backdrop-filter: blur(4px);
  z-index: 100; display: none;
  align-items: flex-start; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-xl);
  max-width: 640px; width: 100%;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); overflow: hidden; margin: auto;
}
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; gap: 12px; }
.modal-title { font-size: 17px; font-weight: 700; margin: 0; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--gray-100);
  display: flex; gap: 10px; justify-content: flex-end; background: var(--gray-50); }

/* ---------- Toast ---------- */

.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  background: var(--black); color: var(--white);
  padding: 12px 16px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500; max-width: 380px; pointer-events: auto;
  animation: toast-in .2s ease;
}
.toast.error { background: var(--error); }
.toast.success { background: var(--success); }
@keyframes toast-in { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- Tables ---------- */

.table-wrap { background: var(--white); border: 1px solid var(--gray-100); border-radius: var(--radius-lg); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--gray-100); }
.table th { background: var(--gray-50); font-weight: 600; font-size: 11.5px; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.06em; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--gray-50); }
.table a { color: inherit; font-weight: 600; }

/* ---------- Login ---------- */

.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, var(--brand-pale), transparent 42%),
    radial-gradient(circle at 85% 90%, #F0F4FE, transparent 50%),
    var(--gray-50);
}
.login-card {
  background: var(--white); border-radius: var(--radius-2xl);
  padding: 40px 36px; width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--gray-100);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-brand svg { height: 36px; width: auto; }
.login-badge {
  border-left: 1px solid var(--gray-200); padding-left: 14px;
  font-size: 11px; font-weight: 700; color: var(--gray-500);
  letter-spacing: 0.15em; text-transform: uppercase;
}

.login-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.02em; }
.login-sub { color: var(--gray-500); font-size: 14px; margin-bottom: 22px; }

.ms-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px; font-size: 14.5px; font-weight: 600;
  background: var(--white); color: var(--gray-900);
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  transition: background-color .15s, border-color .15s;
}
.ms-btn:hover { background: var(--gray-75); border-color: var(--gray-300); text-decoration: none; }
.ms-logo { width: 18px; height: 18px; display: inline-block; }

/* ---------- Formular + Liste ---------- */

.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--gray-50); }
.list-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--brand-pale); color: var(--brand);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.list-title { font-weight: 600; font-size: 14.5px; }
.list-sub { font-size: 12.5px; color: var(--gray-500); }

.prose { font-size: 15px; line-height: 1.7; color: var(--gray-900); }
.empty { padding: 40px 24px; text-align: center; color: var(--gray-500); }

.kbd { display: inline-block; padding: 2px 6px; background: var(--gray-75); border: 1px solid var(--gray-200);
       border-radius: 4px; font-family: 'SF Mono', monospace; font-size: 11.5px; color: var(--gray-700); }

.section-title { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
                 color: var(--brand); margin-bottom: 10px; }

/* ---------- Hash-Kette / Audit-Badge ---------- */

.hash { font-family: 'SF Mono', monospace; font-size: 12px; color: var(--gray-600); }
.hash-ok { color: var(--success); }
.hash-bad { color: var(--error); }

/* ---------- Dokument-Ansicht ---------- */

.doc-preview { background: var(--gray-100); border-radius: var(--radius-lg); height: 640px; overflow: hidden; }
.doc-preview iframe { width: 100%; height: 100%; border: 0; background: var(--white); }
.meta-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 18px; font-size: 13.5px; align-items: baseline; }
.meta-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); }
.meta-value { color: var(--gray-900); }

/* ---------- Responsive ---------- */

/* ---- Hamburger-Button (nur mobil sichtbar) ---- */
.mobile-toggle {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer; color: var(--gray-900);
  flex-shrink: 0;
}
.mobile-toggle:hover { background: var(--gray-75); }

/* ---- Sidebar-Overlay ---- */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, 0.45);
  z-index: 40; opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
#app-shell.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  #app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease;
    width: 82%; max-width: 300px;
  }
  #app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .mobile-toggle { display: inline-flex; }

  .main-header { padding: 0 12px; gap: 10px; }
  .main-header-title { font-size: 15px; }
  .main-header-subtitle { font-size: 11.5px; display: none; }
  .main-header-actions .btn span { display: none; }
  .main-header-actions .btn { padding: 9px 11px; }

  .content { padding: 16px 12px 80px; max-width: 100%; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  /* Tabellen scrollbar */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; padding: 10px 14px; }

  /* Dokumenten-Ansicht: Preview und Meta untereinander */
  .meta-grid { grid-template-columns: 1fr; gap: 8px; }
  .doc-preview { height: 420px; }

  /* Modal vollflächig */
  .modal-backdrop { padding: 0; }
  .modal {
    max-width: 100%; width: 100%; height: 100%; max-height: 100%;
    border-radius: 0;
  }

  /* Touch-Zielgrößen */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  .btn-icon { width: 40px; height: 40px; }

  /* Stat-Karten kompakter */
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 24px; }

  /* Login-Shell */
  .login-card { padding: 28px 22px; border-radius: var(--radius-lg); }
  .login-shell { padding: 12px; }
}

@media (max-width: 480px) {
  .main-header-title { font-size: 14px; letter-spacing: 0; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  .content { padding: 12px 10px 80px; }
  .doc-preview { height: 360px; }
}
