:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-muted: #f9fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --morning-bg: #fffbeb;
  --morning-accent: #d97706;
  --evening-bg: #eef2ff;
  --evening-accent: #4f46e5;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --radius-lg: 14px;
  --radius-md: 10px;
}

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

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 24px 28px;
  gap: 16px;
}

.page[hidden],
.auth-screen[hidden],
.logout-btn[hidden],
.auth-error[hidden] {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: -6px;
}

.auth-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.auth-input:focus {
  background: var(--surface);
  border-color: var(--accent);
}

.auth-error {
  font-size: 13px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 10px;
}

.auth-submit {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.auth-submit:hover {
  opacity: 0.92;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.logout-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.logout-btn:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.week-range {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.updated-at {
  font-size: 12px;
  color: var(--text-muted);
}

.refresh-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.refresh-btn:hover {
  background: var(--surface-muted);
  border-color: var(--accent);
}

.refresh-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.board-wrapper {
  flex: 1;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.board {
  flex: 1;
  min-width: 820px;
  display: grid;
  grid-template-columns: 92px repeat(5, minmax(145px, 1fr));
  grid-template-rows: auto minmax(280px, 1fr) minmax(280px, 1fr);
}

.board-loading,
.board-error {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-secondary);
  font-size: 15px;
}

.board-error {
  color: #b91c1c;
}

.corner-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.day-header {
  padding: 12px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-header:last-of-type {
  border-right: none;
}

.day-header.is-today {
  background: var(--accent-soft);
}

.day-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.day-header.is-today .day-name {
  color: var(--accent);
}

.day-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.row-label {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.row-label.morning {
  background: var(--morning-bg);
  color: var(--morning-accent);
}

.row-label.evening {
  background: var(--evening-bg);
  color: var(--evening-accent);
  border-bottom: none;
}

.slot-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  min-height: 240px;
}

.slot-cell.is-last-col {
  border-right: none;
}

.slot-cell.is-evening {
  border-bottom: none;
}

.slot-cell.is-today {
  background: #fafcff;
}

.slot-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  user-select: none;
}

.report-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.report-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.report-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.report-username {
  font-weight: 500;
  color: var(--text-secondary);
}

.report-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.report-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 768px) {
  .page {
    padding: 14px 12px 20px;
  }

  .topbar h1 {
    font-size: 19px;
  }
}
