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

:root {
  --blue:    #2563eb;
  --blue-d:  #1d4ed8;
  --green:   #16a34a;
  --red:     #ef4444;
  --yellow:  #ca8a04;
  --gray:    #6b7280;
  --gray-l:  #f0f2f5;
  --white:   #ffffff;
  --text:    #1a1a2e;
  --sidebar: #1e293b;
  --radius:  12px;
  --shadow:  0 2px 8px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-l);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ── AUTH ───────────────────────────────────────────────── */
#auth-screen, #invite-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
}

.auth-box {
  max-width: 420px; width: 90%;
  background: var(--white);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-box h1 { text-align: center; margin-bottom: 28px; font-size: 2rem; }
.auth-box h3 { margin-bottom: 8px; }

.tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.tab {
  flex: 1; padding: 10px; border: 2px solid #e0e0e0; background: none;
  border-radius: 8px; cursor: pointer; font-size: 0.95rem; color: var(--gray);
}
.tab.active { border-color: var(--blue); color: var(--blue); font-weight: 600; background: #eff6ff; }

form { display: flex; flex-direction: column; gap: 12px; }

input, textarea, select {
  padding: 12px 16px; border: 1.5px solid #e0e0e0; border-radius: 8px;
  font-size: 1rem; font-family: inherit; transition: border-color 0.2s; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); }

button {
  padding: 11px 20px; background: var(--blue); color: white; border: none;
  border-radius: 8px; cursor: pointer; font-size: 0.95rem; font-weight: 600;
  transition: background 0.2s, transform 0.1s; white-space: nowrap;
}
button:hover  { background: var(--blue-d); }
button:active { transform: scale(0.98); }
button.secondary { background: var(--gray-l); color: var(--text); }
button.secondary:hover { background: #e2e8f0; }
button.danger { background: var(--red); }
button.danger:hover { background: #dc2626; }

.error { color: var(--red); font-size: 0.88rem; margin-top: 6px; min-height: 18px; }

/* ── APP LAYOUT ─────────────────────────────────────────── */
#app-screen {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ────────────────────────────────────────────── */
#sidebar {
  width: 240px; min-width: 240px;
  background: var(--sidebar);
  display: flex; flex-direction: column;
  color: white; height: 100vh;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  font-size: 1.25rem; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; text-decoration: none;
  color: rgba(255,255,255,0.7); font-size: 0.95rem; transition: all 0.15s;
}
.nav-item:hover  { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: var(--blue); color: white; }
.nav-icon { font-size: 1.1rem; }

.sidebar-user {
  padding: 16px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem; flex-shrink: 0; color: white;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: rgba(255,255,255,0.5); }
.logout-btn {
  background: none; color: rgba(255,255,255,0.5); padding: 6px;
  font-size: 1.1rem; min-width: unset;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); color: white; }

/* ── MAIN CONTENT ───────────────────────────────────────── */
#main-content {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}

/* ── TOPBAR ─────────────────────────────────────────────── */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; background: var(--white);
  box-shadow: var(--shadow); gap: 16px; z-index: 10;
}
#breadcrumb { font-size: 0.9rem; color: var(--gray); }

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

.search-wrap { position: relative; }
.search-wrap input {
  width: 260px; padding: 9px 16px; background: var(--gray-l);
  border: 1.5px solid transparent; border-radius: 8px; font-size: 0.9rem;
}
.search-wrap input:focus { background: white; border-color: var(--blue); }

.search-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 360px; background: white; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15); z-index: 200; overflow: hidden;
}
.search-section { padding: 12px 16px 6px; font-size: 0.75rem; color: var(--gray); font-weight: 600; text-transform: uppercase; }
.search-item {
  padding: 10px 16px; cursor: pointer; font-size: 0.9rem; transition: background 0.1s;
  display: flex; align-items: center; gap: 8px;
}
.search-item:hover { background: var(--gray-l); }
.search-item .sub { font-size: 0.78rem; color: var(--gray); }

/* ── VIEWS ──────────────────────────────────────────────── */
.view { flex: 1; overflow-y: auto; padding: 32px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 1.7rem; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section-header { margin: 28px 0 16px; }
.section-header h3 { font-size: 1.1rem; color: var(--gray); font-weight: 600; }

/* ── DASHBOARD ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 8px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.stat-card .stat-label { font-size: 0.82rem; color: var(--gray); font-weight: 600; text-transform: uppercase; }
.stat-card .stat-value { font-size: 2.2rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card .stat-icon  { font-size: 1.5rem; }

.recent-item {
  background: var(--white); border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer; transition: transform 0.15s;
  display: flex; align-items: center; gap: 16px;
}
.recent-item:hover { transform: translateX(4px); }
.recent-item .ri-title { font-weight: 600; font-size: 0.95rem; }
.recent-item .ri-meta  { font-size: 0.82rem; color: var(--gray); }
.recent-item .ri-icon  { font-size: 1.4rem; flex-shrink: 0; }

/* ── FILTER BAR ─────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
  padding: 7px 16px; background: var(--white); color: var(--gray);
  border-radius: 20px; font-size: 0.85rem; font-weight: 600; border: 1.5px solid #e0e0e0;
}
.filter-btn:hover  { border-color: var(--blue); color: var(--blue); background: #eff6ff; }
.filter-btn.active { background: var(--blue); color: white; border-color: var(--blue); }

/* ── CARDS ──────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.card {
  background: var(--white); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 6px;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.card h3 { font-size: 1.05rem; margin-bottom: 2px; }
.card p  { color: var(--gray); font-size: 0.88rem; line-height: 1.4; }
.card .card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.card .card-meta   { font-size: 0.78rem; color: var(--gray); display: flex; gap: 10px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600;
}
.badge.active    { background: #dcfce7; color: var(--green); }
.badge.completed { background: #dbeafe; color: var(--blue); }
.badge.paused    { background: #fef9c3; color: var(--yellow); }

/* ── TABS BAR ───────────────────────────────────────────── */
.tabs-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid #e0e0e0; }
.tab-btn {
  padding: 10px 20px; background: none; color: var(--gray);
  border-radius: 8px 8px 0 0; font-size: 0.9rem; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-btn:hover  { color: var(--blue); background: #eff6ff; }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); background: none; }

/* ── PROJECT INFO BAR ───────────────────────────────────── */
#project-info-bar {
  background: var(--white); border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow); margin-bottom: 20px;
  display: flex; gap: 24px; flex-wrap: wrap; align-items: center;
}
.pib-item { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.pib-item .pib-label { color: var(--gray); font-size: 0.8rem; }

/* ── REPORTS ────────────────────────────────────────────── */
.report-item {
  background: var(--white); border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.15s; display: flex; align-items: center; gap: 16px;
}
.report-item:hover { transform: translateX(4px); }
.report-item .ri-body { flex: 1; min-width: 0; }
.report-item h4  { margin-bottom: 5px; font-size: 0.97rem; }
.report-item .meta {
  color: var(--gray); font-size: 0.82rem; display: flex; gap: 14px; flex-wrap: wrap;
}
.report-item .photo-count {
  background: var(--gray-l); border-radius: 6px; padding: 4px 10px;
  font-size: 0.8rem; color: var(--gray); flex-shrink: 0;
}

/* ── REPORT DETAIL ──────────────────────────────────────── */
#report-detail-content {
  background: var(--white); border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow); margin-bottom: 24px;
}
.meta-row {
  display: flex; gap: 10px; margin-bottom: 20px;
  padding-bottom: 20px; border-bottom: 1px solid var(--gray-l); flex-wrap: wrap;
}
.meta-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--gray-l); padding: 6px 12px; border-radius: 8px;
  font-size: 0.85rem; color: var(--text);
}
.body { line-height: 1.8; white-space: pre-wrap; font-size: 0.97rem; }

/* ── MEMBERS ────────────────────────────────────────────── */
.member-item {
  background: var(--white); border-radius: var(--radius); padding: 14px 20px;
  margin-bottom: 8px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.member-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: white; flex-shrink: 0;
}
.member-info { flex: 1; }
.member-info .m-name  { font-weight: 600; font-size: 0.95rem; }
.member-info .m-email { font-size: 0.82rem; color: var(--gray); }
.member-role {
  padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
  background: #eff6ff; color: var(--blue);
}
.member-role.admin   { background: #fef9c3; color: var(--yellow); }
.member-role.foreman { background: #dcfce7; color: var(--green); }
.invite-box {
  background: var(--white); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.invite-box h4 { margin-bottom: 12px; }
.invite-link-box {
  background: var(--gray-l); border-radius: 8px; padding: 12px 16px;
  font-size: 0.85rem; word-break: break-all; margin-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* ── PHOTOS ─────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.photo-wrap { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 1; }
.photo-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  cursor: pointer; transition: transform 0.15s; display: block;
}
.photo-wrap:hover img { transform: scale(1.04); }
.photo-delete {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,0.6); color: white; border: none;
  border-radius: 50%; width: 26px; height: 26px; padding: 0;
  font-size: 0.75rem; opacity: 0; transition: opacity 0.15s; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo-wrap:hover .photo-delete { opacity: 1; }

.upload-area { padding: 16px 0; }
.upload-area input[type="file"] { display: none; }
.upload-area label {
  display: inline-block; padding: 11px 22px; background: var(--gray-l);
  border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
  transition: background 0.2s; border: 1.5px dashed #c0c0c0; color: var(--text);
}
.upload-area label:hover { background: #e2e8f0; }

/* ── MODAL ──────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--white); border-radius: 16px; padding: 28px;
  width: 90%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 1.2rem; }
.modal-close { background: none; color: var(--gray); padding: 4px 8px; font-size: 1.1rem; min-width: unset; }
.modal-close:hover { background: var(--gray-l); color: var(--text); }
.modal-box input,
.modal-box textarea,
.modal-box select { margin-bottom: 10px; }
.modal-box textarea { min-height: 110px; resize: vertical; }
.modal-box label { font-size: 0.85rem; color: var(--gray); display: block; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-actions .primary { background: var(--blue); }

/* ── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 32px; right: 32px; z-index: 9999;
  background: #1e293b; color: white; padding: 14px 22px;
  border-radius: 10px; font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  animation: slideUp 0.25s ease;
}
.toast.success { background: #16a34a; }
.toast.error   { background: var(--red); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── LIGHTBOX ───────────────────────────────────────────── */
#lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; cursor: zoom-out;
}
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { display: none; }
  .view { padding: 16px; }
  #topbar { padding: 12px 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .search-wrap input { width: 180px; }
  .search-dropdown { width: 280px; }
}

/* ── FOTOS TAB (Projekt-Übersicht) ──────────────────────── */
.photos-tab-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.photos-tab-header h4 { font-size: 1rem; color: var(--gray); }

.photo-group { margin-bottom: 28px; }
.photo-group-title {
  font-size: 0.82rem; font-weight: 600; color: var(--gray);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid #e0e0e0;
}

/* ── DOKUMENTE TAB ──────────────────────────────────────── */
.doc-upload-box {
  background: var(--white); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.doc-upload-box h4 { margin-bottom: 14px; font-size: 1rem; }
.doc-upload-row {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
}
.doc-upload-row input[type="text"],
.doc-upload-row select { flex: 1; min-width: 140px; }

.doc-upload-label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; background: var(--blue); color: white;
  border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.95rem;
  transition: background 0.2s; white-space: nowrap;
}
.doc-upload-label:hover { background: var(--blue-d); }
#doc-file-input { display: none; }
#doc-filename-display {
  font-size: 0.82rem; color: var(--gray); margin-top: 8px; min-height: 18px;
}

.doc-category-filter {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}

.doc-list { display: flex; flex-direction: column; gap: 8px; }

.doc-item {
  background: var(--white); border-radius: var(--radius); padding: 14px 18px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
  transition: transform 0.15s;
}
.doc-item:hover { transform: translateX(3px); }
.doc-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; }
.doc-info { flex: 1; min-width: 0; }
.doc-name {
  font-weight: 600; font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-meta { font-size: 0.78rem; color: var(--gray); margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.doc-category-badge {
  padding: 2px 8px; border-radius: 12px; font-size: 0.72rem; font-weight: 600;
  background: #eff6ff; color: var(--blue); white-space: nowrap;
}
.doc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.doc-actions a {
  padding: 7px 12px; background: var(--gray-l); color: var(--text);
  border-radius: 6px; font-size: 0.82rem; font-weight: 600; text-decoration: none;
  transition: background 0.15s;
}
.doc-actions a:hover { background: #e2e8f0; }

.doc-empty {
  text-align: center; padding: 48px 20px; color: var(--gray);
}
.doc-empty .doc-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.doc-empty p { font-size: 0.95rem; }

/* ── BREADCRUMB ─────────────────────────────────────────── */
#breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.88rem; flex-wrap: wrap;
}
.bc-link {
  color: var(--blue); cursor: pointer; font-weight: 500;
}
.bc-link:hover { text-decoration: underline; }
.bc-sep { color: var(--gray); }
.bc-current { color: var(--gray); }

/* ── ZURÜCK-BUTTON ──────────────────────────────────────── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; background: var(--gray-l); color: var(--text);
  border-radius: 8px; font-size: 0.9rem; font-weight: 600;
  border: none; cursor: pointer; transition: background 0.15s;
  margin-bottom: 4px;
}
.back-btn:hover { background: #e2e8f0; }

/* ── PERSONAL-GRID im Modal ─────────────────────────────── */
.personnel-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 10px;
}
.personnel-field label {
  font-size: 0.82rem; color: var(--gray);
  display: block; margin-bottom: 4px;
}
.personnel-field input { margin-bottom: 0; }

/* ── DIREKTER FOTO-UPLOAD im Fotos-Tab ──────────────────── */
.direct-photo-upload {
  background: var(--white); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.direct-photo-upload h4 { margin-bottom: 6px; font-size: 1rem; }

/* ── MEDIEN-TAB TOOLBAR ─────────────────────────────────── */
.media-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
}
.media-toolbar .sort-select {
  padding: 8px 12px; border: 1.5px solid #e0e0e0; border-radius: 8px;
  font-size: 0.88rem; background: white; cursor: pointer;
}
.media-toolbar .spacer { flex: 1; }
.select-mode-btn {
  padding: 8px 14px; background: var(--gray-l); color: var(--text);
  border-radius: 8px; font-size: 0.88rem; font-weight: 600; border: none; cursor: pointer;
}
.select-mode-btn.active { background: var(--blue); color: white; }
.selection-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; background: #1e293b; color: white;
  border-radius: var(--radius); margin-bottom: 12px;
}
.selection-bar span { flex: 1; font-size: 0.9rem; font-weight: 600; }

/* ── MEDIEN KACHELN ─────────────────────────────────────── */
.photo-wrap.selectable { cursor: pointer; }
.photo-wrap.selected::after {
  content: '✓'; position: absolute; top: 6px; left: 6px;
  background: var(--blue); color: white; border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}
.photo-wrap.selected img { outline: 3px solid var(--blue); }
.video-thumb {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-type-badge {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(0,0,0,0.6); color: white;
  padding: 2px 7px; border-radius: 10px; font-size: 0.72rem; font-weight: 600;
}

/* ── TEAM PICKER ────────────────────────────────────────── */
.user-picker {
  background: var(--white); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.user-picker h4 { margin-bottom: 12px; }
.user-picker-search {
  width: 100%; margin-bottom: 10px; padding: 9px 14px;
  border: 1.5px solid #e0e0e0; border-radius: 8px; font-size: 0.9rem;
}
.profession-group-title {
  font-size: 0.75rem; font-weight: 700; color: var(--gray);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 0 4px; border-bottom: 1px solid #f0f2f5; margin-bottom: 4px;
}
.user-pick-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; transition: background 0.12s;
}
.user-pick-item:hover { background: var(--gray-l); }
.user-pick-item.selected { background: #eff6ff; }
.user-pick-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: white; flex-shrink: 0;
}
.user-pick-info { flex: 1; min-width: 0; }
.user-pick-name { font-size: 0.9rem; font-weight: 600; }
.user-pick-profession { font-size: 0.75rem; color: var(--gray); }
.user-pick-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #e0e0e0; flex-shrink: 0; transition: all 0.15s;
}
.user-pick-item.selected .user-pick-check {
  background: var(--blue); border-color: var(--blue);
}
.pick-role-select {
  padding: 5px 8px; border: 1.5px solid #e0e0e0; border-radius: 6px;
  font-size: 0.8rem; width: auto;
}
.picker-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ── MONTAGE-PLAN ───────────────────────────────────────── */
.schedule-week-nav {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.schedule-week-nav .week-label {
  font-size: 1.1rem; font-weight: 700; flex: 1; min-width: 160px;
}
.schedule-week-nav button {
  padding: 8px 16px; font-size: 0.9rem;
}
.schedule-week-nav .week-jump {
  padding: 8px 12px; border: 1.5px solid #e0e0e0; border-radius: 8px;
  font-size: 0.9rem; font-family: inherit; background: white; cursor: pointer;
}

.schedule-table-wrap {
  overflow-x: auto; border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.schedule-table {
  width: 100%; border-collapse: collapse;
  background: var(--white); min-width: 700px;
}
.schedule-table th {
  background: var(--sidebar); color: white;
  padding: 12px 14px; text-align: left; font-size: 0.88rem;
  font-weight: 600; white-space: nowrap;
}
.schedule-table th:first-child { width: 130px; border-radius: 12px 0 0 0; }
.schedule-table th:last-child  { border-radius: 0 12px 0 0; }

.schedule-table td {
  border: 1px solid #f0f2f5; padding: 0; vertical-align: top;
  min-width: 120px;
}
.schedule-table td:first-child {
  background: #f8fafc; font-weight: 700; font-size: 0.88rem;
  padding: 10px 14px; color: var(--text); white-space: nowrap;
  border-left: none;
}
.schedule-table tr:last-child td:first-child { border-radius: 0 0 0 12px; }

.schedule-cell {
  min-height: 72px; padding: 8px 10px; cursor: pointer;
  transition: background 0.12s; position: relative;
}
.schedule-cell:hover { background: #f0f7ff; }
.schedule-cell.has-entry { padding: 0; }

.schedule-entry {
  height: 100%; min-height: 72px; padding: 8px 10px;
  border-left: 4px solid var(--blue);
  display: flex; flex-direction: column; gap: 3px;
  position: relative;
}
.schedule-entry .entry-project {
  font-weight: 700; font-size: 0.9rem; line-height: 1.3;
}
.schedule-entry .entry-note {
  font-size: 0.78rem; color: var(--gray); line-height: 1.4;
}
.entry-del-btn {
  position: absolute; top: 5px; right: 5px;
  background: rgba(0,0,0,0.12); color: #555; border: none;
  border-radius: 50%; width: 20px; height: 20px; padding: 0;
  font-size: 0.7rem; cursor: pointer; opacity: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s;
}
.schedule-entry:hover .entry-del-btn { opacity: 1; }
.entry-del-btn:hover { background: var(--red); color: white; }

.schedule-empty-cell {
  min-height: 72px; display: flex; align-items: center; justify-content: center;
  color: #d0d5dd; font-size: 1.2rem;
}
.schedule-empty-cell:hover { color: var(--blue); }

.schedule-add-troop {
  margin-top: 12px; display: flex; gap: 8px; align-items: center;
}
.schedule-add-troop input {
  flex: 1; padding: 9px 14px; border: 1.5px solid #e0e0e0;
  border-radius: 8px; font-size: 0.9rem;
}

/* Entry color dots */
.entry-color-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
}

/* Readonly hint */
.schedule-readonly-hint {
  font-size: 0.82rem; color: var(--gray);
  background: #fef9c3; padding: 8px 14px; border-radius: 8px;
  margin-bottom: 14px; display: inline-block;
}

/* ── DASHBOARD NEU ──────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

.dashboard-main {}
.dashboard-side {}

/* Montage-Vorschau im Dashboard */
.dash-schedule-table {
  width: 100%; border-collapse: collapse;
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.dash-schedule-table th {
  background: var(--sidebar); color: white;
  padding: 9px 12px; font-size: 0.8rem; font-weight: 600; text-align: left;
}
.dash-schedule-table td {
  padding: 8px 12px; border-bottom: 1px solid #f0f2f5;
  font-size: 0.85rem; vertical-align: top;
}
.dash-schedule-table tr:last-child td { border-bottom: none; }
.dash-schedule-table td:first-child { font-weight: 700; white-space: nowrap; color: var(--gray); width: 80px; }
.dash-entry-pill {
  display: inline-block; padding: 2px 9px; border-radius: 12px;
  font-size: 0.78rem; font-weight: 600; color: white; margin: 1px 2px;
}
.dash-no-entries { color: var(--gray); font-size: 0.88rem; padding: 20px 0; text-align: center; }

/* Events */
.event-item {
  background: var(--white); border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 8px; box-shadow: var(--shadow);
  border-left: 4px solid var(--blue);
  display: flex; align-items: center; gap: 12px;
}
.event-date {
  background: var(--blue); color: white; border-radius: 8px;
  padding: 5px 10px; font-size: 0.78rem; font-weight: 700;
  text-align: center; min-width: 48px; flex-shrink: 0;
}
.event-info { flex: 1; }
.event-title { font-weight: 600; font-size: 0.9rem; }
.event-desc  { font-size: 0.78rem; color: var(--gray); margin-top: 2px; }
.event-past { opacity: 0.5; }

/* ── NAVIGATION DIVIDER ─────────────────────────────────── */
.nav-divider {
  height: 1px; background: rgba(255,255,255,0.12); margin: 8px 12px;
}
.nav-admin { border-top: none; }
.nav-admin .nav-icon { color: #fbbf24; }

/* ── ADMIN BEREICH ──────────────────────────────────────── */
.admin-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr));
  gap: 12px; margin-bottom: 24px;
}
.admin-stat {
  background: var(--white); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); text-align: center;
}
.admin-stat .as-value { font-size: 1.8rem; font-weight: 700; }
.admin-stat .as-label { font-size: 0.78rem; color: var(--gray); margin-top: 2px; }

.admin-user-item {
  background: var(--white); border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 8px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.admin-user-item.inactive { opacity: 0.55; }
.admin-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.badge-admin    { background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; }
.badge-inactive { background: #fee2e2; color: #991b1b; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; }
.badge-profession { background: #eff6ff; color: #1d4ed8; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 600; }

.admin-event-item {
  background: var(--white); border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 8px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.admin-event-date {
  background: var(--blue); color: white; border-radius: 8px;
  padding: 6px 12px; font-size: 0.8rem; font-weight: 700; text-align: center; flex-shrink: 0;
}

/* ── UNTERPROJEKTE ──────────────────────────────────────── */
.subprojects-wrap {
  margin-bottom: 24px;
}
.subprojects-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.subprojects-title {
  font-size: 0.9rem; font-weight: 700; color: var(--gray);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.subproject-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr));
  gap: 10px; margin-bottom: 8px;
}
.subproject-card {
  background: var(--white); border-radius: 10px; padding: 14px 16px;
  box-shadow: var(--shadow); cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  border-left: 3px solid #e0e7ff;
  transition: transform 0.12s, box-shadow 0.12s;
}
.subproject-card:hover {
  transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border-left-color: var(--blue);
}
.subproject-icon { font-size: 1.4rem; flex-shrink: 0; }
.subproject-info { flex: 1; min-width: 0; }
.subproject-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subproject-meta { font-size: 0.75rem; color: var(--gray); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── NOTIZEN-CHAT IN UNTERORDNERN ───────────────────────── */
.notes-chat {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.notes-chat-header {
  padding: 16px 18px;
  border-bottom: 1px solid #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 800;
}
.notes-chat-header span {
  color: var(--gray);
  font-size: 0.82rem;
  font-weight: 500;
}
.notes-chat-list {
  min-height: 260px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 16px 18px;
  background: #f8fafc;
}
.note-message {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.note-message.own {
  flex-direction: row-reverse;
}
.note-message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}
.note-message-body {
  max-width: min(680px, 82%);
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}
.note-message.own .note-message-body {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.note-message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--gray);
  font-size: 0.76rem;
  margin-bottom: 4px;
}
.note-message-meta strong {
  color: var(--text);
  font-size: 0.82rem;
}
.note-message-text {
  white-space: normal;
  line-height: 1.45;
  font-size: 0.94rem;
}
.note-delete {
  background: transparent;
  color: var(--gray);
  padding: 0;
  font-size: 0.74rem;
  min-width: unset;
}
.note-delete:hover {
  background: transparent;
  color: var(--red);
}
.notes-empty {
  text-align: center;
  color: var(--gray);
  padding: 48px 20px;
}
.notes-chat-form {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid #f0f2f5;
  background: white;
}
.notes-chat-form textarea {
  min-height: 46px;
  resize: vertical;
  margin: 0;
}
.notes-chat-form button {
  align-self: flex-end;
}
@media (max-width: 700px) {
  .notes-chat-form { flex-direction: column; }
  .note-message-body { max-width: 88%; }
}
.schedule-entry.editable { cursor: pointer; }
.schedule-entry.editable:hover { background: #f8fafc; }

/* ── NEU: Automatische Team-Zuordnung & Rechte-Hinweise ── */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  margin: 4px 0 12px;
}
.checkbox-row input { width: auto; margin-top: 3px; }
.checkbox-row span { display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; }
.checkbox-row small { color: var(--gray); font-size: 0.78rem; line-height: 1.35; }
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #facc15;
  color: #713f12;
  font-size: 0.74rem;
  font-weight: 900;
  vertical-align: middle;
  margin-left: 6px;
}
.readonly-box,
.notes-readonly {
  background: #fef9c3;
  color: #854d0e;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  font-weight: 600;
}
.notes-readonly {
  border-radius: 0;
  margin: 0;
  border-top: 1px solid #fde68a;
}
.note-author-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.1;
}
.note-author-profession {
  color: var(--gray);
  font-size: 0.7rem;
  font-weight: 600;
}
.note-message-text a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
  word-break: break-word;
}

/* Klickbare Projektadresse */
.address-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}
.address-link:hover {
  text-decoration: underline;
}

/* ── REPORT SORTING / PDF EXPORT ───────────────────────── */
.report-toolbar {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 700;
}
.report-toolbar label {
  color: var(--gray);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-toolbar select {
  min-width: 170px;
  padding: 7px 10px;
  border: 1px solid #d7dce3;
  border-radius: 8px;
  background: white;
  color: var(--text);
}
.report-pdf-btn {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  min-width: 42px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.report-pdf-btn:hover {
  background: #fecaca;
  transform: none;
}

/* ── LOGIN SPEICHERN ───────────────────────────────────── */
.login-remember-row {
  margin: 2px 0 4px;
  align-items: flex-start;
}
.login-remember-row strong {
  color: var(--text);
}

/* ── MEHRERE BERICHTE ALS PDF ──────────────────────────── */
.report-select {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  min-width: 26px;
  cursor: pointer;
}
.report-select input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  cursor: pointer;
}
.report-toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.selected-report-count {
  color: var(--blue);
  font-size: 0.78rem;
  background: #eff6ff;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 800;
}
.report-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.report-batch-btn {
  padding: 7px 10px;
  font-size: 0.82rem;
}
.report-batch-export {
  width: auto;
  min-width: 74px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.report-batch-export:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── MOBILE OPTIMIERUNG / APP-GEFÜHL ───────────────────── */
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100dvh;
  overscroll-behavior: none;
}
button, a, input, textarea, select {
  -webkit-tap-highlight-color: transparent;
}
button, .tab-btn, .filter-btn, .doc-actions a, .upload-area label, .doc-upload-label {
  min-height: 44px;
}
#mobile-nav {
  display: none;
}

@media (max-width: 860px) {
  body {
    height: 100dvh;
    overflow: hidden;
    background: var(--gray-l);
  }
  #app-screen {
    height: 100dvh;
    overflow: hidden;
  }
  #sidebar {
    display: none;
  }
  #main-content {
    width: 100%;
    height: 100dvh;
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }
  #topbar {
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    min-height: 52px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(15,23,42,0.08);
  }
  #breadcrumb {
    font-size: 0.78rem;
    line-height: 1.25;
    max-width: 100%;
  }
  .topbar-actions {
    display: none;
  }
  .view {
    padding: 18px 14px 26px;
    -webkit-overflow-scrolling: touch;
  }
  .page-header {
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }
  .page-header h2 {
    font-size: 1.35rem;
    line-height: 1.15;
    word-break: break-word;
  }
  .header-actions,
  .page-header > div[style*="display:flex"] {
    width: 100%;
  }
  .header-actions button,
  .page-header > div[style*="display:flex"] > button,
  .back-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .back-btn {
    width: 100%;
    margin-bottom: 12px;
  }
  input, textarea, select {
    font-size: 16px;
    padding: 12px 14px;
  }
  button {
    font-size: 0.95rem;
    padding: 11px 14px;
  }
  .auth-box {
    width: min(94vw, 430px);
    padding: 28px 20px;
    border-radius: 18px;
  }
  .auth-box h1 {
    font-size: 1.65rem;
    margin-bottom: 22px;
  }
  .tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -14px;
    margin-right: -14px;
    padding: 0 14px;
    gap: 6px;
  }
  .tabs-bar::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    flex: 0 0 auto;
    padding: 10px 14px;
  }
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar {
    display: none;
  }
  .filter-btn {
    flex: 0 0 auto;
  }
  .search-wrap {
    width: 100%;
  }
  .search-wrap input {
    width: 100%;
  }
  .search-dropdown {
    width: min(92vw, 420px);
    left: 0;
    right: auto;
  }
  .card-grid,
  .subproject-grid,
  .photo-grid,
  .stats-grid,
  .admin-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card,
  .stat-card,
  .recent-item,
  .report-item,
  .member-item,
  .admin-user-item,
  .admin-event-item,
  .event-item,
  .subproject-card,
  .doc-item,
  .direct-photo-upload,
  .doc-upload-box,
  .user-picker,
  #report-detail-content,
  #project-info-bar,
  .report-toolbar,
  .media-toolbar,
  .notes-chat {
    border-radius: 14px;
  }
  .card {
    padding: 18px;
  }
  .card:hover,
  .report-item:hover,
  .doc-item:hover,
  .recent-item:hover,
  .subproject-card:hover {
    transform: none;
  }
  #project-info-bar {
    padding: 14px;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .pib-item {
    align-items: flex-start;
  }
  .report-toolbar {
    align-items: stretch;
  }
  .report-toolbar-title,
  .report-toolbar-actions,
  .report-toolbar label {
    width: 100%;
  }
  .report-toolbar select,
  .report-toolbar-actions button {
    width: 100%;
  }
  .report-item {
    padding: 14px;
    gap: 10px;
    align-items: flex-start;
  }
  .report-item .photo-count,
  .report-pdf-btn {
    margin-top: 2px;
  }
  .report-select {
    width: 28px;
    min-width: 28px;
    padding-top: 8px;
  }
  .report-item .meta {
    gap: 6px 10px;
    font-size: 0.78rem;
  }
  #report-detail-content {
    padding: 18px;
  }
  .meta-row {
    gap: 8px;
  }
  .meta-badge {
    width: 100%;
    justify-content: flex-start;
  }
  .body {
    font-size: 0.95rem;
    line-height: 1.65;
  }
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .photo-delete {
    opacity: 1;
    width: 30px;
    height: 30px;
  }
  .photos-tab-header,
  .subprojects-header,
  .media-toolbar,
  .selection-bar,
  .doc-upload-row,
  .picker-actions,
  .schedule-week-nav,
  .notes-chat-header {
    align-items: stretch;
  }
  .photos-tab-header,
  .subprojects-header {
    flex-direction: column;
    gap: 10px;
  }
  .photos-tab-header button,
  .subprojects-header button,
  .media-toolbar button,
  .selection-bar button,
  .doc-upload-row button,
  .doc-upload-label,
  .upload-area label,
  .picker-actions button,
  .schedule-week-nav button,
  .schedule-week-nav input,
  .schedule-week-nav .week-jump,
  .schedule-add-troop button,
  .schedule-add-troop input {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .doc-upload-row,
  .schedule-add-troop,
  .notes-chat-form {
    flex-direction: column;
  }
  .doc-item,
  .member-item,
  .admin-user-item,
  .admin-event-item,
  .event-item,
  .recent-item {
    align-items: flex-start;
  }
  .doc-item {
    flex-wrap: wrap;
  }
  .doc-actions {
    width: 100%;
    flex-direction: column;
  }
  .doc-actions a,
  .doc-actions button {
    width: 100%;
    text-align: center;
  }
  .doc-name {
    white-space: normal;
    word-break: break-word;
  }
  .invite-link-box {
    flex-direction: column;
    align-items: stretch;
  }
  .invite-link-box button {
    width: 100%;
  }
  .personnel-grid {
    grid-template-columns: 1fr;
  }
  .modal {
    align-items: flex-end;
  }
  .modal-box {
    width: 100%;
    max-width: none;
    max-height: calc(92dvh - env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  }
  .modal-actions {
    position: sticky;
    bottom: 0;
    background: var(--white);
    padding-top: 10px;
    flex-direction: column-reverse;
  }
  .modal-actions button {
    width: 100%;
  }
  .toast {
    left: 14px;
    right: 14px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    text-align: center;
  }
  .schedule-table-wrap {
    margin-left: -14px;
    margin-right: -14px;
    border-radius: 0;
  }
  .schedule-table {
    min-width: 760px;
  }
  .schedule-entry .entry-project {
    font-size: 0.84rem;
  }
  .dash-schedule-table {
    min-width: 0;
  }
  .dash-entry-pill {
    display: block;
    margin: 3px 0;
    white-space: normal;
  }
  .notes-chat-list {
    max-height: 48dvh;
    padding: 14px;
  }
  .note-message-body {
    max-width: 84%;
  }
  .notes-chat-form {
    padding: 12px 14px;
  }
  .notes-chat-form textarea {
    min-height: 76px;
  }
  .notes-chat-form button {
    width: 100%;
  }
  .user-pick-item {
    padding: 10px 8px;
  }
  .pick-role-select {
    width: 100%;
  }
  #mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 800;
    display: flex;
    justify-content: space-around;
    gap: 2px;
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,0.96);
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -6px 20px rgba(15,23,42,0.10);
    backdrop-filter: blur(14px);
  }
  .mobile-nav-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 54px;
    padding: 6px 3px;
    border-radius: 12px;
    background: transparent;
    color: var(--gray);
    font-size: 0.7rem;
    font-weight: 800;
  }
  .mobile-nav-item:hover {
    background: #eff6ff;
    color: var(--blue);
  }
  .mobile-nav-item.active {
    background: #eff6ff;
    color: var(--blue);
  }
  .mobile-nav-icon {
    font-size: 1.18rem;
    line-height: 1;
  }
  .mobile-logout {
    color: #991b1b;
  }
}

@media (max-width: 390px) {
  .view {
    padding-left: 10px;
    padding-right: 10px;
  }
  .tabs-bar {
    margin-left: -10px;
    margin-right: -10px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .mobile-nav-item {
    font-size: 0.64rem;
  }
  .mobile-nav-icon {
    font-size: 1.05rem;
  }
}
