:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e2e4e9;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2f5d50;
  --primary-dark: #244a40;
  --danger: #b3413a;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}
.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 380px;
}
.card h1 { font-size: 1.3rem; margin: 0 0 20px; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 12px 0 4px; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}
button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 16px;
}
button:hover { background: var(--primary-dark); }
button.secondary { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
button.danger { background: var(--danger); }
.error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; }

.main { padding: 16px; max-width: 720px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* --- Dashboard mobile-first --- */
.dash-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-header .title-block h1 { font-size: 1.1rem; margin: 0; }
.dash-header .title-block .user-line { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  margin: 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--border); }

.chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }
.chip.add-chip { background: var(--bg); color: var(--primary); border-style: dashed; }

.file-list { padding: 4px 16px 100px; display: flex; flex-direction: column; gap: 10px; }

.fab {
  position: fixed;
  right: 20px;
  bottom: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  margin: 0;
  padding: 0;
  z-index: 20;
}
.fab:hover { background: var(--primary-dark); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-end;
  z-index: 30;
}
.modal-sheet {
  background: var(--panel);
  width: 100%;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-sheet h2 { margin: 0 0 14px; font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; }
.modal-sheet .close-btn { background: none; border: none; color: var(--muted); font-size: 1.3rem; margin: 0; padding: 0; }
.member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.empty-state { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 0.9rem; }
.sub-banner {
  background: #f6d9d6;
  color: var(--danger);
  font-size: 0.85rem;
  padding: 10px 16px;
  text-align: center;
}
.thumb-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--bg);
  cursor: pointer;
}
.thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-wrap.file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  aspect-ratio: auto;
  height: 80px;
}
.viewer-img { max-width: 92%; max-height: 92%; border-radius: 8px; object-fit: contain; margin: auto; }
#imageViewer { align-items: center; justify-content: center; }
.file-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.85rem;
}
.file-card .name { font-weight: 600; word-break: break-word; margin-bottom: 6px; }
.file-card .meta { color: var(--muted); font-size: 0.75rem; margin-bottom: 8px; }
.file-actions { display: flex; gap: 8px; }
.file-actions button { margin-top: 0; padding: 6px 10px; font-size: 0.8rem; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  background: var(--bg);
  color: var(--muted);
  margin-left: 8px;
}
