/* ==============================
   Lamon — Cittadinanza Italiana
   Mobile-first responsive CSS
   ============================== */

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

:root {
  --color-primary: #1e3a5f;
  --color-primary-light: #2c5282;
  --color-primary-dark: #152a45;
  --color-accent: #3182ce;
  --color-accent-hover: #2b6cb0;
  --color-bg: #f0f2f5;
  --color-surface: #ffffff;
  --color-text: #1a202c;
  --color-text-muted: #718096;
  --color-text-light: #a0aec0;
  --color-border: #e2e8f0;
  --color-border-light: #edf2f7;
  --color-success: #38a169;
  --color-error-bg: #fed7d7;
  --color-error-text: #9b2c2c;
  --color-error-border: #feb2b2;
  --color-badge-bg: #ebf4ff;
  --color-badge-text: #2b6cb0;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --header-height: 56px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

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

a:hover {
  color: var(--color-accent-hover);
}

/* --- App Header --- */
.app-header {
  background: var(--color-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.25rem;
}

.brand-text {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.75rem;
  opacity: 0.7;
  display: none;
}

/* --- Mobile Nav Toggle --- */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

/* --- Main Navigation --- */
.main-nav {
  display: none;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-primary);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  z-index: 99;
}

.main-nav.is-open {
  display: block;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-link {
  display: block;
  padding: 0.625rem 1.25rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link:focus {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-link-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.25rem;
}

.nav-username {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.logout-form {
  display: inline;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* --- Dashboard Welcome --- */
.dashboard-welcome {
  margin-bottom: 1.5rem;
}

.dashboard-welcome h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.dashboard-welcome p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* --- Progress Summary --- */
.progress-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.progress-summary-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.progress-summary-overall {
  margin-bottom: 1.25rem;
}

.progress-summary-overall-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.progress-summary-overall-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
}

.progress-summary-overall-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
}

.progress-bar-lg {
  height: 14px;
}

.progress-summary-modules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.progress-summary-module {
  padding: 0.5rem 0;
}

.progress-summary-module-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.progress-summary-module-icon {
  font-size: 0.9rem;
}

.progress-summary-module-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
  flex: 1;
}

.progress-summary-module-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

@media (min-width: 640px) {
  .progress-summary-modules {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .progress-summary-modules {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* --- Module Cards Grid --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.module-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  position: relative;
}

.module-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.card-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.375rem;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  flex: 1;
}

.card-badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-badge-text);
  background: var(--color-badge-bg);
  border-radius: 999px;
  align-self: flex-start;
}

.card-badge-info {
  color: #2a4365;
  background: #bee3f8;
}

/* --- Login Page --- */
.login-container {
  max-width: 400px;
  margin: 80px auto;
  padding: 2rem;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-container h1 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--color-primary);
}

.login-container h2 {
  text-align: center;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-text);
}

.form-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-stack);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-stack);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-primary {
  width: 100%;
  background: var(--color-accent);
  color: #fff;
  margin-top: 0.5rem;
}

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

.btn-primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.3);
}

/* --- Alerts --- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border: 1px solid var(--color-error-border);
}

/* --- Footer --- */
.app-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 1rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.footer-version {
  color: var(--color-text-light);
}

/* --- Error Pages --- */
.error-container {
  max-width: 500px;
  margin: 80px auto;
  padding: 2rem;
  text-align: center;
}

.error-container h1 {
  font-size: 2rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.error-container p {
  color: var(--color-text-muted);
}

/* --- Page Header --- */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* --- Sibling Filter Tabs --- */
.sibling-filter {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

.filter-tab {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-tab:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.filter-tab-active {
  color: #fff;
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.filter-tab-active:hover {
  color: #fff;
}

/* --- Status Badges --- */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 999px;
  white-space: nowrap;
}

.status-missing {
  background: #fed7d7;
  color: #9b2c2c;
}

.status-obtained {
  background: #fefcbf;
  color: #975a16;
}

.status-apostilled {
  background: #c6f6d5;
  color: #276749;
}

.status-translated {
  background: #bee3f8;
  color: #2a4365;
}

.status-complete {
  background: #c6f6d5;
  color: #22543d;
}

.status-na {
  background: var(--color-border-light);
  color: var(--color-text-light);
}

/* --- Category Badges --- */
.category-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
}

.category-shared {
  background: #ebf4ff;
  color: #2b6cb0;
}

.category-personal {
  background: #faf5ff;
  color: #6b46c1;
}

/* --- Document Cards (mobile) --- */
.doc-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.doc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.doc-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.doc-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.3;
}

.doc-card-subtitle {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.doc-card-status {
  margin-top: 0.5rem;
}

.sibling-status-row {
  display: flex;
  gap: 0.375rem;
}

.sibling-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: default;
}

.sibling-dot.status-missing {
  background: #fed7d7;
  color: #9b2c2c;
}

.sibling-dot.status-obtained {
  background: #fefcbf;
  color: #975a16;
}

.sibling-dot.status-apostilled,
.sibling-dot.status-complete {
  background: #c6f6d5;
  color: #22543d;
}

.sibling-dot.status-translated {
  background: #bee3f8;
  color: #2a4365;
}

.sibling-dot-label {
  line-height: 1;
}

/* --- Document Table (desktop) --- */
.doc-table-wrapper {
  display: none;
  margin-bottom: 1.5rem;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.doc-table thead {
  background: var(--color-primary);
  color: #fff;
}

.doc-table th {
  padding: 0.625rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  letter-spacing: 0.02em;
}

.doc-table th.th-sibling {
  text-align: center;
  min-width: 80px;
}

.doc-table td {
  padding: 0.625rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.doc-table td.td-shared {
  text-align: center;
}

.doc-table tbody tr:hover {
  background: var(--color-border-light);
}

.doc-table tbody tr:last-child td {
  border-bottom: none;
}

.doc-name {
  font-weight: 500;
  color: var(--color-text);
}

.doc-name-it {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 0.125rem;
}

/* --- Back Link --- */
.back-link {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-accent);
  font-weight: 500;
}

.back-link:hover {
  color: var(--color-accent-hover);
}

/* --- Per-Sibling Document Cards --- */
.sibling-doc-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sibling-doc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.sibling-doc-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sibling-doc-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.125rem;
}

.sibling-doc-subtitle {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 0.375rem;
}

/* --- Status Stages --- */
.status-stages {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 0.625rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.stage {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.stage-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stage-date {
  font-size: 0.7rem;
  color: var(--color-text-light);
}

/* Sub-status badges */
.status-substatus-pending {
  background: #fefcbf;
  color: #975a16;
}

.status-substatus-done {
  background: #c6f6d5;
  color: #22543d;
}

.status-substatus-not_applicable {
  background: var(--color-border-light);
  color: var(--color-text-light);
}

/* --- Document Notes --- */
.doc-notes {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 0.5rem;
  background: #fffbeb;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

/* --- Status Update Form --- */
.status-update-form {
  border-top: 1px solid var(--color-border-light);
  padding-top: 0.75rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

.form-group-inline {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 120px;
}

.form-group-inline label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group-inline select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-stack);
  color: var(--color-text);
  background: var(--color-surface);
}

.form-group-inline select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.15);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-update {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-stack);
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}

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

/* --- Next Actions Panel --- */
.next-actions {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.next-actions-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.next-actions-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.next-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.next-action-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-border);
}

.next-action-item.priority-high {
  border-left-color: #e53e3e;
}

.next-action-item.priority-medium {
  border-left-color: #dd6b20;
}

.next-action-item.priority-low {
  border-left-color: var(--color-text-light);
}

.next-action-info {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  min-width: 200px;
}

.next-action-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.next-action-sibling {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.next-action-step {
  font-size: 0.8rem;
  color: var(--color-accent);
  font-weight: 500;
}

.priority-badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
}

.priority-badge-high {
  background: #fed7d7;
  color: #9b2c2c;
}

.priority-badge-medium {
  background: #feebc8;
  color: #9c4221;
}

.priority-badge-low {
  background: var(--color-border-light);
  color: var(--color-text-light);
}

/* ========================
   Responsive Breakpoints
   ======================== */

/* Tablet — 768px+ */
@media (min-width: 768px) {
  .doc-cards {
    display: none;
  }

  .doc-table-wrapper {
    display: block;
  }

  .page-header h1 {
    font-size: 1.75rem;
  }
  .brand-subtitle {
    display: inline;
  }

  .nav-toggle {
    display: none;
  }

  .main-nav {
    display: flex;
    position: static;
    border-top: none;
    box-shadow: none;
    padding: 0;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
  }

  .nav-list {
    display: flex;
    gap: 0;
  }

  .nav-link {
    padding: 0.375rem 0.625rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
  }

  .nav-link:hover,
  .nav-link:focus {
    background: rgba(255, 255, 255, 0.1);
  }

  .nav-user {
    border-top: none;
    margin-top: 0;
    padding: 0;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-content {
    padding: 2rem 1.5rem;
  }
}

/* Desktop — 1024px+ */
@media (min-width: 1024px) {
  .header-inner {
    padding: 0 1.5rem;
  }

  .nav-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
  }

  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  .dashboard-welcome h1 {
    font-size: 1.75rem;
  }
}

/* Wide — 1280px+ */
@media (min-width: 1280px) {
  .dashboard-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==============================
   Legal Intelligence Hub
   ============================== */

/* --- Section titles --- */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.section-desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* --- Risk Assessment Banner --- */
.legal-risk-banner {
  background: var(--color-surface);
  border: 2px solid #ed8936;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.risk-scenarios-grid {
  display: grid;
  gap: 1rem;
}

.risk-scenario-card {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border-left: 4px solid var(--color-border);
}

.risk-scenario-optimal { border-left-color: var(--color-success); }
.risk-scenario-good { border-left-color: #3182ce; }
.risk-scenario-neutral { border-left-color: #a0aec0; }
.risk-scenario-negative { border-left-color: #e53e3e; }
.risk-scenario-critical { border-left-color: #9b2c2c; }

.risk-scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.risk-scenario-name {
  font-size: 1rem;
  font-weight: 600;
}

.probability-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.probability-high { background: #fed7d7; color: #9b2c2c; }
.probability-medium { background: #fefcbf; color: #975a16; }
.probability-low { background: #c6f6d5; color: #276749; }

.impact-level-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.impact-level-optimal { background: #c6f6d5; color: #276749; }
.impact-level-good { background: #bee3f8; color: #2a4365; }
.impact-level-neutral { background: #e2e8f0; color: #4a5568; }
.impact-level-negative { background: #fed7d7; color: #9b2c2c; }
.impact-level-critical { background: #feb2b2; color: #742a2a; }

.risk-scenario-desc {
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.risk-scenario-action {
  font-size: 0.85rem;
  background: var(--color-surface);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
  line-height: 1.5;
}

/* --- Court Timeline --- */
.legal-timeline {
  margin-bottom: 2rem;
}

.court-timeline {
  list-style: none;
  position: relative;
  padding-left: 2rem;
}

.court-timeline::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-marker {
  position: absolute;
  left: -1.6rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-surface);
}

.timeline-completed .timeline-marker { background: var(--color-success); }
.timeline-pending .timeline-marker { background: #ed8936; }

.timeline-content {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.timeline-event {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.25rem 0;
}

.timeline-desc {
  font-size: 0.875rem;
  color: var(--color-text);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.timeline-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.timeline-status-completed { background: #c6f6d5; color: #276749; }
.timeline-status-pending { background: #fefcbf; color: #975a16; }

/* --- Legal Feed --- */
.legal-entries-list {
  display: grid;
  gap: 1rem;
}

.legal-entry-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}

.legal-entry-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.legal-entry-date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.category-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.category-court_ruling { background: #e9d8fd; color: #553c9a; }
.category-legislation { background: #fefcbf; color: #975a16; }
.category-case_law { background: #bee3f8; color: #2a4365; }
.category-community_intel { background: #c6f6d5; color: #276749; }
.category-analysis { background: #e2e8f0; color: #4a5568; }

.impact-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.impact-positive { background: #c6f6d5; color: #276749; }
.impact-negative { background: #fed7d7; color: #9b2c2c; }
.impact-neutral { background: #e2e8f0; color: #4a5568; }
.impact-pending { background: #fefcbf; color: #975a16; }

.legal-entry-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.legal-entry-summary {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.legal-entry-impact {
  font-size: 0.85rem;
  background: #ebf8ff;
  border: 1px solid #bee3f8;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.legal-entry-source {
  margin-top: 0.5rem;
}

.source-link {
  font-size: 0.85rem;
  color: var(--color-accent);
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

/* --- Responsive: legal page --- */
@media (min-width: 768px) {
  .risk-scenarios-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* ==============================
   Genealogy — Family Tree
   ============================== */

/* --- Tree Container & Generations --- */
.family-tree {
  margin-bottom: 2rem;
}

.tree-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding: 1rem 0;
}

.tree-generation {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding-bottom: 2rem;
}

/* Vertical connector line between generations */
.tree-generation:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 2rem;
  background: var(--color-border);
}

.generation-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  text-align: center;
}

.generation-members {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  position: relative;
}

/* Horizontal connector between siblings/spouses */
.generation-members::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 1.5rem;
  right: 1.5rem;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
  display: none;
}

/* Show horizontal connector when multiple members */
.generation-members:has(.person-card:nth-child(2))::before {
  display: block;
}

/* --- Person Card --- */
.person-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  min-width: 180px;
  max-width: 220px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.person-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
}

.person-card.person-M {
  border-top: 3px solid var(--color-accent);
}

.person-card.person-F {
  border-top: 3px solid #d53f8c;
}

.person-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.birth-name {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--color-text-muted);
  font-style: italic;
}

.person-dates {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.person-birth,
.person-death {
  white-space: nowrap;
}

.person-place {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-bottom: 0.25rem;
}

.person-notes {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px solid var(--color-border-light);
}

/* --- Empty State --- */
.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
  font-style: italic;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

/* ==============================
   Genealogy — Research Tasks
   ============================== */

.research-tasks {
  margin-bottom: 2rem;
}

.task-priority-group {
  margin-bottom: 1.5rem;
}

.priority-heading {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

.priority-heading.priority-A {
  background: #fff5f5;
  color: #9b2c2c;
  border-left: 4px solid #e53e3e;
}

.priority-heading.priority-B {
  background: #fffaf0;
  color: #9c4221;
  border-left: 4px solid #ed8936;
}

.priority-heading.priority-C {
  background: #ebf8ff;
  color: #2a4365;
  border-left: 4px solid #3182ce;
}

.priority-count {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.task-card.task-status-done {
  opacity: 0.7;
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
  gap: 0.5rem;
}

.task-code {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
  font-family: monospace;
  background: var(--color-bg);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
}

.task-status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  white-space: nowrap;
}

.task-status-badge.status-open {
  background: #e2e8f0;
  color: #4a5568;
}

.task-status-badge.status-in_progress {
  background: #fefcbf;
  color: #975a16;
}

.task-status-badge.status-done {
  background: #c6f6d5;
  color: #22543d;
}

.task-status-badge.status-blocked {
  background: #fed7d7;
  color: #9b2c2c;
}

.task-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.task-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.375rem;
}

.task-where {
  font-size: 0.78rem;
  color: var(--color-text);
  padding: 0.5rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin-top: 0.375rem;
}

.task-where strong {
  color: var(--color-primary);
}

/* ==============================
   Genealogy — Sources
   ============================== */

.research-sources {
  margin-bottom: 2rem;
}

.sources-list {
  display: grid;
  gap: 0.75rem;
}

.source-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.source-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary);
}

.source-type-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  white-space: nowrap;
}

.source-type-archive {
  background: #faf5ff;
  color: #6b46c1;
}

.source-type-database {
  background: #ebf4ff;
  color: #2b6cb0;
}

.source-type-library {
  background: #fefcbf;
  color: #975a16;
}

.source-type-government {
  background: #c6f6d5;
  color: #276749;
}

.source-type-newspaper {
  background: #e2e8f0;
  color: #4a5568;
}

.source-type-other {
  background: var(--color-border-light);
  color: var(--color-text-muted);
}

.source-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.source-card .source-link {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--color-accent);
  font-weight: 500;
}

.source-card .source-link:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* ==============================
   Genealogy — Mobile Responsive
   ============================== */

@media (max-width: 768px) {
  /* Vertical tree layout on mobile */
  .tree-container {
    padding-left: 0.5rem;
  }

  .tree-generation {
    align-items: flex-start;
    padding-left: 1rem;
    padding-bottom: 1rem;
    border-left: 2px solid var(--color-border);
    margin-left: 0.5rem;
  }

  .tree-generation:last-child {
    border-left-color: transparent;
  }

  .tree-generation::after {
    display: none !important;
  }

  .tree-generation::before {
    content: '';
    position: absolute;
    top: 1rem;
    left: -6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-surface);
  }

  .generation-members {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .generation-members::before {
    display: none !important;
  }

  .person-card {
    max-width: 100%;
    min-width: 0;
    text-align: left;
  }

  .person-dates {
    justify-content: flex-start;
  }

  /* Single-column tasks and sources */
  .sources-list {
    grid-template-columns: 1fr;
  }
}

/* Tablet+ sources grid */
@media (min-width: 768px) {
  .sources-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .person-card {
    min-width: 200px;
  }
}

/* =============================
   Geschwister — Sibling Cards
   ============================= */

.sibling-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding: 0 0 2rem;
}

.sibling-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}

.sibling-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--color-primary);
  color: #fff;
}

.sibling-card-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

/* PoA Status Badges */
.poa-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.poa-not-started {
  background: #fed7d7;
  color: #9b2c2c;
}

.poa-sent {
  background: #fefcbf;
  color: #975a16;
}

.poa-signed {
  background: var(--color-badge-bg);
  color: var(--color-badge-text);
}

.poa-notarized {
  background: #c6f6d5;
  color: #276749;
}

.sibling-card-body {
  padding: 1rem 1.25rem;
}

.sibling-section {
  margin-bottom: 1.25rem;
}

.sibling-section:last-child {
  margin-bottom: 0;
}

.sibling-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--color-border-light);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 0;
}

.progress-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Budget Section */
.budget-row {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  font-size: 0.9rem;
}

.budget-label {
  color: var(--color-text-muted);
}

.budget-value {
  font-weight: 500;
}

.budget-balance {
  border-top: 1px solid var(--color-border-light);
  margin-top: 0.25rem;
  padding-top: 0.35rem;
  font-weight: 600;
}

.budget-positive {
  color: var(--color-success);
}

.budget-negative {
  color: #e53e3e;
}

/* Action Items */
.action-count {
  font-size: 0.7rem;
  font-weight: 500;
  background: #fefcbf;
  color: #975a16;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  text-transform: none;
  letter-spacing: normal;
}

.action-items-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.action-item-done {
  opacity: 0.5;
  text-decoration: line-through;
}

.action-status-icon {
  flex-shrink: 0;
  width: 1.2em;
  text-align: center;
  color: var(--color-text-muted);
}

.action-item-done .action-status-icon {
  color: var(--color-success);
}

.no-items {
  font-size: 0.85rem;
  color: var(--color-text-light);
  font-style: italic;
}

/* Responsive: 2 cols on tablet, 4 on desktop */
@media (min-width: 640px) {
  .sibling-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* --- Communications Page --- */

/* Category badge colors */
.category-lawyer {
  background: #ebf4ff;
  color: #2b6cb0;
}

.category-civil_registry {
  background: #c6f6d5;
  color: #276749;
}

.category-archive {
  background: #feebc8;
  color: #9c4221;
}

.category-sibling {
  background: #e9d8fd;
  color: #6b46c1;
}

.category-other {
  background: var(--color-border-light);
  color: var(--color-text-light);
}

/* Communication status badges */
.comm-status-draft {
  background: #edf2f7;
  color: #4a5568;
}

.comm-status-sent {
  background: #bee3f8;
  color: #2a4365;
}

.comm-status-responded {
  background: #c6f6d5;
  color: #22543d;
}

.comm-status-closed {
  background: var(--color-border-light);
  color: var(--color-text-light);
}

/* Status summary banner */
.comm-status-banner {
  margin-bottom: 1.5rem;
}

.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.2rem;
}

/* Communications table */
.comm-table-section {
  margin-bottom: 2rem;
}

.comm-subject {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.response-notes {
  color: var(--color-text-light);
  font-style: italic;
}

.input-sm {
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
  width: 120px;
}

/* Mobile card view */
.comm-cards-section {
  display: none;
}

.comm-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.comm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.comm-card-subject {
  font-size: 1rem;
  margin: 0 0 0.3rem;
}

.comm-card-recipient {
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
  color: var(--color-text-muted);
}

.comm-card-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
}

.comm-card-notes {
  color: var(--color-text-light);
  font-style: italic;
  margin: 0.3rem 0;
}

.comm-card-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.5rem;
}

/* Add communication form */
.add-comm-section {
  margin-top: 2rem;
}

.add-comm-form .form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.add-comm-form .form-group {
  flex: 1;
  min-width: 200px;
}

/* Responsive: show cards on mobile, table on desktop */
@media (max-width: 768px) {
  .comm-table-section {
    display: none;
  }
  .comm-cards-section {
    display: block;
  }
}

/* ============================================================
   Zeitplan / Gantt Timeline
   ============================================================ */

.gantt-container {
  margin-bottom: 2rem;
}

.gantt-chart {
  overflow-x: auto;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  background: #fff;
}

.gantt-header {
  display: flex;
  border-bottom: 2px solid var(--color-border, #e2e8f0);
  background: var(--color-bg-subtle, #f7fafc);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted, #718096);
}

.gantt-label-col {
  min-width: 240px;
  max-width: 240px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.gantt-timeline-cols {
  display: flex;
  flex: 1;
  min-width: 0;
}

.gantt-month-header {
  flex: 1;
  min-width: 28px;
  text-align: center;
  padding: 0.25rem 0;
  border-left: 1px solid var(--color-border, #e2e8f0);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gantt-month-header.gantt-year-start {
  border-left: 2px solid var(--color-text-muted, #718096);
}

.gantt-month-short {
  font-size: 0.7rem;
}

.gantt-year-label {
  font-size: 0.65rem;
  color: var(--color-primary, #2b6cb0);
  font-weight: 700;
}

.gantt-row {
  display: flex;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
  align-items: center;
  min-height: 44px;
}

.gantt-row:last-child {
  border-bottom: none;
}

.gantt-row:hover {
  background: var(--color-bg-subtle, #f7fafc);
}

.gantt-phase-icon {
  font-size: 1.1rem;
}

.gantt-phase-name {
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-phase-pct {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary, #2b6cb0);
  margin-left: auto;
}

.gantt-cell {
  flex: 1;
  min-width: 28px;
  height: 32px;
  border-left: 1px solid var(--color-border, #e2e8f0);
  position: relative;
}

.gantt-cell-active {
  background: rgba(66, 153, 225, 0.06);
}

.gantt-bar {
  position: absolute;
  top: 4px;
  left: 0;
  height: 24px;
  border-radius: 4px;
  background: var(--color-bg-subtle, #e2e8f0);
  overflow: hidden;
  z-index: 1;
}

.gantt-bar-fill {
  height: 100%;
  background: var(--color-primary, #4299e1);
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.gantt-row-abgeschlossen .gantt-bar-fill {
  background: var(--color-success, #48bb78);
}

.gantt-row-in-bearbeitung {
  background: rgba(66, 153, 225, 0.04);
  border-left: 3px solid var(--color-primary, #4299e1);
}

.gantt-row-in-bearbeitung .gantt-bar-fill {
  background: var(--color-primary, #4299e1);
}

.gantt-row-nicht-gestartet .gantt-bar {
  background: #edf2f7;
}

.gantt-row-keine-daten .gantt-bar {
  background: #fed7d7;
}

.gantt-status-col {
  min-width: 120px;
  padding: 0 0.5rem;
  flex-shrink: 0;
}

.gantt-status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.gantt-status-abgeschlossen {
  background: #c6f6d5;
  color: #276749;
}

.gantt-status-in-bearbeitung {
  background: #bee3f8;
  color: #2a4365;
}

.gantt-status-nicht-gestartet {
  background: #edf2f7;
  color: #718096;
}

.gantt-status-keine-daten {
  background: #fed7d7;
  color: #9b2c2c;
}

/* Legend */
.gantt-legend {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--color-text-muted, #718096);
}

.gantt-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.gantt-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.gantt-legend-complete {
  background: var(--color-success, #48bb78);
}

.gantt-legend-progress {
  background: var(--color-primary, #4299e1);
}

.gantt-legend-notstarted {
  background: #edf2f7;
  border: 1px solid #e2e8f0;
}

/* Phase Cards */
.gantt-phase-cards {
  margin-bottom: 2rem;
}

.gantt-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.gantt-phase-card {
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

.gantt-phase-card-in-bearbeitung {
  border-color: var(--color-primary, #4299e1);
  box-shadow: 0 0 0 1px var(--color-primary, #4299e1), 0 2px 8px rgba(66, 153, 225, 0.15);
}

.gantt-phase-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.gantt-phase-card-header h3 {
  font-size: 0.95rem;
  margin: 0;
  flex: 1;
}

.gantt-phase-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gantt-phase-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.gantt-phase-progress-bar {
  flex: 1;
  height: 8px;
  background: #edf2f7;
  border-radius: 4px;
  overflow: hidden;
}

.gantt-phase-progress-fill {
  height: 100%;
  background: var(--color-primary, #4299e1);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.gantt-phase-card-abgeschlossen .gantt-phase-progress-fill {
  background: var(--color-success, #48bb78);
}

.gantt-phase-progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary, #2b6cb0);
  min-width: 3rem;
  text-align: right;
}

.gantt-phase-dates {
  font-size: 0.8rem;
  color: var(--color-text-muted, #718096);
}

.gantt-phase-detail {
  font-size: 0.8rem;
  color: var(--color-text-muted, #718096);
  margin-top: 0.25rem;
}

.gantt-phase-nodata {
  font-size: 0.8rem;
  color: #e53e3e;
  font-style: italic;
  margin-top: 0.25rem;
}

/* Next Actions */
.gantt-next-actions {
  margin-bottom: 2rem;
}

.gantt-actions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.gantt-action-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
  font-size: 0.9rem;
}

.gantt-action-item:last-child {
  border-bottom: none;
}

.gantt-action-icon {
  font-size: 1rem;
}

.gantt-action-text {
  flex: 1;
  color: var(--color-text, #2d3748);
}

.gantt-action-phase {
  font-weight: 600;
  color: var(--color-primary, #2b6cb0);
}

.gantt-no-actions {
  color: var(--color-text-muted, #718096);
  font-style: italic;
}

/* Mobile responsive — Gantt & Timeline */
@media (max-width: 768px) {
  .gantt-chart {
    display: none;
  }

  .gantt-legend {
    display: none;
  }

  .gantt-label-col {
    min-width: 180px;
    max-width: 180px;
  }

  .gantt-cards-grid {
    grid-template-columns: 1fr;
  }

  .gantt-phase-card {
    padding: 0.85rem;
  }

  .gantt-action-item {
    flex-wrap: wrap;
    font-size: 0.85rem;
  }

  .gantt-action-phase {
    width: 100%;
    margin-bottom: 0.15rem;
  }

  .gantt-next-actions h2 {
    font-size: 1.1rem;
  }

  .progress-summary {
    padding: 1rem;
  }

  .progress-summary-overall-value {
    font-size: 1.25rem;
  }
}

/* Gantt bar span width classes (number of months * 100%) */
.gantt-bar-span-1 { width: calc(1 * 100%); }
.gantt-bar-span-2 { width: calc(2 * 100%); }
.gantt-bar-span-3 { width: calc(3 * 100%); }
.gantt-bar-span-4 { width: calc(4 * 100%); }
.gantt-bar-span-5 { width: calc(5 * 100%); }
.gantt-bar-span-6 { width: calc(6 * 100%); }
.gantt-bar-span-7 { width: calc(7 * 100%); }
.gantt-bar-span-8 { width: calc(8 * 100%); }
.gantt-bar-span-9 { width: calc(9 * 100%); }
.gantt-bar-span-10 { width: calc(10 * 100%); }
.gantt-bar-span-11 { width: calc(11 * 100%); }
.gantt-bar-span-12 { width: calc(12 * 100%); }
.gantt-bar-span-13 { width: calc(13 * 100%); }
.gantt-bar-span-14 { width: calc(14 * 100%); }
.gantt-bar-span-15 { width: calc(15 * 100%); }
.gantt-bar-span-16 { width: calc(16 * 100%); }
.gantt-bar-span-17 { width: calc(17 * 100%); }
.gantt-bar-span-18 { width: calc(18 * 100%); }

/* Judgment, Appeal & CONA sections */
.judgment-section,
.appeal-section,
.cona-section {
  margin-bottom: 2rem;
}

/* Judgment outcome badges */
.status-judgment-positiv {
  background: #c6f6d5;
  color: #22543d;
}

.status-judgment-negativ {
  background: #fed7d7;
  color: #9b2c2c;
}

.status-judgment-teilweise {
  background: #fefcbf;
  color: #975a16;
}

/* Appeal countdown */
.appeal-days-positive {
  color: var(--color-accent);
}

.appeal-days-expired {
  color: #e53e3e;
}

/* CONA status badges */
.status-cona-beantragt {
  background: #fefcbf;
  color: #975a16;
}

.status-cona-ausgestellt {
  background: #c6f6d5;
  color: #22543d;
}

/* Form helper text */
.form-help {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* Edit form subheadings */
.edit-form h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border-light);
}

/* Form select styling */
.form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-stack);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

/* Form textarea styling */
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-stack);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

/* Court case edit form toggle */
.edit-form-hidden {
  display: none;
}

.edit-form {
  margin-top: 1rem;
}

.case-details-section,
.milestone-summary-section,
.case-edit-section,
.case-status-section {
  margin-bottom: 2rem;
}

/* Gantt percentage width classes (0-100) */
.gantt-w-0 { width: 0%; }
.gantt-w-1 { width: 1%; } .gantt-w-2 { width: 2%; } .gantt-w-3 { width: 3%; } .gantt-w-4 { width: 4%; } .gantt-w-5 { width: 5%; }
.gantt-w-6 { width: 6%; } .gantt-w-7 { width: 7%; } .gantt-w-8 { width: 8%; } .gantt-w-9 { width: 9%; } .gantt-w-10 { width: 10%; }
.gantt-w-11 { width: 11%; } .gantt-w-12 { width: 12%; } .gantt-w-13 { width: 13%; } .gantt-w-14 { width: 14%; } .gantt-w-15 { width: 15%; }
.gantt-w-16 { width: 16%; } .gantt-w-17 { width: 17%; } .gantt-w-18 { width: 18%; } .gantt-w-19 { width: 19%; } .gantt-w-20 { width: 20%; }
.gantt-w-21 { width: 21%; } .gantt-w-22 { width: 22%; } .gantt-w-23 { width: 23%; } .gantt-w-24 { width: 24%; } .gantt-w-25 { width: 25%; }
.gantt-w-26 { width: 26%; } .gantt-w-27 { width: 27%; } .gantt-w-28 { width: 28%; } .gantt-w-29 { width: 29%; } .gantt-w-30 { width: 30%; }
.gantt-w-31 { width: 31%; } .gantt-w-32 { width: 32%; } .gantt-w-33 { width: 33%; } .gantt-w-34 { width: 34%; } .gantt-w-35 { width: 35%; }
.gantt-w-36 { width: 36%; } .gantt-w-37 { width: 37%; } .gantt-w-38 { width: 38%; } .gantt-w-39 { width: 39%; } .gantt-w-40 { width: 40%; }
.gantt-w-41 { width: 41%; } .gantt-w-42 { width: 42%; } .gantt-w-43 { width: 43%; } .gantt-w-44 { width: 44%; } .gantt-w-45 { width: 45%; }
.gantt-w-46 { width: 46%; } .gantt-w-47 { width: 47%; } .gantt-w-48 { width: 48%; } .gantt-w-49 { width: 49%; } .gantt-w-50 { width: 50%; }
.gantt-w-51 { width: 51%; } .gantt-w-52 { width: 52%; } .gantt-w-53 { width: 53%; } .gantt-w-54 { width: 54%; } .gantt-w-55 { width: 55%; }
.gantt-w-56 { width: 56%; } .gantt-w-57 { width: 57%; } .gantt-w-58 { width: 58%; } .gantt-w-59 { width: 59%; } .gantt-w-60 { width: 60%; }
.gantt-w-61 { width: 61%; } .gantt-w-62 { width: 62%; } .gantt-w-63 { width: 63%; } .gantt-w-64 { width: 64%; } .gantt-w-65 { width: 65%; }
.gantt-w-66 { width: 66%; } .gantt-w-67 { width: 67%; } .gantt-w-68 { width: 68%; } .gantt-w-69 { width: 69%; } .gantt-w-70 { width: 70%; }
.gantt-w-71 { width: 71%; } .gantt-w-72 { width: 72%; } .gantt-w-73 { width: 73%; } .gantt-w-74 { width: 74%; } .gantt-w-75 { width: 75%; }
.gantt-w-76 { width: 76%; } .gantt-w-77 { width: 77%; } .gantt-w-78 { width: 78%; } .gantt-w-79 { width: 79%; } .gantt-w-80 { width: 80%; }
.gantt-w-81 { width: 81%; } .gantt-w-82 { width: 82%; } .gantt-w-83 { width: 83%; } .gantt-w-84 { width: 84%; } .gantt-w-85 { width: 85%; }
.gantt-w-86 { width: 86%; } .gantt-w-87 { width: 87%; } .gantt-w-88 { width: 88%; } .gantt-w-89 { width: 89%; } .gantt-w-90 { width: 90%; }
.gantt-w-91 { width: 91%; } .gantt-w-92 { width: 92%; } .gantt-w-93 { width: 93%; } .gantt-w-94 { width: 94%; } .gantt-w-95 { width: 95%; }
.gantt-w-96 { width: 96%; } .gantt-w-97 { width: 97%; } .gantt-w-98 { width: 98%; } .gantt-w-99 { width: 99%; } .gantt-w-100 { width: 100%; }
