:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --text: #f2f2f2;
  --muted: #9aa0aa;
  --accent: #f5a623;
  --green: #3ecf6f;
  --red: #e5484d;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 10px 16px;
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; text-decoration: none; font-size: 1.05rem; flex-shrink: 0; }
.brand .logo { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; row-gap: 4px; }
.logout-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.profile-link { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.profile-link.active { text-decoration: underline; }
.lang-switch { font-size: 0.85rem; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.lang-switch a { color: var(--muted); }
.lang-switch a.lang-active { color: var(--accent); font-weight: 700; }

.flash { background: rgba(245,166,35,0.15); color: var(--accent); padding: 10px 14px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 600; }

.container { max-width: 640px; margin: 0 auto; padding: 20px 16px 32px; }
body.has-bottom-nav .container { padding-bottom: 100px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--card); border-top: 1px solid #2a2e38;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 600;
  border-radius: 10px;
}
.bottom-nav a .icon { font-size: 1.3rem; line-height: 1; }
.bottom-nav a.active { color: var(--accent); }

h1 { font-size: 1.5rem; margin-bottom: 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hint { color: var(--muted); margin-top: 0; }
.role-tag { color: var(--accent); font-weight: 700; }
.error { color: var(--red); font-weight: 600; }

.grid-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 20px; }
.staff-card {
  display: flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--text); text-decoration: none;
  border-radius: var(--radius); padding: 28px 12px; font-size: 1.15rem; font-weight: 600;
  text-align: center;
}
.staff-card:active { background: var(--accent); color: #000; }

.pin-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; max-width: 240px; }
.pin-form input {
  font-size: 2rem; letter-spacing: 0.5em; text-align: center; padding: 14px;
  border-radius: var(--radius); border: none; background: var(--card); color: var(--text);
}
.pin-form button, .stacked-form button, .grid-picker + form button {
  font-size: 1.1rem; padding: 14px; border-radius: var(--radius); border: none;
  background: var(--accent); color: #000; font-weight: 700;
}
.back-link { display: inline-block; margin-top: 16px; color: var(--muted); text-decoration: none; }

.task-section { margin-bottom: 8px; }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: flex; align-items: stretch; gap: 12px;
  background: var(--card); border-radius: var(--radius); padding: 12px;
}
.task-item.done { opacity: 0.55; }
.task-item.overdue { border: 1px solid var(--red); }
.task-item form { margin: 0; }
.check-btn {
  width: 52px; flex-shrink: 0; border-radius: 12px; border: 2px solid var(--muted);
  background: transparent; color: var(--green); font-size: 1.4rem; font-weight: 800;
}
.task-item.done .check-btn { border-color: var(--green); background: rgba(62,207,111,0.15); }
.check-btn.photo-btn { display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.3rem; }
.task-body { flex: 1; }
.task-title { font-weight: 600; font-size: 1.05rem; }
.task-desc { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.task-meta { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.photo-thumb-link { display: inline-block; margin-top: 8px; }
.photo-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid #2a2e38; display: block; }
.badge { background: #2a2e38; color: var(--muted); font-size: 0.78rem; padding: 3px 9px; border-radius: 999px; }
.badge.muted { opacity: 0.7; }
.badge.done-badge { background: rgba(62,207,111,0.15); color: var(--green); }
.badge.missed-badge { background: rgba(229,72,77,0.15); color: var(--red); }

.status-dot { width: 10px; border-radius: 999px; background: var(--muted); }
.task-item.done .status-dot { background: var(--green); }
.task-item.pending .status-dot { background: var(--red); }

.table-scroll { overflow-x: auto; margin-top: 12px; }
.admin-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #2a2e38; white-space: nowrap; }
.admin-table td.title-cell {
  white-space: normal; min-width: 180px; max-width: 260px;
  vertical-align: middle;
}
.inactive-row { opacity: 0.4; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 0.85rem; padding: 0; text-decoration: none; }
.row-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.row-actions form { margin: 0; }
.reorder-cell { display: flex; flex-direction: column; gap: 2px; width: 32px; }
.reorder-cell form { margin: 0; }
.reorder-btn { background: none; border: 1px solid #2a2e38; border-radius: 6px; color: var(--muted); font-size: 0.75rem; padding: 2px 6px; line-height: 1.4; }
.reorder-btn:active { color: var(--accent); border-color: var(--accent); }

.stacked-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.stacked-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.stacked-form input, .stacked-form select, .stacked-form textarea {
  font-size: 1rem; padding: 10px; border-radius: 10px; border: none; background: var(--card); color: var(--text);
}
.inline-form input { padding: 10px; border-radius: 10px; border: none; background: var(--card); color: var(--text); }

.stacked-form textarea { font-family: inherit; resize: vertical; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 0.95rem !important; color: var(--text) !important; }
.checkbox-label input { width: 18px; height: 18px; }
.hint.small { font-size: 0.8rem; margin-top: -6px; }

.feedback-item { flex-direction: column; align-items: stretch; gap: 8px; }
.feedback-item .task-desc { color: var(--text); font-size: 0.95rem; white-space: pre-wrap; }
.feedback-toggle { align-self: flex-end; margin: 0; }
