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

:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #1a2332;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 16px; }
.wrap-narrow { max-width: 480px; margin: 0 auto; padding: 16px; }

header.top {
  background: var(--accent);
  color: #fff;
  padding: 14px 16px;
}
header.top .wrap, header.top .wrap-narrow {
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
header.top h1 { font-size: 1.05rem; font-weight: 600; }
header.top a { color: #ccfbf1; text-decoration: none; font-size: .85rem; }
header.top a:hover { text-decoration: underline; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
.card h2 { font-size: 1rem; margin-bottom: 12px; }
.card h2 .sub { color: var(--muted); font-weight: 400; font-size: .85rem; }

label { display: block; font-size: .85rem; font-weight: 600; margin: 14px 0 6px; }
select, input[type=text], input[type=password], input[type=date], input[type=tel] {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
select:focus, input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: var(--accent-dark); }
.btn.full { width: 100%; margin-top: 18px; }
.btn.small { padding: 6px 12px; font-size: .8rem; font-weight: 500; }
.btn.gray { background: #e2e8f0; color: var(--ink); }
.btn.gray:hover { background: #cbd5e1; }
.btn.danger { background: #fee2e2; color: var(--red); }
.btn.danger:hover { background: #fecaca; }

.remembered {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 16px;
}

.codebox {
  text-align: center;
  background: #f0fdfa;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 14px;
  margin-top: 16px;
}
.codebox .digits { font-size: 3rem; font-weight: 800; letter-spacing: .3em; color: var(--accent-dark); }
.codebox .hint { font-size: .8rem; color: var(--muted); }

input.code-input {
  text-align: center;
  font-size: 2rem;
  letter-spacing: .5em;
  font-weight: 700;
}

.alert { border-radius: 8px; padding: 12px 14px; margin-top: 16px; font-size: .9rem; }
.alert.err { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.alert.ok  { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.success-screen { text-align: center; padding: 30px 10px; }
.success-screen .tick {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--green); color: #fff;
  font-size: 3rem; line-height: 84px;
  margin: 0 auto 16px;
}
.success-screen .when { font-size: 1.6rem; font-weight: 700; margin: 6px 0; }
.success-screen .who { color: var(--muted); }

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.status-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 6px solid var(--muted);
  border-radius: 10px;
  padding: 12px 14px;
}
.status-card.ok   { border-left-color: var(--green); }
.status-card.warn { border-left-color: var(--yellow); }
.status-card.late { border-left-color: var(--red); }
.status-card .loc { font-weight: 700; }
.status-card .ago { font-size: .85rem; color: var(--muted); }
.status-card .guard { font-size: .8rem; color: var(--muted); }

table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
td.time { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }

.tabs { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 16px; border-radius: 8px 8px 0 0;
  text-decoration: none; color: var(--muted);
  background: #e2e8f0; font-size: .9rem; font-weight: 600;
}
.tabs a.on { background: var(--card); color: var(--accent-dark); border: 1px solid var(--line); border-bottom: none; }

.row-form { display: flex; gap: 8px; align-items: center; }
.row-form input { flex: 1; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.muted { color: var(--muted); font-size: .85rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge.on  { background: #dcfce7; color: #166534; }
.badge.off { background: #f1f5f9; color: var(--muted); }

footer { text-align: center; padding: 24px; color: var(--muted); font-size: .8rem; }
footer a { color: var(--muted); }

@media (max-width: 600px) {
  .hide-sm { display: none; }
}
