@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface2: #f4f7fb;
  --primary: #1B4F8A;
  --primary-dark: #133a6a;
  --primary-light: #e8f0f9;
  --accent: #F47920;
  --accent-dark: #d4621a;
  --accent-light: #fef0e6;
  --green: #22c55e;
  --green-light: #dcfce7;
  --yellow: #F47920;
  --yellow-light: #fef0e6;
  --red: #ef4444;
  --red-light: #fee2e2;
  --text: #1a2a3a;
  --text-muted: #5a6f84;
  --border: #dae3ee;
  --shadow: 0 4px 24px rgba(27,79,138,0.10);
  --radius: 18px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── layout ── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--primary);
  border-bottom: 3px solid var(--accent);
  padding: 0 2rem;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(27,79,138,0.18);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.topbar-brand img {
  height: 36px;
  filter: none;
}

.topbar-brand .divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.3);
}

.topbar-brand .app-label {
  font-weight: 800;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.topbar-brand .emoji { font-size: 1.5rem; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-user {
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
}

.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* ── cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  border-radius: 50px;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(244,121,32,0.30);
}
.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 6px 20px rgba(244,121,32,0.40); }

.btn-ghost {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.25);
}
.btn-ghost:hover { background: rgba(255,255,255,0.25); color: #fff; }

/* ghost variant for light backgrounds */
.btn-ghost-dark {
  background: var(--surface2);
  color: var(--text-muted);
  border: 2px solid var(--border);
}
.btn-ghost-dark:hover { background: var(--border); color: var(--text); }

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm {
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
}

/* ── auth forms ── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1B4F8A 0%, #1e5fa3 40%, #F47920 100%);
  padding: 2rem;
}

.auth-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(27,79,138,0.18);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.8rem;
}

.auth-logo .big-emoji { font-size: 3.5rem; display: block; margin-bottom: 0.4rem; }
.auth-logo h1 { font-size: 1.7rem; font-weight: 900; color: var(--primary); }
.auth-logo p { color: var(--text-muted); font-size: 0.9rem; font-weight: 600; margin-top: 0.2rem; }

.auth-logo img { height: 52px; display: block; margin: 0 auto 0.6rem; }
.auth-logo .sub { color: var(--text-muted); font-size: 0.88rem; font-weight: 700; margin-top: 0.3rem; letter-spacing: 0.3px; }

.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,79,138,0.15);
}

.auth-submit {
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  margin-top: 0.5rem;
}

.auth-link {
  text-align: center;
  margin-top: 1.2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.auth-link a { color: var(--primary); font-weight: 800; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

/* ── flash messages ── */
.flash {
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 0.92rem;
}
.flash.error { background: var(--red-light); color: var(--red); border-left: 4px solid var(--red); }
.flash.success { background: var(--green-light); color: #16a34a; border-left: 4px solid var(--green); }

/* ── calendar ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  padding: 0.4rem 0;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.18s;
  position: relative;
  user-select: none;
}

.cal-day.empty { background: transparent; cursor: default; }

.cal-day.normal {
  background: var(--surface2);
  color: var(--text);
}
.cal-day.normal:hover { border-color: var(--primary); background: #e0e7ff; }

.cal-day.planned {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.cal-day.planned.worked {
  background: var(--green-light);
  color: #16a34a;
  border-color: var(--green);
}

.cal-day.planned.worked::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 5px;
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--green);
}

.cal-day.today-marker {
  box-shadow: 0 0 0 3px var(--accent);
}

.cal-day.past-planned:not(.worked) {
  background: var(--red-light);
  color: var(--red);
  border-color: var(--red);
}

.cal-day.future { opacity: 0.5; cursor: default; }
.cal-day.weekend { opacity: 0.45; }

/* planning picker */
.cal-day.pick-mode.normal:hover { background: var(--primary-light); border-color: var(--primary); transform: scale(1.08); }
.cal-day.pick-mode.selected { background: var(--accent); color: #fff; border-color: var(--accent-dark); transform: scale(1.05); }
.cal-day.pick-mode.weekend { opacity: 0.3; pointer-events: none; }

/* ── stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  font-family: 'Space Mono', monospace;
  line-height: 1;
}

.stat-sub { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

/* ── bonus banner ── */
.bonus-banner {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  box-shadow: 0 6px 24px rgba(251,191,36,0.35);
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-bottom: 1.5rem;
}

@keyframes pop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.bonus-banner .emoji { font-size: 2.8rem; }
.bonus-banner h2 { font-size: 1.2rem; font-weight: 900; color: #78350f; }
.bonus-banner p { font-size: 0.9rem; color: #92400e; font-weight: 700; }

/* ── admin table ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.admin-table th {
  text-align: left;
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface2); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge-green { background: var(--green-light); color: #16a34a; }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-yellow { background: var(--accent-light); color: var(--accent-dark); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

/* ── progress bar ── */
.progress-wrap { background: var(--surface2); border-radius: 50px; height: 10px; overflow: hidden; width: 120px; }
.progress-bar {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--primary), #2d6cb5);
  transition: width 0.4s ease;
}
.progress-bar.full { background: linear-gradient(90deg, var(--green), #4ade80); }

/* ── month nav ── */
.month-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.month-nav h2 { font-size: 1.3rem; font-weight: 900; flex: 1; text-align: center; }

/* ── planning notice ── */
.notice {
  background: var(--accent-light);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.notice .emoji { font-size: 2rem; flex-shrink: 0; }
.notice h3 { font-size: 1.05rem; font-weight: 900; color: var(--accent-dark); margin-bottom: 0.3rem; }
.notice p { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }

/* ── today action ── */
.today-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem 1.8rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border: 2px solid var(--border);
}

.today-action.is-planned { border-color: var(--primary); }
.today-action.is-worked { border-color: var(--green); background: var(--green-light); }

.today-label { font-weight: 700; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.today-date { font-size: 1.1rem; font-weight: 900; color: var(--text); }

.check-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--surface2);
  font-size: 1.6rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.check-btn:hover { transform: scale(1.12); }
.check-btn.checked { background: var(--green); border-color: var(--green); color: #fff; }
.check-btn.unchecked { background: #fff; border-color: var(--border); }

/* ── responsive ── */
@media (max-width: 600px) {
  .main-content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .card { padding: 1.2rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .cal-day { font-size: 0.8rem; }
}
