:root {
  --green: #1B4332;
  --green-light: #2D6A4F;
  --green-muted: #D8F3DC;
  --white: #FFFFFF;
  --off-white: #F8F8F6;
  --border: #E5E7EB;
  --text: #111827;
  --muted: #6B7280;
  --error: #DC2626;
  --error-bg: #FEE2E2;
  --success: #16A34A;
  --success-bg: #DCFCE7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

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

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--off-white);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

/* ---- Layout ---- */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Header ---- */
.site-header {
  background: var(--green);
  color: var(--white);
  padding: 20px 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-subtitle {
  font-size: 0.78rem;
  opacity: 0.7;
  margin-top: 2px;
}

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ADE80;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 20px; }

/* ---- Drop zone ---- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--white);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--green);
  background: var(--green-muted);
}
.drop-zone-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.drop-zone-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.drop-zone-sub {
  font-size: 0.82rem;
  color: var(--muted);
}
#file-input { display: none; }

/* ---- Photo cards ---- */
.photos-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.photo-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 14px;
  padding: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow);
}
.photo-thumb {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--off-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  overflow: hidden;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-meta { flex: 1; min-width: 0; }
.photo-name {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}
.photo-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.photo-remove:hover { color: var(--error); }

/* ---- Form controls ---- */
.select, .textarea, .input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
  appearance: none;
}
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }
.select:focus, .textarea:focus, .input:focus { border-color: var(--green); }
.textarea { resize: none; height: 72px; }
.form-group { margin-bottom: 8px; }
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--green); color: var(--white); width: 100%; }
.btn-primary:hover:not(:disabled) { background: var(--green-light); }
.btn-secondary { background: var(--off-white); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--error); color: var(--white); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }

/* ---- Progress ---- */
.progress-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: 100px;
  transition: width 0.3s;
  width: 0%;
}

/* ---- Alerts ---- */
.alert {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.9rem;
  margin-top: 12px;
}
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ---- Section spacing ---- */
.section { padding: 24px 0; }
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ---- New category row ---- */
.new-cat-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.new-cat-row .input { flex: 1; }
.new-cat-row .btn { flex-shrink: 0; padding: 10px 14px; }

/* ---- Closed page ---- */
.closed-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
}
.closed-card {
  max-width: 480px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  box-shadow: var(--shadow);
}
.closed-icon { font-size: 3rem; margin-bottom: 20px; }
.closed-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.03em; }
.closed-text { color: var(--muted); line-height: 1.6; }

/* ---- Admin ---- */
.admin-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100dvh - 64px);
}
.admin-sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}
.admin-main {
  padding: 24px;
  overflow-y: auto;
}
.admin-header {
  background: var(--green);
  color: var(--white);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-title { font-weight: 700; font-size: 1rem; }
.person-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.person-item:last-child { border-bottom: none; }
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.uploaded { background: var(--success); }
.status-dot.pending { background: #FCA5A5; }
.person-name { font-size: 0.9rem; font-weight: 500; flex: 1; }
.person-count { font-size: 0.78rem; color: var(--muted); }

.storage-bar-wrap {
  background: var(--border);
  border-radius: 100px;
  height: 6px;
  margin: 8px 0;
  overflow: hidden;
}
.storage-bar { height: 100%; border-radius: 100px; background: var(--green); transition: width 0.3s; }
.storage-bar.warn { background: #F59E0B; }
.storage-bar.crit { background: var(--error); }

.photos-table { width: 100%; border-collapse: collapse; }
.photos-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.photos-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}
.photos-table tr:hover td { background: var(--off-white); }
.thumb-sm {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

/* ---- Login ---- */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}
.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}
.login-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 24px; }

/* ---- Cat filter chips ---- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.chip {
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--white);
  transition: background 0.15s, border-color 0.15s;
}
.chip.active, .chip:hover { background: var(--green); color: var(--white); border-color: var(--green); }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .photo-card { flex-wrap: wrap; }
  .closed-card { padding: 32px 20px; }
  .login-card { padding: 32px 20px; }
}

/* ---- Utility ---- */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.82rem; }
.font-bold { font-weight: 700; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }
