body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  margin: 0;
  background: #f5f7fb;
  color: #222;
}

a {
  color: #0b5bd3;
  text-decoration: none;
}

.page {
  max-width: 800px;
  margin: 11px auto;
  padding: 0 8px;
}

.topbar {
  background: #0b5bd3;
  color: #fff;
}

.topbar-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.topbar nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
  margin-left: auto;
  order: 2;
}

.topbar a {
  color: #fff;
  margin-left: 0;
  white-space: nowrap;
}

.topbar-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  order: 2;
}

.user-badge {
  margin-left: 0;
  padding: 4px 8px;
  border-radius: 12px;
  background: #f2c94c;
  color: #1f2a44;
  font-size: 0.9em;
  font-weight: 600;
}

.topbar-user-badge {
  order: 3;
  margin-left: 12px;
}

@media (max-width: 640px) {
  .topbar-inner {
    align-items: center;
    flex-wrap: wrap;
  }

  .topbar-toggle {
    display: inline-block;
    margin-left: auto;
  }

  .topbar nav {
    display: none;
    width: 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-left: 0;
    order: 4;
  }

  .topbar nav.open {
    display: flex;
  }

  .topbar nav a,
  .topbar nav .user-badge {
    margin-left: 0;
  }

  .topbar-user-badge {
    order: 3;
    margin-left: 0;
    max-width: calc(100vw - 160px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar nav a {
    display: block;
    padding: 4px 0;
  }
}

.card {
  background: #fff;
  padding: 8px 8px 16px;
  margin-bottom: 0.5em;
  border-radius: 12px;
  border: 1px solid #d9e0ec;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.assignment-card {
  position: relative;
  overflow: hidden;
}

.completed-assignment-card {
  border-color: #f0b429;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.95) 0 14px, transparent 15px),
    radial-gradient(circle at 88% 24%, rgba(255, 248, 196, 0.95) 0 12px, transparent 13px),
    radial-gradient(circle at 80% 82%, rgba(255, 255, 255, 0.95) 0 10px, transparent 11px),
    linear-gradient(135deg, #fff8c9 0%, #ffe082 45%, #ffd166 100%);
  box-shadow:
    0 0 0 2px rgba(240, 180, 41, 0.35),
    0 12px 28px rgba(240, 180, 41, 0.28);
  animation: completed-card-pulse 1.8s ease-in-out infinite;
}

.completed-assignment-card::after {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 25%,
    rgba(255, 255, 255, 0.55) 45%,
    rgba(255, 255, 255, 0) 65%
  );
  transform: translateX(-55%) rotate(8deg);
  animation: completed-card-shine 2.4s linear infinite;
  pointer-events: none;
}

.completed-assignment-card h2,
.completed-assignment-card .detail-label,
.completed-assignment-card .detail-value {
  color: #7a4b00;
}

@keyframes completed-card-pulse {
  0%, 100% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 0 0 2px rgba(240, 180, 41, 0.35),
      0 12px 28px rgba(240, 180, 41, 0.28);
  }
  50% {
    transform: translateY(-2px) scale(1.01);
    box-shadow:
      0 0 0 4px rgba(240, 180, 41, 0.22),
      0 18px 36px rgba(240, 180, 41, 0.34);
  }
}

@keyframes completed-card-shine {
  0% {
    transform: translateX(-65%) rotate(8deg);
  }
  100% {
    transform: translateX(65%) rotate(8deg);
  }
}

.card h1,
.card h2,
.card h3 {
  margin-top: 0.5em;
}

.assignment-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.assignment-complete-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 12px rgba(214, 69, 69, 0.28);
}

.previous-task-panel {
  margin-top: 0.5em;
  padding: 8px 10px;
  border: 1px solid #cbd6e7;
  border-radius: 10px;
  background: #f4f7fb;
}

.previous-task-title {
  font-size: 0.9em;
  font-weight: 700;
  color: #40516d;
  margin-bottom: 6px;
}

.compact-detail-table .detail-row {
  padding-top: 4px;
  padding-bottom: 4px;
}

.progress-legend {
  margin-bottom: 0.5em;
}

label {
  display: block;
  margin-bottom: 12px;
}

.form-gap-before {
  margin-top: 1em;
}

.form-gap-large-before {
  margin-top: 3em;
}

.option-item {
  margin-left: 1em;
}

.label-title {
  margin-bottom: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
  margin: 0;
}

input {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

select {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
}

textarea {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
}

button {
  padding: 8px 16px;
  background: #0b5bd3;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button.danger {
  background: #c0392b;
  margin-left: 8px;
}

.row {
  margin-bottom: 16px;
}

.tree {
  list-style: none;
  padding-left: 0;
}

.tree > li {
  border-left: 3px solid #0b5bd3;
  padding-left: 12px;
  margin-bottom: 16px;
}

.tree ul {
  list-style: none;
  padding-left: 16px;
}

.row a {
  margin-right: 12px;
}

.muted {
  color: #666;
  font-size: 0.9em;
}

.aux-top {
  display: block;
}

.aux-bottom {
  display: block;
}

.aux-top + .detail-table,
.aux-top + .calendar-grid,
.calendar-nav + .calendar-grid {
  margin-top: 0.5em;
}

.detail-table + .aux-bottom,
.calendar-grid + .aux-bottom {
  margin-top: 0.5em;
}

.highlight {
  background: #fff7d6;
  border-radius: 6px;
  padding: 4px 6px;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.9em;
  font-weight: 600;
}

.status-active {
  background: #e8f3ff;
  color: #0b5bd3;
}

.status-completed {
  background: #e6f6eb;
  color: #18794e;
}

.status-inactive {
  background: #f0f1f4;
  color: #5b6475;
}

.current-assignment-row {
  padding: 8px 10px;
  border: 3px solid #0b5bd3;
  border-radius: 12px;
  background: #dbeafe;
  box-shadow: 0 0 0 2px rgba(11, 91, 211, 0.2);
  position: relative;
}

.current-assignment-row::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 8px;
  bottom: 8px;
  width: 8px;
  border-radius: 999px;
  background: #0b5bd3;
}

.stacked-row.current-assignment-panel {
  border-color: #0b5bd3;
  background: #e7f0ff;
  box-shadow: 0 0 0 2px rgba(11, 91, 211, 0.15);
}

.goal-group {
  padding: 12px;
  border: 1px solid #c4d0e0;
  border-radius: 14px;
  background: #eef3f8;
}

.current-goal-group {
  border-color: #7ed7ca;
  background: #d8faf3;
}

ul {
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid #c4d0e0;
  border-radius: 10px;
  background: #edf4fb;
}

.list-main {
  display: grid;
  align-items: center;
  gap: 6px 12px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}

.list-primary {
  font-weight: 600;
  color: #1f2a44;
}

.stacked-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #c4d0e0;
  border-radius: 10px;
  background: #eef3f8;
}

.item-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-self: flex-start;
  min-height: 36px;
  margin-top: 4px;
}

.action-link {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid #c9d7f2;
  border-radius: 999px;
  background: #eef4ff;
  font-weight: 600;
}

.error {
  color: #c00;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-head {
  margin-bottom: 8px;
  color: #666;
  font-size: 0.9em;
}

.calendar-cell {
  min-height: 88px;
  border: 1px solid #d7dbe5;
  border-radius: 8px;
  padding: 8px;
  background: #fafbfe;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.calendar-cell.is-empty {
  background: transparent;
  border-style: dashed;
}

.calendar-date {
  font-weight: 600;
  margin-bottom: 8px;
}

.calendar-link {
  display: inline-block;
  line-height: 1.4;
}

.card > p {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #d6dfeb;
  background: #eaf1f8;
}

.card > p:last-of-type {
  border-bottom: none;
}

.related-history {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #c4d0e0;
  border-radius: 10px;
  background: #eaf1f7;
  box-sizing: border-box;
}

.related-history > ul > li {
  margin-top: 10px;
  padding: 0;
  border-left: none;
  background: transparent;
}

.related-history p {
  margin: 0 0 6px;
}

.action-placeholder {
  display: inline-block;
  min-width: 1px;
  min-height: 36px;
}

.detail-table {
  width: 100%;
  border: 1px solid #c7d3e3;
  border-radius: 8px;
  overflow: hidden;
  background: #f7faff;
}

.detail-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: start;
  gap: 8px;
  padding: 7px 10px;
  border-top: 1px solid #d7e1ee;
}

.detail-row:first-child {
  border-top: none;
}

.detail-label {
  font-weight: 700;
  color: #345;
}

.detail-value {
  min-width: 0;
  line-height: 1.5;
}

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.4em;
}

.task-checkmark {
  display: inline-block;
  width: 1.2em;
  color: #18794e;
  font-weight: 700;
}

.toast-message {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 1em;
  border-radius: 18px;
  background: #ffdf5d;
  color: #3a2a00;
  border: 4px solid #e0b400;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1.2;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  z-index: 1000;
}
