:root {
  color-scheme: dark;
  --bg: #0f1419;
  --surface: #1a222d;
  --surface-2: #232d3b;
  --border: #2e3a4a;
  --text: #e8edf4;
  --text-muted: #8b9bb4;
  --accent: #3dd68c;
  --accent-dim: #2a9d66;
  --danger: #f07178;
  --danger-dim: #c4565c;
  --warning: #ffb454;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font: 'DM Sans', system-ui, sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface-2: #e8eef5;
  --border: #c8d5e3;
  --text: #1a2332;
  --text-muted: #5a6e8a;
  --accent: #1a9660;
  --accent-dim: #147348;
  --danger: #d03840;
  --danger-dim: #a82c33;
  --warning: #b06b00;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ─── Header ────────────────────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.save-status.saving {
  color: var(--warning);
}

.save-status.saved {
  color: var(--accent);
}

.save-status.error {
  color: var(--danger);
}

/* ─── Theme toggle ──────────────────────────────────────────── */

.theme-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(61, 214, 140, 0.08);
}

/* ─── Tabs ──────────────────────────────────────────────────── */

.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: grab;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}

.tab:hover {
  background: var(--surface);
  color: var(--text);
}

.tab.active {
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
  color: var(--text);
  margin-bottom: -1px;
}

/* Drag-to-reorder states */
.tab--dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.tab--drag-over {
  border-color: var(--accent) !important;
  background: rgba(61, 214, 140, 0.1) !important;
  color: var(--text) !important;
}

/* Completed tab */
.tab--complete .tab-label {
  text-decoration: line-through;
  opacity: 0.7;
}

.tab--complete .tab-check {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.tab-label {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.tab:hover .tab-close,
.tab.active .tab-close {
  opacity: 1;
}

.tab-close:hover {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
}

.tab-add {
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tab-add:hover {
  border-color: var(--accent);
  background: rgba(61, 214, 140, 0.08);
}

/* ─── Panel ─────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}

.panel--complete {
  border-left: 3px solid var(--accent);
  opacity: 0.9;
}

.panel-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  margin-bottom: 24px;
}

.panel-metrics {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .panel-header {
    grid-template-columns: 1fr;
  }
}

.panel-title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ─── Complete toggle ───────────────────────────────────────── */

.complete-toggle {
  align-self: flex-start;
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.complete-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(61, 214, 140, 0.08);
}

.complete-toggle--done {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(61, 214, 140, 0.1);
}

.complete-toggle--done:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(240, 113, 120, 0.08);
}

.edit-mode-toggle {
  align-self: flex-start;
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--warning);
  border-radius: 6px;
  background: rgba(255, 180, 84, 0.08);
  color: var(--warning);
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.edit-mode-toggle:hover {
  background: rgba(255, 180, 84, 0.16);
}

.edit-mode-toggle--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(61, 214, 140, 0.1);
}

.edit-mode-toggle--active:hover {
  background: rgba(61, 214, 140, 0.16);
}

/* ─── Inputs ─────────────────────────────────────────────────── */

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.15);
}

.input-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.input-metric {
  max-width: 220px;
  font-size: 1.1rem;
  font-weight: 600;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ─── Summary cards ──────────────────────────────────────────── */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.summary-card {
  padding: 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.summary-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.summary-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--accent);
}

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

/* ─── Target / goal progress ─────────────────────────────────── */

.target-progress-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.target-remaining {
  font-size: 0.78rem;
  font-weight: 600;
}

.target-progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.target-progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.target-deadline {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.target-deadline.deadline-ok {
  color: var(--text-muted);
}

.target-deadline.deadline-soon {
  color: var(--warning);
}

.target-deadline.deadline-overdue {
  color: var(--danger);
}

/* ─── Sections ───────────────────────────────────────────────── */

.combined-section {
  margin-top: 32px;
}

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

.section-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

/* ─── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, opacity 0.15s;
  min-height: 42px;
}

.btn:active {
  transform: scale(0.98);
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 10px;
}

.btn-ghost:hover {
  background: rgba(240, 113, 120, 0.12);
  color: var(--danger);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.1rem;
}

/* ─── Investors table ────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.table-wrap::-webkit-scrollbar {
  display: none;
}

.investors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  table-layout: fixed;
}

.investors-table th,
.investors-table td {
  padding: 10px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.investors-table th {
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

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

.investors-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .investors-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.025);
}

.investors-table .input {
  padding: 8px 10px;
  font-size: 0.86rem;
  min-width: 0;
  width: 100%;
}

.investors-table .input-name {
  min-width: 0;
}

.investors-table .input-amount {
  min-width: 0;
  max-width: none;
}

.investors-table .input-date {
  min-width: 0;
  max-width: none;
}

.contribution-field {
  width: 100%;
  min-width: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contribution-toggle {
  display: inline-flex;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.contribution-option {
  flex: 1 1 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.contribution-option + .contribution-option {
  border-left: 1px solid var(--border);
}

.contribution-option.active {
  background: rgba(61, 214, 140, 0.12);
  color: var(--accent);
}

.input-other-details {
  min-width: 0;
  max-width: none;
  resize: none;
  line-height: 1.35;
  min-height: 34px;
  overflow-y: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.cell-readonly {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Fit investor entry table columns inside panel width */
.investors-section .investors-table th:nth-child(1),
.investors-section .investors-table td:nth-child(1) { width: 14%; }
.investors-section .investors-table th:nth-child(2),
.investors-section .investors-table td:nth-child(2) { width: 10%; }
.investors-section .investors-table th:nth-child(3),
.investors-section .investors-table td:nth-child(3) { width: 18%; }
.investors-section .investors-table th:nth-child(4),
.investors-section .investors-table td:nth-child(4) { width: 12%; }
.investors-section .investors-table th:nth-child(5),
.investors-section .investors-table td:nth-child(5) { width: 10%; }
.investors-section .investors-table th:nth-child(6),
.investors-section .investors-table td:nth-child(6) { width: 11%; }
.investors-section .investors-table th:nth-child(7),
.investors-section .investors-table td:nth-child(7) { width: 11%; }
.investors-section .investors-table th:nth-child(8),
.investors-section .investors-table td:nth-child(8) { width: 10%; }
.investors-section .investors-table th:nth-child(9),
.investors-section .investors-table td:nth-child(9) { width: 4%; }

.investors-section .investors-table th {
  white-space: normal;
  line-height: 1.25;
}

.table-footnote {
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ─── Empty state ────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* ─── User badge & online indicator ─────────────────────────── */

.user-badge {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.online-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Yellow ! badge on tabs when multiple users are viewing */
.tab-viewers-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--warning);
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

/* ─── Editing banner ─────────────────────────────────────────── */

.editing-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: rgba(255, 180, 84, 0.1);
  border: 1px solid rgba(255, 180, 84, 0.35);
  color: var(--warning);
  font-size: 0.88rem;
  font-weight: 500;
}

.editing-banner-icon {
  flex-shrink: 0;
  font-size: 1rem;
}

.editing-banner-text {
  flex: 1;
}

/* ─── Locked panel (another user is editing) ────────────────── */

.panel--locked input,
.panel--locked textarea,
.panel--locked button:not(.edit-mode-toggle):not(.theme-toggle) {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

/* ─── Toast notifications ────────────────────────────────────── */

#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 500;
  pointer-events: all;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.toast--info {
  border-left: 3px solid var(--accent);
}

.toast--warning {
  border-left: 3px solid var(--warning);
}

.toast--error {
  border-left: 3px solid var(--danger);
}

.toast--success {
  border-left: 3px solid var(--accent);
}

.toast-msg {
  flex: 1;
  color: var(--text);
  line-height: 1.4;
}

.toast-action {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.toast-action:hover {
  background: rgba(61, 214, 140, 0.12);
}

.toast-close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toast-close:hover {
  background: rgba(240, 113, 120, 0.12);
  color: var(--danger);
}

/* ─── Mobile responsiveness ───────────────────────────────────── */

@media (hover: none) {
  .btn:active,
  .tab:active,
  .tab-add:active,
  .theme-toggle:active,
  .edit-mode-toggle:active,
  .complete-toggle:active {
    transform: none;
  }
}

@media (max-width: 1024px) {
  .app {
    padding: 18px 14px 28px;
  }

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

  .panel {
    padding: 18px 14px;
  }
}

@media (max-width: 768px) {
  .app {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 16px;
    gap: 10px;
  }

  .header-brand {
    align-items: flex-start;
  }

  .logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.3rem;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .subtitle {
    font-size: 0.84rem;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .save-status,
  .online-badge {
    font-size: 0.78rem;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    gap: 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
  }

  .tab.active {
    margin-bottom: 0;
    border-bottom-color: var(--border);
  }

  .tab-label {
    max-width: 120px;
  }

  .tab-close {
    opacity: 1;
    width: 24px;
    height: 24px;
    font-size: 1.05rem;
  }

  .tab-add {
    flex: 0 0 auto;
    min-height: 42px;
    white-space: nowrap;
    padding: 9px 12px;
  }

  .panel-header {
    gap: 14px;
    margin-bottom: 16px;
  }

  .panel-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .input-title {
    font-size: 1.06rem;
  }

  .input,
  .input-metric {
    font-size: 16px;
    min-height: 42px;
    max-width: 100%;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    margin-bottom: 16px;
    gap: 10px;
  }

  .summary-card {
    padding: 12px;
  }

  .summary-value {
    font-size: 1.05rem;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .section-header h2 {
    font-size: 1rem;
  }

  .btn {
    width: 100%;
    min-height: 44px;
  }

  .add-investor-btn {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
    border: none;
    border-radius: 0;
  }

  .investors-table,
  .investors-table tbody,
  .investors-table tr,
  .investors-table td {
    display: block;
    width: 100%;
  }

  .investors-table thead {
    display: none;
  }

  .investors-table {
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
  }

  .investors-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    padding: 8px;
  }

  .investors-table td {
    border: none;
    padding: 6px 0;
  }

  .investors-table td::before {
    display: block;
    content: '';
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
  }

  .investors-section .investors-table td:nth-child(1)::before { content: 'Name'; }
  .investors-section .investors-table td:nth-child(2)::before { content: 'Amount (EUR)'; }
  .investors-section .investors-table td:nth-child(3)::before { content: 'Type / details'; }
  .investors-section .investors-table td:nth-child(4)::before { content: 'Date'; }
  .investors-section .investors-table td:nth-child(5)::before { content: 'Share %'; }
  .investors-section .investors-table td:nth-child(6)::before { content: 'Payout (EUR)'; }
  .investors-section .investors-table td:nth-child(7)::before { content: 'Profit (EUR)'; }
  .investors-section .investors-table td:nth-child(8)::before { content: 'ROI'; }
  .investors-section .investors-table td:nth-child(9)::before { content: 'Actions'; }

  .combined-section .investors-table td:nth-child(1)::before { content: 'Investor'; }
  .combined-section .investors-table td:nth-child(2)::before { content: 'Total invested'; }
  .combined-section .investors-table td:nth-child(3)::before { content: 'Share'; }
  .combined-section .investors-table td:nth-child(4)::before { content: 'Total payout'; }
  .combined-section .investors-table td:nth-child(5)::before { content: 'Net profit'; }
  .combined-section .investors-table td:nth-child(6)::before { content: 'Blended ROI'; }

  .investors-table .input {
    min-height: 40px;
    font-size: 16px;
  }

  .input-other-details {
    min-height: 64px;
  }

  .contribution-option {
    min-height: 40px;
    font-size: 0.8rem;
  }

  .btn-icon {
    width: 40px;
    height: 40px;
  }

  /* Disable hard desktop column widths on mobile cards */
  .investors-section .investors-table th:nth-child(1),
  .investors-section .investors-table td:nth-child(1),
  .investors-section .investors-table th:nth-child(2),
  .investors-section .investors-table td:nth-child(2),
  .investors-section .investors-table th:nth-child(3),
  .investors-section .investors-table td:nth-child(3),
  .investors-section .investors-table th:nth-child(4),
  .investors-section .investors-table td:nth-child(4),
  .investors-section .investors-table th:nth-child(5),
  .investors-section .investors-table td:nth-child(5),
  .investors-section .investors-table th:nth-child(6),
  .investors-section .investors-table td:nth-child(6),
  .investors-section .investors-table th:nth-child(7),
  .investors-section .investors-table td:nth-child(7),
  .investors-section .investors-table th:nth-child(8),
  .investors-section .investors-table td:nth-child(8),
  .investors-section .investors-table th:nth-child(9),
  .investors-section .investors-table td:nth-child(9) {
    width: auto;
  }

  #toastContainer {
    top: max(10px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    left: max(8px, env(safe-area-inset-left));
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
    padding: 10px 12px;
  }
}

@media (max-width: 420px) {
  .app {
    padding-top: 14px;
  }

  .header-brand {
    gap: 12px;
  }

  .header h1 {
    font-size: 1.05rem;
  }

  .subtitle {
    font-size: 0.78rem;
  }

  .tab-label {
    max-width: 92px;
  }

  .panel {
    padding: 14px 10px;
  }

  .field-label {
    font-size: 0.72rem;
  }

  .summary-label {
    font-size: 0.7rem;
  }

  .summary-value {
    font-size: 0.96rem;
  }

  .empty-state {
    padding: 36px 12px;
  }
}
