:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;
  --primary: #0066cc;
  --primary-hover: #004fa3;
  --today-ring: #0066cc;
  --holiday-bg: #e8f0fb;
  --holiday-text: #0066cc;
  --weekend-bg: #f4f5f6;
  --past-text: #adb5bd;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
}

header h1 a {
  color: var(--text);
  text-decoration: none;
}

.header-shield { display: flex; align-items: center; }
.header-shield img { display: block; }

.header-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.header-spacer { flex: 1; }

.header-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-links a {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.header-links a:hover { color: var(--text); }

/* ── Main ── */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ── Calendar nav ── */
#cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

#cal-nav h2 {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 180px;
  text-align: center;
}

#cal-nav button {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  line-height: 1.4;
}
#cal-nav button:hover { background: var(--bg); }

#today-btn {
  margin-left: 4px;
  font-size: 13px;
  color: var(--primary);
  border-color: var(--primary);
}

/* ── Calendar grid ── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-dow {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 4px 0 8px;
}

#calendar-grid-header { margin-bottom: 0; }

.cal-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  min-height: 76px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-cell.cal-empty {
  background: transparent;
  border-color: transparent;
}

.cal-cell.cal-weekend {
  background: var(--weekend-bg);
}

.cal-cell.cal-today {
  border-color: var(--today-ring);
  border-width: 2px;
}

.cal-date-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
}

.cal-today .cal-date-num {
  color: var(--primary);
}

.cal-past .cal-date-num {
  color: var(--past-text);
}

.cal-host {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.cal-past .cal-host {
  color: var(--past-text);
  font-weight: 500;
}

.cal-today .cal-host {
  color: var(--primary);
}

.cal-holiday {
  font-size: 11px;
  color: var(--holiday-text);
  background: var(--holiday-bg);
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.4;
  display: inline-block;
}

.cal-unassigned {
  font-size: 11px;
  color: #dc3545;
  font-style: italic;
}

.cal-past .cal-unassigned {
  color: var(--past-text);
}

.cal-past .cal-holiday {
  color: var(--past-text);
  background: transparent;
  padding: 0;
}

/* ── Loading / footer ── */
#loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 24px 20px;
}

footer a { color: var(--primary); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .cal-cell { min-height: 56px; padding: 4px 5px; }
  .cal-host { font-size: 11px; }
  #cal-nav h2 { min-width: 140px; font-size: 1rem; }
}
