:root {
  --primary: #0BA5CB;
  --accent: #1FB5D8;
  --background: #F6F9FC;
  --foreground: #243746;
  --card: #FFFFFF;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: var(--background);
  color: var(--foreground);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

/* ensure content isn't hidden behind the fixed mobile action bar on small screens */
@media (max-width: 979px) {
  .container { padding-bottom: calc(16px + 84px + env(safe-area-inset-bottom)); }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  padding: 16px;
}

h1, h2, h3 { margin: 0 0 12px; }
.label { font-weight: 600; margin-bottom: 8px; display: block; }

.input, .select, .button {
  width: 100%;
  height: 56px;
  border-radius: var(--radius);
  border: 1px solid #DDE3EA;
  padding: 0 14px;
  font-size: 16px;
}

.button {
  background: var(--primary);
  color: white;
  border: none;
}
.button:active { opacity: 0.9; }

/* Green action button (used for management / leader actions) */
.btn-green {
  display: inline-block;
  padding: 8px 14px;
  background: #27ae60;
  color: white;
  border-radius: 8px;
  text-decoration: none;
}
.btn-green:active { opacity: 0.95; }

.row { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 768px) {
  .row-2 { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #E6F7FB;
  color: #0B7187;
  font-size: 14px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  border-bottom: 1px solid #EEF2F7;
  padding: 10px;
  text-align: left;
}

a { color: var(--primary); text-decoration: none; }

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0f1724;
    --card: #0b1220;
    --foreground: #e6eef6;
  }
}

/* Mobile fixed action bar for operators (floating white rounded bar with icons) */
.mobile-actions {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 0; /* flush to bottom edge */
  z-index: 90;
  background: #f8fbfd; /* subtle pale background for the whole bar */
  border: 1px solid rgba(15,23,42,0.04);
  border-radius: 14px 14px 0 0;
  padding: 6px 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 12px 30px rgba(2,6,23,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-action-item {
  flex: 1 1 0;
  text-align: center;
  text-decoration: none;
  color: var(--foreground);
  padding: 6px 6px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  min-width: 0;
}
.mobile-action-item .nav-icon { font-size: 18px; line-height:1; }
.mobile-action-item .nav-label { font-size: 11px; color: #374151; }

/* Primary action styling (submit) */
.mobile-action-item.open-modal {
  background: linear-gradient(135deg,#34d399,#16a34a);
  color: #fff;
}
.mobile-action-item.open-modal .nav-label { color: rgba(255,255,255,0.95); }
.mobile-action-item.open-modal .nav-icon { color: rgba(255,255,255,0.95); }

.btn-logout { background: transparent; }

/* Hide fixed bar on larger screens where we have more space */
@media (min-width: 980px) {
  .mobile-actions { display: none; }
}

/* Small utility: compact cards for mobile dashboard */
.card.small { padding: 12px; }
.btn-small { padding: 6px 8px; font-size:13px; border-radius:8px; }
.card-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 520px) {
  .card-row { grid-template-columns: 1fr 1fr; }
}

/* Stat cards (Yesterday / This Week) */
.stat-card {
  color: #fff;
  padding: 14px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  box-shadow: 0 8px 20px rgba(2,6,23,0.15);
}
.stat-card .stat-label { font-size:14px; opacity:0.9; margin-bottom:6px; }
.stat-card .stat-value { font-size:22px; font-weight:800; line-height:1; }
.stat-card .stat-sub { font-size:12px; opacity:0.9; }

/* Gradient variants */
.stat-yesterday { background: linear-gradient(135deg, #67e8f9 0%, #0ea5a3 100%); }
.stat-week      { background: linear-gradient(135deg, #fbcfe8 0%, #f472b6 100%); }

/* small icon (optional) */
.stat-card .icon { font-size:20px; opacity:0.95; margin-bottom:6px; }

/* Modal styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(2,6,23,0.3);
}
.modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.close-btn { background: transparent; border: none; font-size:20px; cursor:pointer; }

/* Hide the form-panel on narrow screens in favor of modal */
.form-panel { display: block; }
@media (max-width: 979px) {
  .form-panel { display: none; }
}

/* Toast notification */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + 56px + env(safe-area-inset-bottom));
  background: rgba(2,6,23,0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(2,6,23,0.24);
  font-weight: 600;
  z-index: 1100;
  min-width: 160px;
  text-align: center;
}
.toast.show { display: block; animation: toast-in 320ms ease-out; }
@keyframes toast-in { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* Loading spinner overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top: 4px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
