:root {
  --bg: #fafaf6;
  --panel: #ffffff;
  --panel-2: #f2f2ec;
  --border: #dcdcd0;
  --text: #1a1a1a;
  --muted: #6a6a5a;
  --accent: #0c6753;
  --accent-2: #0f8367;
  --success: #0c6753;
  --danger: #c94a3f;
  --private: #7c5cbf;
  --sunset: #e8a35a;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); min-height: 100dvh; }
body { padding-bottom: env(safe-area-inset-bottom); }

#root { max-width: 640px; margin: 0 auto; padding: 20px 16px 100px; min-height: 100dvh; }

h1, h2, h3 { margin: 0 0 12px; font-weight: 700; }
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 20px; }
h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; font-size: 15px; font-weight: 600; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer; user-select: none;
  transition: transform 0.06s, background 0.15s;
}
button:active, .btn:active { transform: scale(0.98); }
button.primary, .btn.primary { background: var(--accent); color: #fafaf6; border-color: var(--accent); }
button.primary:hover { background: var(--accent-2); }
button.danger { background: var(--danger); color: white; border-color: var(--danger); }
button.ghost { background: transparent; }

input, select, textarea {
  width: 100%; padding: 12px 14px; font-size: 15px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }

/* login */
.login-hero {
  width: 100%; max-width: 640px; aspect-ratio: 16/9;
  background: url('/startup.jpg') center/cover no-repeat;
  border-radius: 20px; margin-bottom: -40px;
  box-shadow: 0 8px 32px rgba(12, 103, 83, 0.15);
}
.login-card {
  max-width: 420px; margin: 0 auto; padding: 32px 28px 28px;
  background: var(--panel); border-radius: 20px; border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  position: relative;
}
.login-card .logo {
  width: 64px; height: 64px; display: block; margin: -60px auto 12px;
  background: var(--panel); padding: 4px; border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.login-card h1 { text-align: center; margin-bottom: 6px; color: var(--accent); }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .actions { margin-top: 20px; }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 1em; }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.top .who { font-size: 14px; color: var(--muted); }
.top .who strong { color: var(--text); font-weight: 700; }

/* task list */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.task {
  display: flex; align-items: center; gap: 12px; padding: 14px 12px; margin: 4px 0;
  background: var(--panel-2); border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  transition: transform 0.08s;
}
.task:active { transform: scale(0.98); }
.task.done { opacity: 0.55; text-decoration: line-through; }
.task.private { background: linear-gradient(90deg, rgba(124,92,191,0.08), var(--panel-2)); border-color: rgba(124,92,191,0.35); }
.task.locked { opacity: 0.5; cursor: not-allowed; }
.task .check {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700;
}
.task.done .check { background: var(--success); border-color: var(--success); color: white; }
.task .title { flex: 1; font-size: 15px; display: flex; flex-direction: column; gap: 3px; }
.task .pts { color: var(--sunset); font-weight: 700; font-size: 14px; }
.task .badge-priv { font-size: 11px; color: var(--private); font-weight: 600; }

/* day nav */
.day-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.day-nav .day-label { font-size: 18px; font-weight: 700; text-align: center; flex: 1; }
.day-nav button { min-width: 44px; padding: 8px 12px; font-size: 18px; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; text-align: center; }
.cal-head button { min-width: 44px; }
.grid7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.grid7 .wd { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; text-transform: uppercase; letter-spacing: 0.05em; }
.cal-cells { margin-top: 4px; }
.cell {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 13px; background: var(--panel-2); cursor: pointer; padding: 4px; transition: background 0.15s;
}
.cell.empty { background: transparent; cursor: default; }
.cell.today { outline: 2px solid var(--accent); }
.cell.has-points { background: linear-gradient(135deg, rgba(232,163,90,0.15), var(--panel-2)); }
.cell.future { opacity: 0.4; cursor: not-allowed; }
.cell .d { font-weight: 600; }
.cell .p { font-size: 10px; color: var(--sunset); font-weight: 700; margin-top: 2px; }

/* tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; padding: 4px; background: var(--panel); border-radius: 12px; }
.tabs button {
  flex: 1; background: transparent; border: none; padding: 10px; font-size: 14px;
  color: var(--muted); border-radius: 8px;
}
.tabs button.active { background: var(--panel-2); color: var(--text); }

/* rank */
.rank-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.rank-row:last-child { border-bottom: none; }
.rank-row .name { font-weight: 600; }
.rank-row .role { font-size: 12px; color: var(--muted); margin-left: 6px; }
.rank-row .pts { font-weight: 700; color: var(--sunset); font-size: 18px; }
.rank-row .priv { font-size: 12px; color: var(--private); }

/* goal */
.goal { padding: 14px; background: var(--panel-2); border-radius: 12px; margin-bottom: 10px; }
.goal .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.goal .bar { height: 8px; background: var(--panel); border-radius: 4px; overflow: hidden; }
.goal .fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--sunset) 100%); transition: width 0.4s; }
.goal .reward { margin-top: 8px; font-size: 14px; }

/* admin task form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.weekday-mask { display: flex; gap: 4px; margin-top: 6px; }
.weekday-mask label { flex: 1; margin: 0; text-align: center; padding: 8px 0; background: var(--panel-2); border-radius: 8px; cursor: pointer; font-size: 12px; }
.weekday-mask input { display: none; }
.weekday-mask input:checked + span { color: var(--accent); font-weight: 700; }
.weekday-mask label span { display: block; }

/* bottom nav */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--border);
  display: flex; padding: 8px calc(env(safe-area-inset-left) + 4px) calc(env(safe-area-inset-bottom) + 8px);
  z-index: 100;
}
.nav button { flex: 1; flex-direction: column; gap: 2px; background: transparent; border: none; color: var(--muted); font-size: 11px; padding: 6px; }
.nav button.active { color: var(--accent); }
.nav button .icon { font-size: 20px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 200; }
.modal { background: var(--panel); border-radius: 16px; padding: 20px; max-width: 480px; width: 100%; max-height: 90vh; overflow: auto; }
.modal h2 { margin-bottom: 16px; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.small { font-size: 13px; color: var(--muted); }
