:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #dde3ee;
  --accent: #ff9800;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 12px 35px rgba(22, 32, 51, .06);
  --transition: 0.2s ease;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.brand { font-weight: 800; color: var(--accent); text-decoration: none; font-size: 22px; letter-spacing: -0.3px; }
.topbar nav { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.topbar nav a {
  text-decoration: none;
  font-weight: 700;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  transition: background var(--transition);
}
.topbar nav a:hover { background: #f0f3f9; }

/* ── Shell / Layout ────────────────────────────────────────── */
.shell { width: min(1120px, calc(100% - 32px)); margin: 28px auto; flex: 1; }

/* ── Flash messages ────────────────────────────────────────── */
.flash {
  width: min(1120px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
  animation: flashIn 0.3s ease;
}
.flash.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cards ─────────────────────────────────────────────────── */
.auth-card, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.auth-card { max-width: 440px; margin: 44px auto; }
.card:hover { box-shadow: 0 16px 40px rgba(22, 32, 51, .09); }

/* ── Typography ────────────────────────────────────────────── */
h1, h2, p { margin-top: 0; }
h1 { letter-spacing: -0.5px; }
h2 { letter-spacing: -0.3px; }
.page-title { margin-bottom: 22px; }
.page-title h1 { margin-bottom: 4px; }
.page-title p, .muted, small { color: var(--muted); }

/* ── Forms ─────────────────────────────────────────────────── */
form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, .15);
}
button, .tabs a, .week-nav a {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition);
}
button:hover:not(:disabled), .tabs a:hover, .week-nav a:hover {
  background: #e68900;
  transform: translateY(-1px);
}
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ── Stats Grid ────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stats div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stats div:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stats strong { display: block; font-size: 28px; }
.stats span { color: var(--muted); font-weight: 700; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; }
.tabs a { background: #e8edf6; color: var(--text); }
.tabs a.active { background: var(--accent); color: #fff; }

/* ── Form Layouts ──────────────────────────────────────────── */
.card { margin-bottom: 18px; }
.grid-form { grid-template-columns: 1fr 1fr; }
.grid-form .full { grid-column: 1 / -1; }
.grid-form button { justify-self: start; }
.filter-bar { grid-template-columns: 180px 1fr auto; align-items: end; margin-bottom: 18px; }

/* ── Team Grid ─────────────────────────────────────────────── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.member, .report-head { display: flex; align-items: center; gap: 10px; }
.member {
  padding: 10px;
  border-radius: 8px;
  transition: background var(--transition);
}
.member:hover { background: #f5f7fc; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  flex: 0 0 auto;
  font-size: 14px;
}

/* ── Report Cards ──────────────────────────────────────────── */
.report-list { display: grid; gap: 12px; }
.report-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #fbfcff;
  margin-top: 12px;
  transition: border-color var(--transition), transform var(--transition);
}
.report-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.report-head { justify-content: space-between; }
.report-meta { color: var(--muted); margin: 9px 0; font-size: 14px; }
.status {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
  background: #e8edf6;
}
.status.completed { color: var(--green); background: #dcfce7; }
.status.in-progress { color: var(--amber); background: #fef3c7; }
.status.blocked { color: var(--red); background: #fee2e2; }
.blocker { border-left: 3px solid var(--red); padding: 8px 10px; background: #fff5f5; color: #991b1b; border-radius: 0 6px 6px 0; margin-top: 8px; }

/* ── Weekly Summary ────────────────────────────────────────── */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.week-nav a { background: #e8edf6; color: var(--text); }
.bar-row { display: grid; grid-template-columns: 220px 1fr 80px; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.bar-row div { height: 10px; background: #e8edf6; border-radius: 999px; overflow: hidden; }
.bar-row i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ffb74d); border-radius: 999px; transition: width 0.5s ease; }

/* ── Clients ───────────────────────────────────────────────── */
.client-list { display: flex; flex-wrap: wrap; gap: 10px; }
.client-chip {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  transition: border-color var(--transition);
}
.client-chip:hover { border-color: var(--accent); }
.client-chip button { padding: 5px 9px; background: #e8edf6; color: var(--text); }
.client-chip button:hover { background: var(--red); color: #fff; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .topbar nav span { display: none; }
  .stats, .grid-form, .filter-bar, .bar-row { grid-template-columns: 1fr; }
  .week-nav { align-items: stretch; flex-direction: column; }
}
