/* ── Reset & base ─────────────────────────────────────────── */
:root {
  --accent:      #3a9e4f;
  --accent-dark: #2d8040;
  --accent-light:#f0faf2;
  --accent-border:#a7d9b0;
  --header-bg:   #0f1f17;   /* dark green-black — matches admin sidebar */
  --text:        #0f1f17;
  --text-muted:  #8aab94;
  --border:      #e2e8e4;
  --bg:          #f7f9f8;
  --card:        #ffffff;
  --red:         #dc2626;
  --amber:       #d97706;
  --radius:      12px;
  --tap:         48px;   /* minimum tap target */
  --font-ui:     'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:   'DM Mono', 'SF Mono', monospace;
}

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

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

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px; /* space for bottom nav */
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
button, input, select { font-family: inherit; font-size: 1rem; }

/* ── App header ───────────────────────────────────────────── */
.app-header {
  background: var(--header-bg);
  color: #fff;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
  /* subtle brightness boost so the mark reads well on dark bg */
  filter: brightness(1.15);
}
.header-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.header-title span {
  font-weight: 400;
  color: #8aab94;
}
.app-header .header-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: #4a7a58;
  margin-top: 1px;
  line-height: 1;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.header-right a { color: #8aab94; font-size: 0.82rem; font-weight: 600; }
.header-right a:hover { color: #d4ead9; }

/* ── Bottom nav ───────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  gap: 3px;
  min-height: var(--tap);
  text-decoration: none;
}
.bottom-nav a.active { color: var(--accent); }
.bottom-nav a svg { width: 22px; height: 22px; }

/* ── Page content ─────────────────────────────────────────── */
.page { padding: 16px; max-width: 600px; margin: 0 auto; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-header {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: #f9fbfa;
}
.card-body { padding: 14px 16px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  height: var(--tap);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn:active { opacity: 0.85; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 2px 8px rgba(58,158,79,0.3); }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-outline   { background: transparent; border: 2px solid var(--accent); color: var(--accent); }
.btn-full      { width: 100%; }
.btn-sm        { height: 36px; padding: 0 14px; font-size: 0.82rem; border-radius: 8px; }

/* ── Form controls ────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.form-control {
  width: 100%;
  height: var(--tap);
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58,158,79,0.15);
}
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238aab94' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Flash messages ───────────────────────────────────────── */
.flash-list { list-style: none; padding: 0 16px; margin-top: 12px; }
.flash-list li {
  padding: 11px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--accent-light);
  color: #1a5c2a;
  border: 1px solid var(--accent-border);
}

/* ── Week cards (dashboard / weeks page) ──────────────────── */
.week-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.week-card:active { background: var(--bg); }
.week-label { font-weight: 700; font-size: 1rem; }
.week-sub   { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-gray     { background: #f1f5f2; color: #3d5c47; }
.badge-amber    { background: #fef3c7; color: #92400e; }
.badge-green    { background: var(--accent-light); color: #1a5c2a; }
.badge-blue     { background: #dbeafe; color: #1e40af; }

/* ── Crew list ────────────────────────────────────────────── */
.crew-list { list-style: none; }
.crew-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.crew-item:last-child { border-bottom: none; }
.crew-item:active { background: var(--bg); }
.crew-name  { font-weight: 600; font-size: 0.95rem; }
.crew-meta  { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.crew-arrow { color: var(--text-muted); font-size: 1.2rem; }

/* ── Entry page ───────────────────────────────────────────── */
.emp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.emp-nav a { color: var(--accent); font-weight: 600; padding: 8px 4px; }
.emp-nav .emp-counter { color: var(--text-muted); font-size: 0.8rem; }

.day-row {
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}
.day-row:last-child { border-bottom: none; }
.day-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}
.day-label {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 90px;
}
.day-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.day-inputs {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.day-inputs .input-group { flex: 1; min-width: 100px; }
.day-inputs label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: block;
  margin-bottom: 4px;
}
.day-inputs input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-ui);
}
.day-inputs input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58,158,79,0.15);
}

.override-toggle {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 8px;
  display: inline-block;
  cursor: pointer;
  font-weight: 600;
}
.override-fields {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.override-fields select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: var(--font-ui);
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
}

/* ── Save bar (sticky bottom) ─────────────────────────────── */
.save-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  z-index: 200;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.save-bar .btn { flex: 1; }

/* ── Review page ──────────────────────────────────────────── */
.review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.review-row:last-child { border-bottom: none; }
.review-row.warning { background: #fffbeb; }
.review-hours { font-weight: 700; color: var(--accent); }
.review-warning { color: var(--amber); font-size: 0.78rem; }

/* ── Admin tables ─────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f9fbfa;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }

/* ── Login ────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: #0f1f17;
  position: relative;
}
.login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(58,158,79,0.12) 0%, transparent 65%);
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #e8f5eb;
  letter-spacing: -0.04em;
}
.login-logo h1 span { color: #4cba62; }
.login-logo p {
  font-size: 0.82rem;
  color: #6b9a76;
  margin-top: 4px;
  font-weight: 500;
}
.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.72rem;
  color: #4a7a58;
  position: relative;
  z-index: 1;
}

/* Input overrides inside the dark glass login card */
.login-card .form-group label { color: #6b9a76; }
.login-card .form-control {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: #e8f5eb;
}
.login-card .form-control::placeholder { color: #4a7a58; }
.login-card .form-control:focus {
  background: rgba(255,255,255,0.12);
  border-color: #3a9e4f;
  box-shadow: 0 0 0 3px rgba(58,158,79,0.20);
}

/* ── Utilities ────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 16px 16px 6px;
}
