﻿:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #121722;
  --muted: #5d6576;
  --accent: #0f766e;
  --accent-soft: #d7f2ef;
  --danger: #b42318;
  --border: #d8deea;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at 15% 10%, #effaf8 0%, var(--bg) 45%);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 10px calc(96px + env(safe-area-inset-bottom));
}

.hero {
  background: linear-gradient(135deg, #083344, #0f766e);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 1.32rem;
  line-height: 1.2;
}

.tag {
  display: inline-block;
  margin: 0 0 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-size: 0.78rem;
}

.countdown {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 13px;
  padding: 12px;
  width: 100%;
}

.countdown p { margin: 0; opacity: 0.9; }

.countdown strong {
  display: block;
  font-size: 1.45rem;
  margin: 4px 0;
}

.countdown span {
  font-size: 0.74rem;
  opacity: 0.95;
}

.top-nav {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.top-nav-links {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #cad6e8;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  overflow: visible;
}

.top-nav-links::-webkit-scrollbar { height: 0; }

.top-nav a {
  justify-content: center;
  text-align: center;
  text-decoration: none;
  color: #083344;
  border: 1px solid #b9d2cf;
  background: #eaf8f5;
  padding: 8px 6px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem;
  min-height: 38px;
  display: flex;
  align-items: center;
}

.top-nav-links a,
.top-nav .logout-link {
  -webkit-appearance: none;
  appearance: none;
  border-width: 1px;
  border-style: solid;
}

.top-nav a.active {
  color: #fff;
  border-color: #0f766e;
  background: #0f766e;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.28);
}

.mode-pill {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  justify-self: start;
}

.mode-pill.editor {
  background: #d7f2ef;
  color: #0a4a44;
}

.mode-pill.viewer {
  background: #e8eef9;
  color: #23406e;
}

.logout-link {
  justify-self: start;
  padding: 7px 10px !important;
  background: #fff4f4 !important;
  border-color: #f3c8c8 !important;
  color: #7a1f1f !important;
  border: 1px solid #f3c8c8 !important;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
}

.readonly-banner {
  margin-top: 10px;
  border: 1px solid #bfd0ef;
  background: #edf4ff;
  color: #22406b;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.86rem;
}

.flash {
  margin-top: 10px;
  background: var(--accent-soft);
  border: 1px solid #8bd0c8;
  color: #063b36;
  padding: 10px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.stats-grid,
.content-grid,
.charts-grid,
.program-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.content-grid.one-col {
  grid-template-columns: 1fr;
}

.stats-grid article,
.card,
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.chart-card {
  padding-bottom: 10px;
}

.big {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 8px 0;
}

.mono {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.2px;
}

.stats-grid h3,
.card h2,
.chart-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.stats-grid small,
.card small,
.muted {
  color: var(--muted);
}

form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.87rem;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #ccd4e1;
  border-radius: 10px;
  background: #fff;
  min-height: 44px;
}

textarea {
  resize: vertical;
  min-height: 94px;
}

button {
  padding: 10px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
}

button:hover {
  filter: brightness(0.96);
}

.inline-form {
  margin-top: 12px;
}

button.danger {
  background: var(--danger);
}

.program-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.program-list li {
  border: 1px solid #dfe6f2;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.program-cards li {
  border: 1px solid #b8d8d3;
  background: linear-gradient(180deg, #f5fcfb 0%, #ffffff 70%);
  border-left: 5px solid #0f766e;
}

.program-day {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #0b4c47;
}

.program-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.program-details {
  font-size: 0.84rem;
  line-height: 1.45;
  color: #334155;
}

.data-table {
  width: 100%;
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e5ebf5;
  padding: 7px 6px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #324155;
  background: #f9fbff;
}

canvas {
  width: 100%;
  height: 240px !important;
  min-height: 240px;
  max-height: 240px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 25% 20%, #e5fbf8 0%, #eef2f8 65%);
}

.pin-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 12px;
}

.pin-card {
  background: #ffffff;
  border: 1px solid #dce4f1;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.14);
}

.pin-card h1 { margin: 4px 0 6px; }

#pinInput {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pin-dots {
  margin: 16px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid #9ca3af;
  background: #fff;
}

.pin-dots span.filled {
  background: #0f172a;
  border-color: #0f172a;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-pad button {
  min-height: 54px;
  border-radius: 50px;
  border: 1px solid #d3dce8;
  background: #f8fbff;
  color: #111827;
  font-size: 1.05rem;
  font-weight: 700;
}

.pin-pad button[data-action="submit"] {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}

.pin-pad button[data-action="clear"] {
  background: #fff4f4;
  color: #8f1d1d;
  border-color: #f1cccc;
}

.login-flash {
  background: #fff4f4;
  border-color: #f0c7c7;
  color: #8f1d1d;
}

input,
select,
textarea,
button {
  font-size: 16px;
}

@media (max-width: 390px) {
  .top-nav-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  canvas {
    height: 210px !important;
    min-height: 210px;
    max-height: 210px;
  }
}
