:root {
  --border: #d8dce1;
  --bg: #f7f8fa;
  --brand: #1f3a5f;
  --ok: #2e7d32;
  --warn: #b26a00;
  --danger: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #1c1e21;
  background: var(--bg);
}

#nav { background: var(--brand); color: white; }
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.brand { font-weight: 600; }
.nav-links { display: flex; gap: 1rem; flex: 1; }
.nav-links a { color: #cfe0f3; text-decoration: none; font-size: 0.92rem; }
.nav-links a.active, .nav-links a:hover { color: white; text-decoration: underline; }
.nav-right { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; }
.nav-right a { color: #cfe0f3; }
.nav-right select { padding: 0.2rem; }

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

h1 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.subtitle { color: #666; margin-bottom: 1rem; font-size: 0.9rem; }

table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.88rem; vertical-align: top; }
th { background: #eef1f4; position: sticky; top: 0; }
tr.section-row td { background: #e3e9ef; font-weight: 600; }

.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.78rem; }
.badge.ok { background: #e5f3e6; color: var(--ok); }
.badge.pending { background: #fdf0da; color: var(--warn); }

.progress-bar { background: #e2e6ea; border-radius: 6px; overflow: hidden; height: 8px; width: 100%; }
.progress-fill { background: var(--ok); height: 100%; }

button { cursor: pointer; border: 1px solid var(--border); background: white; border-radius: 4px; padding: 0.3rem 0.7rem; font-size: 0.85rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--brand); color: white; border-color: var(--brand); }

input, select, textarea { font-family: inherit; font-size: 0.88rem; padding: 0.35rem; border: 1px solid var(--border); border-radius: 4px; }

.filters { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }

.error { color: var(--danger); padding: 0.6rem; background: #fdecea; border-radius: 4px; margin-bottom: 1rem; }
.loading { color: #666; padding: 1rem 0; }

.comment-thread { white-space: pre-wrap; font-size: 0.82rem; background: #fafafa; border: 1px solid var(--border); border-radius: 4px; padding: 0.5rem; max-height: 140px; overflow-y: auto; margin-top: 0.4rem; }

/* minmax(0, 1fr), not plain 1fr — a grid track's default min-width is "auto", which means it
   won't shrink below its content's intrinsic width. A long event title was stretching its whole
   column, blowing the grid wider than the page and pushing Fri/Sat off-screen. minmax(0, 1fr)
   plus min-width: 0 on the cell itself is what actually lets the ellipsis/overflow rules below
   kick in instead of just expanding the layout. */
.calendar-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.calendar-day { background: white; border: 1px solid var(--border); border-radius: 4px; min-height: 90px; padding: 0.3rem; font-size: 0.78rem; min-width: 0; overflow: hidden; }
.calendar-day .date-num { font-weight: 600; margin-bottom: 0.2rem; }
.calendar-day .event { display: block; border-radius: 3px; padding: 0.1rem 0.3rem; margin-bottom: 0.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.calendar-legend { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); font-size: 0.78rem; color: #444; }
.legend-item { display: flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.legend-swatch { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; border: 1px solid rgba(0,0,0,0.15); }
