/* ================================================================
   Vollwerth-Apotheke Wissensdatenbank – Stylesheet
   Farben: #93783d (braun), #4B3A28 (dunkel), #f3ead5 (beige), #d6b16a (gold)
   Fonts: Lato (body), Miriam Libre (headings)
   ================================================================ */

:root {
  --primary:      #93783d;
  --primary-dark: #7a6330;
  --primary-hover:#6b5528;
  --dark:         #4B3A28;
  --gold:         #d6b16a;
  --gold-light:   #e8cfa0;
  --link:         #a0690d;
  --link-hover:   #d1a639;
  --bg:           #f3ead5;
  --bg-card:      #fffdf6;
  --bg-sidebar:   #4B3A28;
  --text:         #2c2010;
  --text-muted:   #7a6a55;
  --border:       #dccba0;
  --border-light: #ede8d8;
  --white:        #ffffff;
  --danger:       #c0392b;
  --danger-hover: #a93226;
  --success-bg:   #f0fce8;
  --success-text: #2d6a1f;
  --warning-bg:   #fff8e1;
  --warning-text: #7c5e00;
  --error-bg:     #fdecea;
  --error-text:   #8b1a10;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 2px 8px rgba(75,58,40,0.12);
  --shadow-lg:    0 4px 20px rgba(75,58,40,0.18);
  --header-h:     64px;
  --sidebar-w:    240px;
  --font-body:    'Lato', 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'Miriam Libre', 'Georgia', serif;
}

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--dark);
  line-height: 1.3;
}

/* ── Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark);
  height: var(--header-h);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  padding: 0 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

/* Logo im Header */
.logo-img {
  height: 48px;
  width: auto;
  display: block;
  background: var(--bg); /* Beige-Hintergrund damit das farbige Logo sichtbar bleibt */
  border-radius: 6px;
  padding: 4px 8px;
}

.logo-sub-text {
  color: var(--gold-light);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* Login-Logo */
.login-logo-img {
  height: 72px;
  width: auto;
  display: block;
  margin: 0 auto 12px;
}

/* Fallback-Icons (nicht mehr genutzt aber für Kompatibilität) */
.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gold);
  color: var(--dark);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
}

.logo-icon-lg {
  width: 64px;
  height: 64px;
  background: var(--gold);
  color: var(--dark);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  margin: 0 auto 16px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-main {
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
}

.logo-sub {
  color: var(--gold-light);
  font-size: 11px;
  opacity: 0.8;
}

.header-search {
  flex: 1;
  max-width: 480px;
  margin-left: auto;
}

.search-form {
  display: flex;
  gap: 6px;
}

.search-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.15);
  color: var(--white);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: all 0.2s;
}

.search-input::placeholder { color: rgba(255,255,255,0.5); }
.search-input:focus { background: rgba(255,255,255,0.25); border-color: var(--gold); }

.search-btn {
  padding: 8px 14px;
  background: var(--gold);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}
.search-btn:hover { background: var(--gold-light); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 16px;
  flex-shrink: 0;
}

.user-badge {
  color: var(--gold-light);
  font-size: 14px;
}

.admin-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--gold);
  color: var(--dark);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Layout: Sidebar + Main ──────────────────────────────────── */
.app-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-h) - 48px);
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  padding: 16px 0;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--gold-light);
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.15s;
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.nav-item.active { background: var(--primary); color: var(--white); }

.nav-icon { font-size: 16px; }

.nav-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.15);
  margin: 8px 14px;
}

.sidebar-section {
  padding: 12px 8px 8px;
}

.sidebar-section-title {
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 14px;
  margin-bottom: 4px;
}

.sidebar-folder {
  display: block;
  padding: 6px 14px;
  color: var(--gold-light);
  font-size: 13px;
  border-radius: var(--radius);
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-folder:hover { background: rgba(255,255,255,0.08); color: var(--white); }

.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  max-width: calc(1600px - var(--sidebar-w));
}

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  background: var(--dark);
  color: var(--gold-light);
  padding: 12px 24px;
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-hover); color: var(--white); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: var(--white); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-sm  { padding: 6px 13px; font-size: 13px; }
.btn-xs  { padding: 4px 10px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(147,120,61,0.15); }

.form-control-sm { padding: 6px 10px; font-size: 13px; }
.form-control-xs { padding: 4px 8px; font-size: 12px; width: 130px; }

.editor-area { font-family: 'Courier New', monospace; font-size: 14px; resize: vertical; }

.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; }

.required { color: var(--danger); }

.card-form {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

/* ── Alerts ───────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 4px solid;
}

.alert-success { background: var(--success-bg); color: var(--success-text); border-color: #4caf50; }
.alert-error   { background: var(--error-bg);   color: var(--error-text);   border-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-color: #f9a825; }
.alert-info    { background: #e3f2fd; color: #0d47a1; border-color: #2196f3; }

/* ── Page Header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  color: var(--dark);
  margin: 0;
  flex: 1;
}

/* ── Section ──────────────────────────────────────────────────── */
.section { margin-bottom: 32px; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 18px;
  margin-bottom: 0;
}

/* ── Stats Grid ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 32px;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Doc Card Grid ────────────────────────────────────────────── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-decoration: none;
  transition: all 0.2s;
  color: inherit;
}

.doc-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.doc-icon { font-size: 24px; flex-shrink: 0; }

.doc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.doc-meta { font-size: 11px; color: var(--text-muted); }

/* ── Folder Grid ──────────────────────────────────────────────── */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.folder-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.folder-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.folder-icon { font-size: 32px; margin-bottom: 8px; }
.folder-name { font-size: 14px; font-weight: 600; color: var(--dark); }
.folder-count { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Document List (Knowledge Base) ──────────────────────────── */
.doc-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }

.doc-list-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  transition: all 0.15s;
}

.doc-list-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }

.doc-list-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.doc-list-icon { font-size: 22px; flex-shrink: 0; }

.doc-list-body { min-width: 0; }

.doc-list-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-list-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.doc-list-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-type   { background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }
.badge-folder { background: rgba(147,120,61,0.1); color: var(--primary-dark); }
.badge-admin  { background: var(--gold); color: var(--dark); }
.badge-user   { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-ok     { background: #e8f5e9; color: #2e7d32; }
.badge-off    { background: #fce4e4; color: #c62828; }

.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(147,120,61,0.12);
  color: var(--primary-dark);
  border-radius: 20px;
  font-size: 12px;
  margin: 1px;
  text-decoration: none;
  border: 1px solid rgba(147,120,61,0.25);
  transition: background 0.15s;
}
.tag-chip:hover { background: var(--primary); color: var(--white); }

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-suggest {
  cursor: pointer;
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  transition: all 0.15s;
  user-select: none;
}
.tag-suggest:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ── Filter Bar ───────────────────────────────────────────────── */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}

.filter-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-large { font-size: 15px; padding: 10px 16px; }

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.result-info {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 24px;
}

.page-btn {
  padding: 7px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: var(--white); }

/* ── Dropzone ─────────────────────────────────────────────────── */
.dropzone-area {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.dropzone-area:hover, .dropzone-area.dz-drag-hover {
  border-color: var(--primary);
  background: rgba(147,120,61,0.06);
}

.dz-message .dz-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.dz-message p { color: var(--text-muted); font-size: 15px; }
.dz-hint { font-size: 13px !important; margin-top: 8px; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Viewer ───────────────────────────────────────────────────── */
.doc-meta-bar {
  padding: 12px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.meta-sep { color: var(--border); }

.viewer-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.viewer-content {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  min-height: 300px;
}

/* Markdown gerendert */
.md-rendered h1, .md-rendered h2, .md-rendered h3 {
  font-family: var(--font-heading);
  color: var(--dark);
  margin: 1.2em 0 0.5em;
}
.md-rendered h1 { font-size: 1.8em; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md-rendered h2 { font-size: 1.4em; }
.md-rendered h3 { font-size: 1.15em; }
.md-rendered p  { margin-bottom: 0.9em; }
.md-rendered ul, .md-rendered ol { margin: 0.5em 0 0.9em 1.5em; }
.md-rendered li { margin-bottom: 4px; }
.md-rendered code {
  background: rgba(147,120,61,0.1);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}
.md-rendered pre {
  background: #2c2010;
  color: #f3ead5;
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 1em;
}
.md-rendered pre code { background: none; padding: 0; color: inherit; }
.md-rendered blockquote {
  border-left: 4px solid var(--gold);
  padding-left: 16px;
  color: var(--text-muted);
  margin: 1em 0;
}
.md-rendered table { border-collapse: collapse; width: 100%; margin-bottom: 1em; }
.md-rendered th, .md-rendered td { border: 1px solid var(--border); padding: 8px 12px; }
.md-rendered th { background: var(--bg); font-weight: 700; }
.md-rendered img { max-width: 100%; border-radius: var(--radius); }
.md-rendered hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }

/* Markdown-Preview */
.md-preview {
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 300px;
  background: var(--bg-card);
}

.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

/* Text-Datei Anzeige */
.text-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.92em;
  line-height: 1.65;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 0;
  color: var(--text);
  overflow-x: auto;
}

/* PDF-Viewer */
.pdf-frame {
  width: 100%;
  height: 75vh;
  border: none;
  border-radius: var(--radius);
}

/* Bild-Vorschau */
.image-viewer { text-align: center; }
.preview-image {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* ── Table ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.card h3 { margin-bottom: 16px; font-size: 17px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(147,120,61,0.04); }

.row-disabled { opacity: 0.55; }

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form { display: inline-flex; gap: 4px; align-items: center; }

/* ── Login Page ───────────────────────────────────────────────── */
.login-page {
  background: var(--dark);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  justify-content: center;
  align-items: center;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 20px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-title { font-size: 22px; color: var(--dark); }
.login-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.login-form { display: flex; flex-direction: column; }

.login-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 20px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; font-size: 15px; }

/* ── Misc ─────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; padding: 8px; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { padding: 8px 12px; }
  .sidebar-section { display: none; }
  .main-content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .header-inner { gap: 8px; padding: 0 12px; }
  .logo-sub { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .header-search { display: none; }
  .logo-sub-text { display: none; }
  .user-badge { display: none; }
  .header-nav { margin-left: auto; gap: 8px; }
  .doc-grid { grid-template-columns: 1fr; }
  .folder-grid { grid-template-columns: 1fr 1fr; }
  .filter-row { flex-direction: column; }
  .filter-row .form-control { width: 100%; }
  .viewer-content { padding: 16px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
}

/* ── Home-Auswahlseite ──────────────────────────────────────────── */
.home-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 16px;
  gap: 32px;
}
.home-select__title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--dark);
  text-align: center;
}
.home-select__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  max-width: 640px;
}
.home-select__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 24px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.home-select__card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.home-select__icon { font-size: 2.8rem; }
.home-select__label {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  text-align: center;
}
.home-select__desc {
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}
@media (max-width: 600px) {
  .home-select__grid { grid-template-columns: 1fr; }
}

/* ── Preismodul ─────────────────────────────────────────────────── */
.pae-upload-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.pae-upload-hint {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 20px;
}
.pae-form { display: flex; flex-direction: column; gap: 16px; }
.pae-file-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pae-file-input { display: none; }
.pae-filename {
  font-size: .85rem;
  color: var(--text-muted);
  font-style: italic;
}
.pae-submit { align-self: flex-start; margin-top: 4px; }

/* Zusammenfassungs-Badges */
.pae-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 700;
}
.badge-ok    { background: var(--success-bg); color: var(--success-text); }
.badge-warn  { background: var(--warning-bg); color: var(--warning-text); }
.badge-error { background: var(--error-bg);   color: var(--error-text);   }
.badge-muted { background: #eee; color: #666; }

/* Ergebnistabelle */
.pae-table-wrap { overflow-x: auto; margin-top: 12px; }
.pae-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.pae-table th {
  background: var(--dark);
  color: var(--white);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pae-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.pae-row:last-child td { border-bottom: none; }
.pae-row:nth-child(even) { background: #faf8f2; }
.pae-row--uvp { background: #fff8e1 !important; }
.pae-row--notfound td { color: var(--text-muted); }
.pae-row--error td { background: #fdecea !important; }

.pae-uvp-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: .75rem;
  font-weight: 700;
  vertical-align: middle;
}
.pae-status-ok    { color: var(--success-text); font-weight: 600; }
.pae-status-warn  { color: #7c5e00; }
.pae-status-error { color: var(--danger); font-weight: 600; }
.pae-status-muted { color: var(--text-muted); }
.pae-price, .pae-tax { white-space: nowrap; }
.pae-empty { color: var(--text-muted); font-style: italic; padding: 16px 0; }

/* ── Ordner-Umbenennen (details/summary) ───────────────────────── */
.inline-details { display: inline-block; position: relative; }
.inline-details summary {
  cursor: pointer;
  list-style: none;
}
.inline-details summary::-webkit-details-marker { display: none; }
.rename-form {
  position: absolute;
  z-index: 50;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  min-width: 240px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  top: calc(100% + 4px);
  left: 0;
}
.form-control-sm { padding: 4px 8px; font-size: .85rem; flex: 1; min-width: 120px; }
.action-cell { white-space: nowrap; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
