@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --bg: #ffffff;
  --bg-sidebar: #f8f9fb;
  --bg-hover: #f0f2f5;
  --bg-card: #f5f6f8;
  --border: #e2e5ea;
  --border-light: #edf0f3;
  --text: #1a1d26;
  --text-secondary: #5a6070;
  --text-muted: #8b92a5;
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-bg: rgba(37, 99, 235, 0.06);
  --gold: #b8860b;
  --gold-bg: rgba(184, 134, 11, 0.08);
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --sidebar-w: 300px;
  --header-h: 56px;
  --radius: 6px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

/* LOGIN */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-sidebar);
}

.login-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.login-card h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 4px;
}

.login-card .subtitle {
  color: var(--text-secondary);
  font-size: .82rem;
  margin-bottom: 24px;
}

.login-card .case-ref {
  font-size: .7rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .9rem;
  outline: none;
  transition: border .2s;
}

.login-input:focus {
  border-color: var(--accent);
}

.login-btn {
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.login-btn:hover {
  background: var(--accent-light);
}

.login-error {
  color: var(--danger);
  font-size: .8rem;
  margin-top: 10px;
  display: none;
}

.login-footer {
  margin-top: 24px;
  font-size: .68rem;
  color: var(--text-muted);
}

/* APP */
.app {
  display: none;
}

.app.active {
  display: block;
}

/* HEADER */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
}

.header-brand {
  font-family: 'Playfair Display', serif;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
}

.header-case {
  color: var(--text-muted);
  font-size: .75rem;
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-status {
  font-size: .68rem;
  color: var(--text-muted);
}

.header-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: .78rem;
  cursor: pointer;
  transition: all .15s;
}

.header-logout:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
  z-index: 90;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.sidebar-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 14px 16px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all .1s;
  font-size: .82rem;
  color: var(--text-secondary);
  gap: 8px;
  margin: 1px 8px;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}

.nav-item .icon {
  font-size: .9rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-group .nav-sub {
  display: none;
}

.nav-group.open .nav-sub {
  display: block;
}

.nav-group-toggle {
  position: relative;
}

.nav-group-toggle::after {
  content: '›';
  position: absolute;
  right: 12px;
  transition: transform .15s;
  font-size: 1rem;
  color: var(--text-muted);
}

.nav-group.open .nav-group-toggle::after {
  transform: rotate(90deg);
}

.nav-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 16px;
}

/* GLIEDERUNG SEPARATOR */
.nav-gliederung-divider {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 12px 16px 6px;
  font-weight: 600;
}

/* MAIN */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 32px 48px 64px;
  max-width: 900px;
}

.main .loading {
  color: var(--text-muted);
  font-size: .9rem;
  padding: 40px 0;
}

/* MARKDOWN CONTENT STYLING */
.md-content h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.md-content h2 {
  font-size: 1.2rem;
  color: var(--text);
  margin: 28px 0 12px;
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.md-content h3 {
  font-size: 1.02rem;
  color: var(--text);
  margin: 20px 0 8px;
  font-weight: 600;
}

.md-content h4 {
  font-size: .92rem;
  color: var(--accent);
  margin: 16px 0 6px;
  font-weight: 600;
}

.md-content p {
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.md-content ul,
.md-content ol {
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding-left: 22px;
}

.md-content li {
  margin-bottom: 6px;
}

.md-content strong {
  color: var(--text);
}

.md-content em {
  font-style: italic;
}

.md-content hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 20px 0;
}

.md-content a {
  color: var(--accent);
  text-decoration: none;
}

.md-content a:hover {
  text-decoration: underline;
}

/* BLOCKQUOTES */
.md-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 18px;
  margin: 14px 0;
  background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .88rem;
  color: var(--text-secondary);
}

.md-content blockquote strong {
  color: var(--text);
}

/* TABLES */
.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: .84rem;
}

.md-content th {
  background: var(--bg-sidebar);
  text-align: left;
  padding: 9px 12px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}

.md-content td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: top;
}

.md-content tr:hover td {
  background: var(--bg-hover);
}

/* CODE */
.md-content code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: .84rem;
  font-family: 'Courier New', monospace;
  color: var(--text);
}

.md-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 12px 0;
  overflow-x: auto;
}

.md-content pre code {
  background: none;
  padding: 0;
  font-size: .82rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* STATUS BADGES in headings */
.md-content code:first-child {
  font-family: 'Inter', sans-serif;
}

/* MOBILE */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  margin-right: 12px;
}

@media(max-width:860px) {
  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s;
    background: var(--bg);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
  }

  .main {
    margin-left: 0;
    padding: 24px 16px;
  }

  .header-case {
    display: none;
  }
}