:root {
  --accent: #4338ca;
  --accent-dark: #141726;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #1f2430;
  --text-muted: #6b7280;
  --radius: 12px;

  --awaiting-bg: #fef3c7; --awaiting-fg: #92400e;
  --received-bg: #dcfce7; --received-fg: #166534;
  --reminder-bg: #dbeafe; --reminder-fg: #1e40af;
  --review-bg: #fce7f3;   --review-fg: #9d174d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font-family: inherit; font-size: 15px; }

/* ---------- Sign-in ---------- */

.signin-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.signin-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.signin-card h1 { font-size: 22px; margin: 0 0 8px; }
.signin-card p { color: var(--text-muted); margin: 0 0 24px; font-size: 14px; }

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  min-height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  background: var(--accent-dark);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.btn-google:hover { background: #1f2437; }

/* ---------- App shell ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--accent-dark);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-weight: 600; font-size: 16px; white-space: nowrap; }

.nav-links { display: none; gap: 4px; }

.nav-link {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
}
.nav-link.active { background: rgba(255,255,255,0.14); color: #fff; }

.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,0.75); }
.btn-link { background: none; border: none; color: #fff; text-decoration: underline; cursor: pointer; padding: 0; }

.view-root { padding: 20px 16px 96px; max-width: 960px; margin: 0 auto; }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
}
.bottom-nav .nav-link {
  flex: 1;
  color: var(--text-muted);
  background: none;
  border-radius: 0;
  padding: 8px 4px;
  font-size: 12px;
  min-height: 44px;
}
.bottom-nav .nav-link.active { color: var(--accent); font-weight: 600; }

.fab {
  position: fixed;
  right: 20px;
  bottom: 76px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  border: none;
  box-shadow: 0 4px 14px rgba(67,56,202,0.4);
  cursor: pointer;
  z-index: 20;
  line-height: 1;
}

@media (min-width: 768px) {
  .nav-links { display: flex; }
  .bottom-nav { display: none; }
  .fab { bottom: 32px; }
  .view-root { padding: 32px 24px 64px; }
}

/* ---------- Page bits ---------- */

.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; margin: 0; }

.period-select, .filters-bar input, .filters-bar select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  min-height: 44px;
}

.custom-range { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

.filters-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters-bar input[type="search"] { flex: 1; min-width: 200px; }

.section-title { font-size: 16px; margin: 28px 0 12px; color: var(--text-muted); }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) {
  .metrics-grid { grid-template-columns: repeat(5, 1fr); }
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.metric-value { font-size: 26px; font-weight: 700; }
.metric-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.card-list { display: flex; flex-direction: column; gap: 10px; }

.item-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}
.item-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.06); }

.item-title { font-weight: 600; }
.item-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-date { color: var(--text-muted); font-size: 12px; }

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-awaiting { background: var(--awaiting-bg); color: var(--awaiting-fg); }
.status-received { background: var(--received-bg); color: var(--received-fg); }
.status-reminder { background: var(--reminder-bg); color: var(--reminder-fg); }

.review-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--review-bg);
  color: var(--review-fg);
}

.loading, .empty-state, .error { padding: 24px; text-align: center; color: var(--text-muted); }
.error { color: #b91c1c; }

/* ---------- Project detail ---------- */

.back-link { background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 8px 0; margin-bottom: 8px; }

.detail-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-header h1 { font-size: 22px; margin: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
@media (min-width: 640px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid .full { grid-column: 1 / -1; }
}
.detail-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

.review-box {
  margin-top: 20px;
  background: var(--review-bg);
  border: 1px solid #f5c2dc;
  border-radius: var(--radius);
  padding: 18px 20px;
}
.review-box h3 { margin: 0 0 6px; color: var(--review-fg); font-size: 15px; }
.review-box p { margin: 0 0 14px; font-size: 13px; color: var(--review-fg); }
.review-item { background: #fff; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; font-size: 13px; }
.review-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-step { display: flex; gap: 12px; padding: 4px 0; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); margin-top: 6px; flex-shrink: 0; }
.timeline-step.done .timeline-dot { background: var(--accent); }
.timeline-label { font-weight: 600; font-size: 14px; }
.timeline-value { color: var(--text-muted); font-size: 13px; }
.timeline-step.pending .timeline-value { color: #c1c5cc; }

.detail-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 4px 8px; }

/* ---------- Modal (New Feedback Request) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,23,38,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 0;
}
.modal-overlay[hidden] {
  display: none;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 24px; }
}

.modal-panel {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 640px) {
  .modal-panel { border-radius: 16px; }
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h2 { margin: 0; font-size: 18px; }

.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.modal-form input, .modal-form textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-weight: 400;
  color: var(--text);
  min-height: 44px;
}
.modal-form textarea { min-height: 80px; resize: vertical; }
.optional { font-weight: 400; color: #a1a6b0; }
.modal-form .btn-primary { margin-top: 8px; }

.confirm-body { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.confirm-row label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.confirm-row div { font-size: 15px; }

.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.success-panel { text-align: center; padding: 32px 24px; }
.success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--received-bg); color: var(--received-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin: 0 auto 16px;
}
.success-panel h2 { margin: 0 0 20px; }
