:root { color-scheme: light; }
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: #FAFBFC;
  color: #1E2761;
  margin: 0;
  padding: 20px;
  line-height: 1.4;
}
.container { max-width: 1100px; margin: 0 auto; }

/* Top nav */
.topnav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #1E2761;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.nav-link {
  padding: 8px 14px;
  text-decoration: none;
  color: #1E2761;
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px 6px 0 0;
  transition: background 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-link:hover { background: #E8EAF6; }
.nav-link.active { background: #1E2761; color: #fff; }
.nav-link.disabled { color: #B0BEC5; cursor: not-allowed; pointer-events: none; }
.nav-link small {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 1px 5px; background: #ECEFF1; color: #607D8B; border-radius: 3px;
  font-weight: 700;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  padding-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
h1 { margin: 0; font-size: 22px; color: #1E2761; }

/* Date nav + buttons */
.date-line { color: #555; font-size: 14px; }
.date-nav {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0 18px; flex-wrap: wrap;
}
.nav-btn {
  background: #fff; border: 1px solid #C5CAE9; color: #1E2761;
  padding: 6px 12px; border-radius: 6px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: background 0.1s;
}
.nav-btn:hover { background: #E8EAF6; }
.nav-btn:active { background: #C5CAE9; }
.today-btn { background: #1E2761; color: #fff; border-color: #1E2761; }
.today-btn:hover { background: #2A3A8C; }
.today-btn.dim { background: #fff; color: #1E2761; }
.today-btn.dim:hover { background: #E8EAF6; }
input[type="date"] {
  border: 1px solid #C5CAE9; border-radius: 6px; padding: 5px 8px;
  font-size: 14px; color: #1E2761; font-family: inherit;
}

/* Summary card */
.summary {
  background: #fff; border: 1px solid #E0E4E8; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 16px; font-size: 13px;
  color: #444; display: flex; gap: 18px; flex-wrap: wrap;
}
.summary b { color: #1E2761; }

/* Schedule blocks */
.schedule { display: flex; flex-direction: column; gap: 4px; }
.block {
  display: grid; grid-template-columns: 88px 1fr 130px;
  gap: 12px; align-items: center;
  border: 1px solid #E0E4E8; border-left: 4px solid #B0BEC5;
  border-radius: 6px; padding: 10px 12px; background: #fff;
  font-size: 14px; transition: box-shadow 0.15s;
}
.block.now { box-shadow: 0 0 0 2px #E8B923; border-left-color: #E8B923; }
.block.past { opacity: 0.55; }
.block .time { font-weight: 600; color: #1E2761; }
.block .name { font-weight: 600; }
.block .detail { font-size: 12px; color: #555; margin-top: 2px; }
.block .cat {
  font-size: 11px; text-align: center; text-transform: uppercase;
  letter-spacing: 0.4px; font-weight: 600; color: #555;
}
.cat-morning  { background: #E8F5E9; border-left-color: #66BB6A; }
.cat-personal { background: #FFF3E0; border-left-color: #FB8C00; }
.cat-evening  { background: #EDE7F6; border-left-color: #7E57C2; }
.cat-focus    { background: #E3F2FD; border-left-color: #1976D2; }
.cat-admin    { background: #E3F2FD; border-left-color: #1976D2; }
.cat-meeting  { background: #E8EAF6; border-left-color: #7B1FA2; border-width: 2px; border-left-width: 5px; }
.cat-meeting .name { color: #4A148C; }
.cat-meeting .cat { color: #7B1FA2; }
.cat-meeting .meeting-link { font-size: 11px; }
.cat-meeting .meeting-link a { color: #5E35B2; text-decoration: none; }
.cat-meeting .meeting-link a:hover { text-decoration: underline; }
.now-marker { color: #E8B923; font-weight: 700; font-size: 11px; margin-left: 6px; }

/* Week grid */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.day-col {
  background: #fff; border: 1px solid #E0E4E8; border-radius: 8px;
  padding: 10px; min-height: 200px;
  display: flex; flex-direction: column;
}
.day-col.today { border-color: #1E2761; box-shadow: 0 0 0 2px #1E2761; }
.day-col.past { opacity: 0.6; }
.day-header {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid #E0E4E8; padding-bottom: 6px; margin-bottom: 8px;
}
.day-name { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: #1E2761; }
.day-date { font-size: 11px; color: #888; }
.day-events { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.day-event {
  padding: 5px 7px; background: #E8EAF6; border-left: 3px solid #7B1FA2;
  border-radius: 4px; cursor: pointer;
}
.day-event:hover { background: #D1D9F0; }
.day-event-time { font-weight: 600; font-size: 11px; color: #4A148C; }
.day-event-title { color: #1E2761; line-height: 1.3; word-break: break-word; }
.day-event a { color: inherit; text-decoration: none; display: block; }
.day-empty { font-size: 11px; color: #BBB; font-style: italic; padding: 4px 0; }

/* Sign-in / config screens */
.signin-screen {
  max-width: 420px; margin: 80px auto; background: #fff;
  border: 1px solid #E0E4E8; border-radius: 12px; padding: 32px;
  text-align: center;
}
.signin-screen h1 { font-size: 24px; margin-bottom: 8px; }
.signin-screen p { color: #555; margin: 0 0 24px; font-size: 14px; }
.gsi-btn {
  background: #1E2761; color: #fff; border: 0;
  padding: 12px 24px; font-size: 15px; font-weight: 600;
  border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
}
.gsi-btn:hover { background: #2A3A8C; }
.signout-btn {
  background: transparent; border: 0; color: #888;
  font-size: 12px; cursor: pointer; padding: 4px 8px;
}
.signout-btn:hover { color: #1E2761; text-decoration: underline; }
.config-warn {
  max-width: 600px; margin: 80px auto; background: #FFF3E0;
  border: 1px solid #FFCC80; border-radius: 12px; padding: 24px;
  color: #5D4037; font-size: 14px; line-height: 1.6;
}
.config-warn code { background: #FFE0B2; padding: 2px 6px; border-radius: 4px; }

/* Misc */
.empty-state, .error {
  background: #fff; border: 1px solid #E0E4E8; border-radius: 8px;
  padding: 24px; text-align: center; color: #555;
}
.error { border-color: #FFCDD2; background: #FFEBEE; color: #B71C1C; }
.loading { text-align: center; padding: 40px; color: #888; }
.footer { margin-top: 18px; font-size: 11px; color: #888; text-align: center; }

@media (max-width: 900px) {
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .day-col { min-height: auto; }
}
@media (max-width: 600px) {
  .week-grid { grid-template-columns: 1fr; }
  .block { grid-template-columns: 70px 1fr; }
  .block .cat { display: none; }
}
