*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: #1a1a2e; background: #f4f4f8;
  max-width: 960px; margin: 0 auto; padding: 24px 16px 40px;
}

main { padding-top: 24px; }

/* ---- navigation -------------------------------------------------------- */
.breadcrumb { margin-bottom: 12px; font-size: 13px; color: #666; }
.breadcrumb a { color: #0066cc; }

/* ---- schedule list ----------------------------------------------------- */
.sched-list { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.sched-card { background: #fff; border-radius: 8px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.sched-card h2 { font-size: 18px; }
.sched-card h2 a { color: #1a1a2e; text-decoration: none; }
.sched-card h2 a:hover { text-decoration: underline; }
.sched-meta { display: flex; gap: 16px; font-size: 13px; margin: 4px 0 8px; }
.day-links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.day-links a { display: inline-block; padding: 4px 10px; background: #e8e8f0; border-radius: 4px; font-size: 13px; color: #333; text-decoration: none; }
.day-links a:hover { background: #d0d0e0; }

/* ---- day list (schedule detail) ---------------------------------------- */
.day-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.day-list a { display: block; padding: 8px 12px; background: #fff; border-radius: 4px; color: #1a1a2e; text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.day-list a:hover { background: #f0f0ff; }

/* ---- calendar ---------------------------------------------------------- */
.calendar-month { margin-bottom: 24px; }
.cal-month-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: #333; }
.calendar-grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.calendar-grid th { padding: 6px 4px; background: #f8f8fc; font-size: 12px; font-weight: 600; color: #666; text-align: center; }
.cal-cell { text-align: center; padding: 0; height: 48px; vertical-align: middle; }
.cal-cell a {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  background: #e8f0ff; color: #0066cc; font-weight: 600;
  text-decoration: none; border-radius: 2px;
  transition: background 0.15s;
}
.cal-cell a:hover { background: #c8d8f8; }
.cal-num { color: #aaa; font-size: 14px; }
.cal-other .cal-num { color: #ddd; }
.cal-other.cal-has-day a { opacity: 0.5; }

/* ---- timetable grid ---------------------------------------------------- */
.timetable-grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.timetable-grid th, .timetable-grid td { padding: 8px 12px; border-bottom: 1px solid #eee; }
.timetable-grid thead th { background: #f8f8fc; text-align: left; font-size: 13px; font-weight: 600; color: #555; }
.col-time { width: 110px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-end-time { font-size: 11px; color: #999; display: block; }
.empty-slot td { background: #fafafa; }

/* ---- event items ------------------------------------------------------- */
.event-item { padding: 4px 0; }
.event-item + .event-item { border-top: 1px dashed #eee; margin-top: 4px; padding-top: 6px; }
.event-head { display: flex; align-items: center; gap: 8px; }
.event-title { font-weight: 600; font-size: 17px; }
.event-cat { font-size: 11px; background: #e0e0f0; padding: 1px 6px; border-radius: 3px; color: #444; }
.event-time { font-size: 13px; color: #555; margin-top: 2px; }
.event-room { font-size: 14px; font-weight: 500; color: #555; white-space: pre-line; }
.event-desc { font-size: 14px; font-weight: 500; color: #555; margin-top: 4px; line-height: 1.5; white-space: pre-line; }

/* category color hints */
.cat-routine .event-cat { background: #ffe0b2; color: #e65100; }
.cat-meal .event-cat { background: #c8e6c9; color: #2e7d32; }
.cat-education_major .event-cat { background: #bbdefb; color: #1565c0; }
.cat-education_minor .event-cat { background: #b3e5fc; color: #0277bd; }
.cat-rki .event-cat { background: #f8bbd0; color: #c2185b; }
.cat-teamwork .event-cat { background: #d1c4e9; color: #512da8; }
.cat-excursion .event-cat { background: #ffe082; color: #f57f17; }
.cat-cultural .event-cat { background: #ffccbc; color: #bf360c; }
.cat-sports .event-cat { background: #b2dfdb; color: #00695c; }
.cat-masterclass .event-cat { background: #f0f4c3; color: #827717; }
.cat-ceremony .event-cat { background: #e1bee7; color: #6a1b9a; }
.cat-departure .event-cat { background: #cfd8dc; color: #37474f; }

/* ---- forms ------------------------------------------------------------- */
.event-form { max-width: 640px; }
.event-form fieldset { border: 1px solid #ddd; border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; }
.event-form legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
.event-form label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: #444; }
.event-form input, .event-form select, .event-form textarea {
  display: block; width: 100%; margin-top: 3px; padding: 6px 8px; font: inherit; font-size: 14px;
  border: 1px solid #ccc; border-radius: 4px;
}
.event-form input:focus, .event-form select:focus, .event-form textarea:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 1px #0066cc33; }

.day-slot-group { margin-bottom: 10px; }
.day-slot-date { font-size: 13px; color: #333; margin-bottom: 4px; }
.slot-check { display: flex !important; align-items: center; gap: 6px; font-weight: 400 !important; font-size: 14px !important; }
.slot-check input { width: auto; margin: 0; }

/* ---- buttons ----------------------------------------------------------- */
.btn { display: inline-block; padding: 6px 14px; border-radius: 4px; background: #e8e8f0; color: #333; text-decoration: none; font-size: 13px; font-weight: 500; border: none; cursor: pointer; }
.btn:hover { background: #d0d0e0; }
.btn-primary { background: #0066cc; color: #fff; }
.btn-primary:hover { background: #0052a3; }

/* ---- event edit form -------------------------------------------------- */
.event-edit-form { padding: 8px 12px; background: #fafaff; border: 1px solid #dde; border-radius: 6px; margin: 4px 0; }
.event-edit-form form { display: flex; flex-direction: column; gap: 6px; }
.edit-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.edit-title { flex: 1; min-width: 200px; }
.event-edit-form input, .event-edit-form select, .event-edit-form textarea {
  padding: 4px 6px; font: inherit; font-size: 13px;
  border: 1px solid #ccc; border-radius: 3px;
}
.event-edit-form textarea { flex: 1; min-width: 150px; }
.event-edit-form input:focus, .event-edit-form select:focus, .event-edit-form textarea:focus {
  outline: none; border-color: #0066cc; box-shadow: 0 0 0 1px #0066cc33;
}
.edit-slots { border: 1px solid #ddd; border-radius: 4px; padding: 8px 10px; }
.edit-slots legend { font-size: 12px; font-weight: 600; }
.edit-actions { display: flex; gap: 6px; margin-top: 4px; }

/* ---- utilities --------------------------------------------------------- */
.muted { color: #888; }
.small { font-size: 12px; }
.actions { margin-top: 20px; }

/* ---- day header (back arrow) ------------------------------------------ */
.day-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.day-header h1 { margin: 0; }
.back-to-calendar {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; font-size: 14px; color: #0066cc;
  background: #e8f0ff; padding: 4px 10px 4px 6px; border-radius: 20px;
  transition: background 0.15s;
}
.back-to-calendar:hover { background: #c8d8f8; }
.back-to-calendar:focus { outline: 2px solid #0066cc; outline-offset: 2px; }
.arrow-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; font-size: 18px;
  background: rgba(0,102,204,0.1); border-radius: 50%;
}

/* ---- day navigation (prev/next) --------------------------------------- */
.day-nav {
  display: flex; gap: 8px; align-items: center; margin-top: 16px;
}
.day-nav-spacer { flex: 1; }
.day-nav .btn { min-width: 80px; text-align: center; }
.flash-success { background: #d4edda; color: #155724; padding: 10px 14px; border-radius: 4px; margin-top: 12px; font-size: 14px; }
.flash-success a { color: #155724; font-weight: 600; }
.empty { color: #999; }

/* ---- slot edit table --------------------------------------------------- */
.slot-edit-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.slot-edit-table th, .slot-edit-table td { padding: 6px 10px; border-bottom: 1px solid #eee; }
.slot-edit-table thead th { background: #f8f8fc; font-size: 12px; font-weight: 600; color: #555; text-align: left; }
.slot-pos { width: 40px; text-align: center; color: #888; font-size: 13px; }
.slot-time { width: 100px; padding: 4px 6px; font: inherit; font-size: 13px; border: 1px solid #ccc; border-radius: 3px; }
.slot-time:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 1px #0066cc33; }
.slot-edit-row td { vertical-align: middle; }
.slot-edit-row .btn { margin-left: 4px; }
.btn-sm { padding: 2px 8px; font-size: 12px; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; }

/* ---- new slot rows ----------------------------------------------------- */
.edit-slots-add { border: 1px solid #ddd; border-radius: 6px; padding: 12px 16px; margin-top: 16px; }
.edit-slots-add legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
.slot-new-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.slot-new-row input { padding: 4px 6px; font: inherit; font-size: 13px; border: 1px solid #ccc; border-radius: 3px; }
.slot-new-row input:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 1px #0066cc33; }