:root {
  --primary: #1f3f66;
  --primary-hover: #163252;
  --accent: #e46f1a;
  --bg-card: #ffffff;
  --bg-body: #f8fafc;
  --border-soft: #e2e8f0;
  --text-muted: #64748b;
  --text-dark: #1e293b;
  --success: #10b981;
  --warning: #f59e0b;
}

/* ===============================
   Base & Typography
================================ */
html {
  font-size: 16px;
}

main {
  background: #f4f8fc;
  padding: 2rem;
}


body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  letter-spacing: -0.015em;
  color: var(--text-dark);
  background: var(--bg-body);
  width: 100%;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

h1 {
  font-size: 2rem;
  margin-bottom: 1.25rem;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1.25rem;
  color: #334155;
}

small {
  font-size: 0.85rem;
  color: var(--text-muted);
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

/* ===============================
   Layout & Components
================================ */
.topbar {
  background: white;
  border-bottom: 1px solid #e5e5e5;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* obere Zeile */
.topbar-upper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  position: relative;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 150px;
}

/* Hamburger menu */
.hamburger-menu {
  position: relative;
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.hamburger-btn span {
  display: block;
  height: 2px;
  background: #444;
  border-radius: 2px;
  transition: background 0.2s;
}

.hamburger-btn:hover span {
  background: var(--primary);
}

.hamburger-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}

.hamburger-dropdown.open {
  display: block;
}

.hamburger-dropdown a {
  display: block;
  padding: 0.7rem 1.1rem;
  color: #374151;
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s;
}

.hamburger-dropdown a:hover {
  background: #f3f4f6;
  color: var(--primary);
}

/* Handbuch page extras */
.info-card h3 { color: #374151; font-size: 0.97rem; margin: 1.4rem 0 0.3rem; }
.info-card table { width: 100%; border-collapse: collapse; margin: 0.75rem 0 1rem; font-size: 0.9rem; }
.info-card th { background: #f8fafc; color: var(--primary); font-weight: 600; text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid #e5e7eb; }
.info-card td { padding: 0.45rem 0.75rem; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.info-card tr:last-child td { border-bottom: none; }
.info-card blockquote { background: #f0f6ff; border-left: 3px solid var(--primary); margin: 0.75rem 0; padding: 0.6rem 1rem; border-radius: 0 8px 8px 0; }
.info-card blockquote p { margin: 0; color: #1e3a5f; }
.info-card ol { color: #334155; line-height: 1.75; padding-left: 1.4rem; margin: 0 0 0.75rem; }
.info-card hr { border: none; border-top: 1px solid #e5e7eb; margin: 1.5rem 0; }
.info-card code { background: #f1f5f9; padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.87em; }

.topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.user-meta {
  font-size: 0.85rem;
  color: #666;
}

.user-meta .org {
  font-weight: 600;
}

.divider {
  margin: 0 6px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;

  max-width: 1000px;
  margin: 2rem auto;
  width: 100%;
}

.user-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  background: white;
  padding: 1.8rem 2rem;
  border-radius: 18px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.06);

  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.user-left {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.user-email {
  font-size: 0.95rem;
  color: #666;
}

.user-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.8rem;
}

.user-role {
  background: #eef4ff;
  color: #1f3f66;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.user-role.org_admin {
  background: #e6f0ff;
  color: #1f3f66;
}

.user-role.user {
  background: #f2f2f2;
  color: #666;
}

.user-action {
  font-size: 0.85rem;
  text-decoration: none;
  color: #1f3f66;
}

.delete-button {
  background: #ffeaea;
  color: #a33;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
}

.delete-button:hover {
  background: #ffd6d6;
}
.form-card {
  background: white;
  padding: 1.2rem 1.5rem;
  border-radius: 18px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.06);
  max-width: 1200px;
  margin: 1rem auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.full-width {
  grid-column: span 2;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
}

input,
select {
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-size: 0.95rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #1f3f66;
  box-shadow: 0 0 0 3px rgba(31,63,102,0.1);
}

.primary-button {
  background: #1f3f66;
  color: white;
  border: none;
  padding: 0.8rem 1.4rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.primary-button:hover {
  background: #163252;
}

.primary-button:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

.secondary-button {
  background: white;
  color: #1f3f66;
  border: 2px solid #1f3f66;
  padding: 0.8rem 1.4rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

.secondary-button:hover {
  background: #1f3f66;
  color: white;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 1.5rem;
}




/* untere Navigation */
.topbar-nav {
  display: flex;
  justify-content: center;   /* ← DAS fehlt */
  align-items: center;
  gap: 2rem;
  padding: 0.6rem 0;
  border-top: 1px solid #f0f0f0;
   width: 100%;     
}


.topbar-nav a {
  text-decoration: none;
  color: #444;
  font-weight: 500;
  padding-bottom: 4px;
  transition: 0.2s ease;
  display: flex;
  
  align-items: center;

}

.topbar-nav a:hover {
  color: var(--primary);
}

.topbar-nav a.active {
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
  display: flex;
  
  align-items: center;
}

/* Logos */
.logo-main {
  height: 68px;
  object-fit: contain;
}

.logo-org-wrapper {
  display: flex;
  align-items: center;
}

.logo-org {
  height: 40px;
  object-fit: contain;
}

.logo-clickable {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
}

.logo-clickable .logo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.42);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
}

.logo-clickable .logo-overlay::before {
  content: "ändern";
}

.logo-clickable:hover .logo-overlay {
  opacity: 1;
}

.logo-clickable.no-logo {
  border: 2px dashed #bbb;
  border-radius: 8px;
  min-width: 90px;
  height: 40px;
}

.logo-clickable.no-logo .logo-overlay {
  opacity: 1;
  background: transparent;
  color: #aaa;
}

.logo-clickable.no-logo .logo-overlay::before {
  content: "Logo hochladen";
}

.logo-clickable.no-logo:hover .logo-overlay {
  color: #555;
}

/* ── Hamburger Help-Menü ── */
.help-menu-wrapper {
  position: relative;
}

.help-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: #6b7280;
  padding: 3px 7px;
  border-radius: 6px;
  line-height: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.help-menu-btn:hover {
  color: var(--primary);
  background: #f3f4f6;
}

.help-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.help-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  min-width: 240px;
  z-index: 200;
  overflow: hidden;
}

.help-menu-dropdown.open {
  display: block;
}

.help-menu-dropdown a {
  display: block;
  padding: 0.75rem 1.1rem;
  color: #374151;
  text-decoration: none;
  font-size: 0.875rem;
  border-bottom: 1px solid #f3f4f6;
}

.help-menu-dropdown a:last-child {
  border-bottom: none;
}

.help-menu-dropdown a:hover {
  background: #f8fafc;
  color: var(--primary);
}

.logout {
  font-size: 0.82rem;
  color: #374151;
  text-decoration: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
}

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


/* Scroll-to-top button */
#scrollTopBtn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 200;
}

#scrollTopBtn.visible {
  opacity: 1;
  pointer-events: auto;
}

#scrollTopBtn:hover {
  background: #163252;
}

/*============================
Dashboard
==============================*/

.dashboard-section {
  margin: 0 2rem 2rem;
}

.dashboard-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.case-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.case-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;

  background: white;
  padding: 1.2rem 1.5rem;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.case-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0,0,0,0.08);
}

.case-card-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.case-cb-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.case-cb {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.case-cb-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 0.4rem 0.65rem;
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

.case-cb-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--primary);
}

.case-cb-wrap:hover .case-cb-tooltip {
  display: block;
}

.case-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.archive-button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
}

.archive-button:hover {
  opacity: 1;
}


/* optional Statusfarben */
.case-status.offen {
  background: #eee;
}

.case-status.in-pruefung {
  background: #ffe9a8;
}

.case-status.abgeschlossen {
  background: #c7f5d9;
}


/* ===============================
   Cards & Interactive Elements
================================ */
.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}

button {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: white;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn {
  background: white;
  color: var(--primary);
  padding: 0.9rem 1.8rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid var(--border-soft);
  transition: all 0.2s ease;
}

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

/* ===============================
   Hero Section
================================ */
.hero {
  padding: 8rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--bg-body) 0%, #e2e8f0 100%);
}

.hero .container {
  background: white;
  padding: 4rem 3rem;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  max-width: 900px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.3rem;
  color: #334155;
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero::after {
  content: "";
  display: block;
  width: 80px;
  height: 4px;
  background: var(--accent);
  margin: 3rem auto 0;
  border-radius: 2px;
}

/* ===============================
   Features & Client Summary
================================ */
.features {
  padding: 6rem 2rem;
  background: var(--bg-body);
}

.features .container {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.feature {
  background: white;
  padding: 2.5rem 2rem;
  border-radius: 16px;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.feature h3 {
  color: var(--accent);
  margin-bottom: 1rem;
}

.feature p {
  color: #334155;
  line-height: 1.6;
}

.client-summary {
  margin-top: 2.5rem;
  padding: 1.75rem 2rem;
  border-left: 4px solid var(--accent);
  background: #fef7ff;  /* Sehr helles Lila für Kontrast */
  border-radius: 12px;
}

.client-summary p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* ===============================
   Tables & Footer
================================ */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

th {
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-soft);
}

td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dark);
}

tr:hover {
  background: #f1f5f9;
}

footer {
  text-align: center;
  padding: 2.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: white;
  border-top: 1px solid var(--border-soft);
}

/* ===============================
   Responsive Adjustments
================================ */
@media (max-width: 1024px) {
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .container {
    padding: 1.2rem;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .features .container {
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  /* ── Header ── */
  .topbar-upper {
    padding: 0.4rem 0.75rem;
  }

  .topbar-left,
  .topbar-right {
    min-width: 0;
    gap: 0.5rem;
  }

  .logo-main {
    height: 44px;
  }

  .logo-org {
    height: 30px;
  }

  .topbar-center {
    /* Auf sehr kleinen Screens besser kein absolutes Zentrieren */
    position: static;
    transform: none;
    flex: 1;
    text-align: center;
    font-size: 0.78rem;
  }

  .user-meta {
    font-size: 0.75rem;
  }

  .topbar-nav {
    gap: 0.9rem;
    padding: 0.5rem 0.5rem;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .topbar-nav::-webkit-scrollbar {
    display: none;
  }

  .topbar-nav a {
    white-space: nowrap;
    font-size: 0.82rem;
    padding-bottom: 3px;
  }

  /* ── Layout ── */
  main {
    padding: 1rem 0.75rem;
  }

  .dashboard-section {
    margin: 0 0 1.5rem;
  }

  /* ── Tables ── */
  .table-wrapper,
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Cards ── */
  .hero .container {
    padding: 2rem 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  .case-card {
    padding: 0.9rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .case-right {
    gap: 0.75rem;
  }

  .intake-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .form-card {
    padding: 0.9rem 1rem;
    border-radius: 14px;
  }

  .analysis-card {
    padding: 1.25rem;
  }

  .internal-notes-card {
    padding: 1.25rem;
  }

  .user-card {
    padding: 1.2rem;
    flex-direction: column;
    gap: 0.75rem;
  }

  .user-right {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  /* ── Help Chat ── */
  .help-chat-panel {
    width: calc(100vw - 2rem);
    height: 420px;
  }
}

/*========================
Spinner
==========================*/
.spinner {
  width: 120px;
  height: 120px;
}

.compass {
  width: 100%;
  height: 100%;
}

.needle-anim {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform-origin: 50% 50%;
  -webkit-animation: needle-swing 3s ease-in-out infinite alternate;
  animation: needle-swing 3s ease-in-out infinite alternate;
}

.spinner {
  position: relative;
}

@-webkit-keyframes needle-swing {
  from { -webkit-transform: rotate(-60deg); transform: rotate(-60deg); }
  to   { -webkit-transform: rotate(60deg);  transform: rotate(60deg);  }
}
@keyframes needle-swing {
  from { transform: rotate(-60deg); }
  to   { transform: rotate(60deg);  }
}

.hidden {
  display: none;
}

.spinner.active .needle {
  animation: sweep 3.5s ease-in-out infinite alternate;
}

@keyframes sweep {
  from {
    transform: rotate(-60deg);
  }
  to {
    transform: rotate(60deg);
  }
}



/*==================
Cases
====================*/
.case-intake {
  margin-bottom: 3rem;
}

.intake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.8rem;
}

.intake-card {
  background: white;
  padding: 1.6rem;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.05);
}

.intake-card h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.intake-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f1f1f1;
}

.intake-row span:first-child {
  color: #666;
  font-size: 0.9rem;
}

.intake-row span:last-child {
  font-weight: 500;
  text-align: right;
}

.intake-card p {
  font-size: 0.95rem;
  line-height: 1.5;
}

.full-width {
  grid-column: 1 / -1;
}



.case-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.case-status {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #eee;
}

.edit-link {
  background: #eef4ff;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  color: #1f3f66;
}

.internal-hint-box {
  border: 2px solid #a8c8f0;
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  background: #ffffff;
  color: #555;
  font-size: 0.875rem;
  margin: 1.5rem 0 0;
}

.internal-notes-card {
  margin-top: 3rem;
  padding: 2.5rem;
  background: #ffffff;
  border: 2px solid #a8c8f0;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.05);
}

.internal-notes-card textarea {
  width: 100%;
  min-height: 88px;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
}

/*=====================
New Case
=======================*/
.form-card {
  background: white;
  padding: 1.2rem 1.5rem;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.05);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem 0.8rem;
}

@media (min-width: 1200px) {
  .form-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.form-section-title {
  grid-column: 1 / -1;
  margin-top: 1rem;
  margin-bottom: 0;
  font-size: 1rem;
}

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

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 0.9rem;
  width: 100%;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group input[name="Titel"] {
  border: 2px solid #a8c8f0;
}

.form-group input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 2.2rem;
  line-height: 1.5;
}

.form-hint {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: #94a3b8;
}

.form-hint-inline {
  font-size: 0.78rem;
  font-weight: normal;
  color: #94a3b8;
}

.checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  margin-top: 0.35rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.checklist-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.status-dropdown {
  border: none;
  border-radius: 999px;
  padding: 0.3rem 2rem 0.3rem 0.9rem; /* rechts mehr Platz für Pfeil */
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  appearance: none;

  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 10px;
}

/* kleines Pfeil-Dreieck als SVG */
.status-dropdown {
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%232d4a6e'>\
<path d='M5 7l5 6 5-6z'/></svg>");
}


/* Farben */
.status-dropdown.offen {
  background-color: #eee;
}

.status-dropdown.in-pruefung {
  background-color: #ffe9a8;
}

.status-dropdown.abgeschlossen {
  background-color: #c7f5d9;
}
.status-dropdown:hover {
  box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}



/*=====================
Analyse
======================*/
.hidden {
  display: none;
}

.analysis-meta {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #666;
}

.analysis-meta.empty {
  color: #999;
  font-style: italic;
}


.analysis-card {
  background: white;
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.05);
  margin-top: 3rem;
}

.analysis-card h2 {
  margin-bottom: 1rem;
}

.ai-disclaimer {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: #78350f;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.analysis-content {
  line-height: 1.7;
  font-size: 0.98rem;
}

/* Abschnitts-Überschriften (### im KI-Text) */
.analysis-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  font-size: 1.05rem;
  font-weight: 600;
}

/* Aufklappbarer Abschnitt (Rechtliche Einordnung) */
.collapsible-section {
  margin-top: 2rem;
  border: none;
}

.collapsible-section .collapsible-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.collapsible-section .collapsible-summary::-webkit-details-marker {
  display: none;
}

.collapsible-section .collapsible-summary::before {
  content: "▶";
  font-size: 0.6rem;
  color: #9ca3af;
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-top: 1px;
}

.collapsible-section[open] .collapsible-summary::before {
  transform: rotate(90deg);
}

.collapsible-section .collapsible-summary h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.collapsible-section .collapsible-summary:hover h3 {
  color: var(--primary);
}

.collapsible-body {
  padding-top: 0.25rem;
}

/* Absätze */
.analysis-content p {
  margin-bottom: 1rem;
}
.analysis-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.analysis-content ul {
  margin: 0.4rem 0 0.8rem 0;
  padding-left: 1rem;
  list-style: none;
}

.analysis-content li {
  margin-bottom: 0.4rem;
  padding-left: 1.2rem;
  text-indent: -1.2rem;
}

.analysis-content li::before {
  content: "• ";
}

.analysis-content .list-subheading {
  margin: 0.7rem 0 0.2rem 0;
  padding-left: 0;
}

.analysis-content ul.sub-list {
  margin: 0.2rem 0 0.4rem 0;
  padding-left: 1.2rem;
}

.analysis-content ul.sub-list li::before {
  content: "◦ ";
}

.client-summary-de,
.client-summary-foreign {
  line-height: 1.7;
}

.client-summary-de hr,
.client-summary-foreign hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 1.25rem 0;
}

.client-summary-de h2,
.client-summary-foreign h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #1f3f66;
  margin: 1.25rem 0 0.5rem;
}

.client-summary-de ol,
.client-summary-foreign ol {
  padding-left: 1.4rem;
}

.client-summary-foreign {
  border-top: 2px solid #e2e8f0;
  margin-top: 2rem;
  padding-top: 1.5rem;
}

.analysis-client-summary {
  border-left: 4px solid #1f3f66;
  background: #f4f8fc;
  padding: 1.6rem;
  border-radius: 14px;
  margin-top: 1.5rem;
}

.analysis-client-summary.rtl {
  direction: rtl;
  text-align: right;
}

.rtl {
  direction: rtl;
  text-align: right;
}

@media print {

 @media print {
  .topbar{
    margin-bottom: 2rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: 1rem;
  }
}

  .topbar-nav {
    display: none !important;
  }

  /* Case-Titel + Status + Bearbeiten */
  .case-header {
    display: none !important;
  }

  /* Zurück-Link */
  .back-link {
    display: none !important;
  }

  /* Optional: Analyse etwas kompakter */
  .analysis-card {
    box-shadow: none;
    padding: 0;
  }

  body {
    font-size: 11pt;
  }

  @page {
    margin: 1.5 cm;
  }
}

/*=================================
Case Form 
==================================*/
.case-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-title {
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
}

.form-section {
  background: #f9fbff;
  border-radius: 10px;
  padding: 0.4rem 0.8rem;
}

.form-section summary {
  font-weight: 600;
  cursor: pointer;
  padding: 0.3rem 0;
}

.form-section[open] summary {
  color: var(--primary);
}

.form-grid {
  display: grid;
  gap: 0.5rem 0.8rem;
  margin-top: 0.5rem;
}

/* Standard: 1 Spalte */
.form-grid {
  grid-template-columns: 1fr;
}

/* Ab 768px: 3 Spalten */
@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Ab 1200px: 4 Spalten */
@media (min-width: 1200px) {
  .form-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}


.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.form-group label {
  font-size: 0.8rem;
  color: #555;
}

.form-actions {
  margin-top: 0.6rem;
}

.full-width {
  grid-column: 1 / -1;
}

.case-block {
  max-width: 1200px;
  margin: 2rem auto;
  scroll-margin-top: 100px;
}

.form-meta {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #777;
}

/*========================
Verweisberatung
=========================*/

.block { border: 1px solid #ddd; border-radius: 8px; margin: 12px 0; }
.header { padding: 10px; background: #f3f3f3; cursor: pointer; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.content { display: none; padding: 10px; }
.content.open { display: block; }

.entry { display: flex; gap: 8px; padding: 6px 0; border-bottom: 2px solid #d1d5db; }
.star { cursor: pointer; font-size: 18px; user-select: none; }
.star.active { color: gold; }

.container { max-width: 900px; margin: 0 auto; padding: 24px; }
.card { border: 1px solid #ddd; border-radius: 8px; padding: 12px; margin-bottom: 16px; }

form.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

form.card label {
  font-weight: 600;
  margin-top: 10px;
  display:block;
}

.required {
  color: red;
}

#searchInput {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

form.card input,
form.card textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-top: 4px;
  font-size: 14px;
  transition: border .15s, box-shadow .15s;
}

form.card input:focus,
form.card textarea:focus {
  outline: none;
  border-color: #4c8bf5;
  box-shadow: 0 0 0 2px rgba(76,139,245,.15);
}

form.card button {
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #4c8bf5;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}

form.card button:hover {
  background: #3b76d8;
}

form.card button:active {
  transform: translateY(1px);
}

/* ── Entry Row Layout ────────────────────────────────── */
.entry {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid #d1d5db;
}

.entry-text {
  flex: 1;
}

.entry-meta {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: #bbb;
  text-align: right;
  line-height: 1.5;
}

/* ── Aktions-Buttons ─────────────────────────────────── */
.entry-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.entry:hover .entry-actions {
  opacity: 1;   /* Buttons nur bei Hover sichtbar – sieht aufgeräumter aus */
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.btn-icon:hover {
  background: #f0f0f0;
}

.btn-icon.btn-danger:hover {
  background: #fee2e2;
}

/* ── Inline Edit Form ────────────────────────────────── */
.edit-form-row {
  padding: 0.5rem 0 0.75rem 2rem; /* eingerückt wie der Eintrag */
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.edit-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
}

.edit-form textarea,
.edit-form input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.edit-form-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* ── Drag & Drop ─────────────────────────────────────── */
.entry[draggable="true"] { cursor: grab; }
.entry[draggable="true"]:active { cursor: grabbing; }
.entry.dragging { opacity: 0.35; }
@keyframes entry-flash { 0%,100%{background:transparent} 30%{background:#dbeafe} }
.entry.entry-new { animation: entry-flash 1.6s ease; }
.content.drop-over {
  background: #e8f0fe;
  outline: 2px dashed #4a7fc1;
  outline-offset: -4px;
  border-radius: 4px;
}
/* Alle Akkordeons während Drag sichtbar machen */
body.is-dragging-entry .content {
  display: block !important;
  min-height: 2rem;
}

.btn-primary {
  background: #1f3f66;
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.btn-primary:hover { background: #163252; }

.btn-secondary {
  background: #fff;
  color: #1f3f66;
  border: 1.5px solid #1f3f66;
  padding: 0.55rem 1.1rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.btn-secondary:hover { background: #f0f4fa; }

/* ──────────────────────────────────────
   Dokument-Bereich (Verweisberatung)
─────────────────────────────────────── */
.entry-docs {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.entry-docs a {
  color: #1f3f66;
  text-decoration: none;
}

.entry-docs a:hover {
  text-decoration: underline;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

.doc-del-btn {
  opacity: 1;
}

.doc-mail-btn {
  color: var(--primary);
  opacity: 1;
}

.doc-upload-btn {
  font-size: 0.78rem;
  color: #888;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-top: 0.3rem;
  display: block;
}

/* ── Verweisformular: Auswahl-Button ──────────── */
.form-add-btn {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.15rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #9ca3af;
  background: none;
  color: #6b7280;
  cursor: pointer;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

.entry:hover .form-add-btn,
.form-add-btn.form-selected {
  opacity: 1;
}

.form-add-btn.form-selected {
  background: #059669;
  border-color: #059669;
  color: white;
}

/* ── Floating-Bar ─────────────────────────────── */
.form-selection-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  border-radius: 12px;
  padding: 0.7rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  z-index: 500;
  font-size: 14px;
  white-space: nowrap;
}

.form-bar-count {
  font-weight: 500;
}

.form-bar-clear {
  background: none;
  border: 1px solid rgba(255,255,255,0.35);
  color: white;
  border-radius: 7px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  font-size: 13px;
}

.form-bar-clear:hover {
  background: rgba(255,255,255,0.1);
}

.form-bar-build {
  background: #2563eb;
  border: none;
  color: white;
  border-radius: 7px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.form-bar-build:hover {
  background: #1d4ed8;
}

.form-bar-email {
  background: #059669;
  border: none;
  color: white;
  border-radius: 7px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.form-bar-email:hover {
  background: #047857;
}

/* ===============================
   Help Chat Widget
================================ */
.help-chat-widget {
  position: fixed;
  bottom: 5rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.help-chat-fab {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(31, 63, 102, 0.4);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.help-chat-fab:hover {
  background: var(--primary-hover, #163252);
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(31, 63, 102, 0.5);
}

.help-chat-panel {
  display: none;
  flex-direction: column;
  width: 340px;
  height: 460px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-soft, #e2e8f0);
}

.help-chat-panel.open {
  display: flex;
}

.help-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: var(--primary);
  color: white;
  flex-shrink: 0;
}

.help-chat-header-title {
  font-weight: 600;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.help-chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
  opacity: 0.75;
  padding: 0.15rem 0.3rem;
  line-height: 1;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
}

.help-chat-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.help-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f8fafc;
}

.help-chat-msg {
  max-width: 90%;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.6;
  word-break: break-word;
}

.help-chat-msg.bot {
  background: white;
  border: 1px solid var(--border-soft, #e2e8f0);
  align-self: flex-start;
  border-top-left-radius: 4px;
  color: var(--text-dark, #1e293b);
}

.help-chat-msg.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-top-right-radius: 4px;
}

.help-chat-msg.loading {
  opacity: 0.55;
  font-style: italic;
}

.help-chat-input-row {
  display: flex;
  padding: 0.6rem;
  border-top: 1px solid var(--border-soft, #e2e8f0);
  gap: 0.4rem;
  background: white;
  flex-shrink: 0;
  align-items: center;
}

.help-chat-input {
  flex: 1;
  border: 1px solid var(--border-soft, #e2e8f0);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  color: var(--text-dark, #1e293b);
  transition: border-color 0.15s;
  min-width: 0;
}

.help-chat-input:focus {
  border-color: var(--primary);
}

.help-chat-send {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.help-chat-send:hover {
  background: var(--primary-hover, #163252);
}

.help-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


/* ── View Toggle Button ───────────────────────── */
.btn-view-toggle {
  height: 36px;
  padding: 0 0.75rem;
  border-radius: 8px;
  border: 1.5px solid #6b7280;
  background: #f9fafb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #374151;
  font-size: 0.82rem;
  font-weight: 600;
  flex-shrink: 0;
}
.btn-view-toggle:hover { background: #f3f4f6; border-color: #374151; }

/* ── Tile Layout ──────────────────────────────── */
.tiles-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 1rem;
}

/* Linke Spalte – Rubriken */
.tiles-cats {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tiles-cats-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
  padding: 0.1rem 0.2rem 0.25rem;
}

.cat-tile {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  background: var(--cat-bg);
  color: var(--cat-text);
  font-weight: 600;
  font-size: 0.8rem;
  border: 2px solid transparent;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.3;
}
.cat-tile:hover { border-color: var(--cat-accent); }
.cat-tile-active {
  border-color: var(--cat-accent) !important;
  box-shadow: 0 0 0 1px var(--cat-accent);
}
.cat-tile-name { flex: 1; }
.cat-tile-count {
  background: rgba(0,0,0,0.1);
  border-radius: 99px;
  font-size: 0.7rem;
  padding: 1px 6px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Rechte Spalte – Kacheln */
.tiles-entries {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.75rem;
  align-content: start;
}
.tiles-entries .edit-form-row {
  grid-column: 1 / -1;
}

.entry-tile {
  background: #fff;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-top: 3px solid var(--cat-accent);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: box-shadow 0.15s;
}
.entry-tile:hover { box-shadow: 0 3px 14px rgba(0,0,0,0.13); }

.entry-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.1rem;
}
.entry-tile-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #111827;
  line-height: 1.3;
}
.entry-tile-desc {
  font-size: 0.82rem;
  color: #374151;
  line-height: 1.55;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-tile-link {
  font-size: 0.78rem;
  color: var(--cat-accent);
  text-decoration: none;
  font-weight: 600;
  margin-top: 0.15rem;
}
.entry-tile-link:hover { text-decoration: underline; }
.entry-tile-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

@media (max-width: 640px) {
  .tiles-layout { flex-direction: column; }
  .tiles-cats { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .cat-tile { width: auto; flex: 1 1 auto; }
}

/* ── Tile: Form-Button immer sichtbar ─────────── */
.entry-tile .form-add-btn { opacity: 1; }
.entry-tile { cursor: pointer; }
.entry-tile-link-hint { font-size: 0.78rem; color: #6b7280; margin-top: 0.15rem; }

/* ── Kachel-Modal ─────────────────────────────── */
.tile-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.tile-modal {
  background: #fff;
  border-radius: 14px;
  width: min(560px, 100%);
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  overflow: hidden;
}
.tile-modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.85rem;
  border-top: 4px solid var(--cat-accent);
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.tile-modal-title {
  font-weight: 700; font-size: 1.05rem; color: #111827; line-height: 1.3; flex: 1;
}
.tile-modal-hdr-btns {
  display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0;
}
.tile-modal-hdr-btns .form-add-btn { opacity: 1; }
.tile-modal-close {
  flex-shrink: 0; width: 30px; height: 30px;
  border-radius: 8px; border: 1.5px solid #d1d5db;
  background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #374151; font-size: 1.1rem; line-height: 1;
}
.tile-modal-close:hover { background: #f3f4f6; border-color: #9ca3af; }
.tile-modal-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.tile-modal-desc {
  font-size: 0.9rem; color: #1f2937; line-height: 1.6; white-space: pre-wrap;
}
.tile-modal-link {
  font-size: 0.85rem; color: var(--cat-accent); word-break: break-all;
  text-decoration: none; font-weight: 500;
}
.tile-modal-link:hover { text-decoration: underline; }
.tile-modal-sep {
  font-size: 0.75rem; font-weight: 700; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding-top: 0.4rem; border-top: 1px solid #e5e7eb;
}
.tile-modal-footer {
  padding: 0.8rem 1.1rem;
  border-top: 1px solid #e5e7eb;
  display: flex; gap: 0.5rem; align-items: center;
  flex-shrink: 0; flex-wrap: wrap;
}
.tile-modal-footer .form-add-btn { opacity: 1; }

/* ── Modal: Drag & Drop ───────────────────────── */
.tile-modal-body { transition: background 0.15s; }
.tile-modal-body.docs-drag-over {
  background: #eff6ff;
  outline: 2px dashed #2563eb;
  outline-offset: -6px;
  border-radius: 8px;
}

/* ── Kachel: Datei-Drop ───────────────────────── */
.entry-tile.entry-dragging { opacity: 0.4; }
.cat-tile.cat-drop-target {
  outline: 2px dashed var(--cat-accent);
  outline-offset: -2px;
  opacity: 1;
}

.entry-tile.tile-drag-over {
  outline: 2px dashed var(--cat-accent);
  outline-offset: -3px;
  background: var(--cat-bg);
}
@keyframes tile-flash-green { 0%,100%{background:#fff} 40%{background:#d1fae5} }
.entry-tile.tile-upload-ok { animation: tile-flash-green 1.5s ease; }
