:root {
  --bg: #eef5fb;
  --paper: rgba(255, 255, 255, 0.9);
  --ink: #10233a;
  --muted: #6d7c8f;
  --line: rgba(58, 104, 151, 0.12);
  --accent: #3f7cff;
  --accent-deep: #245f98;
  --soft-blue: #75aee6;
  --soft-blue-2: #a8cfee;
  --teal: #7ca8c9;
  --gold: #dce7f0;
  --lavender: #a9c4db;
  --shadow: 0 18px 48px rgba(48, 89, 132, 0.12);
  --shadow-soft: 0 10px 28px rgba(48, 89, 132, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 8%, rgba(114, 172, 238, 0.18), transparent 28%),
    radial-gradient(circle at 22% 18%, rgba(167, 213, 246, 0.2), transparent 30%),
    var(--bg);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

input[readonly] {
  background: rgba(239, 246, 252, 0.88);
  color: var(--muted);
  cursor: default;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr);
  gap: 16px;
  padding: 0 18px 24px 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 22px 14px 18px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(58, 104, 151, 0.1);
  backdrop-filter: blur(18px);
}

.side-brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.side-brand img {
  width: 44px;
  height: 36px;
  object-fit: contain;
}

.side-brand strong,
.side-brand span {
  display: block;
}

.side-brand strong {
  font-size: 16px;
}

.side-brand span {
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.side-nav a {
  padding: 10px 12px;
  border-radius: 14px;
  color: #50657d;
  text-decoration: none;
  font-size: 14px;
}

.side-nav a.active,
.side-nav a:hover {
  color: var(--accent);
  background: linear-gradient(135deg, rgba(63, 124, 255, 0.12), rgba(255, 255, 255, 0.84));
}

.side-note {
  display: grid;
  gap: 6px;
  min-height: 100px;
  padding: 14px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(229, 241, 252, 0.86)),
    url("assets/mountain-spot.png") right bottom / 120px auto no-repeat;
  box-shadow: var(--shadow-soft);
}

.side-note span {
  color: var(--muted);
  font-size: 12px;
}

.hero {
  position: relative;
  min-height: 224px;
  display: grid;
  grid-column: 2;
  align-items: center;
  margin-top: 0;
  margin-left: -18px;
  margin-right: -18px;
  padding: 38px 66px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(238, 247, 255, 0.96), rgba(222, 239, 255, 0.16)),
    url("assets/hero-aurora-mountain.png") right center / cover no-repeat;
  border: 0;
  border-radius: 0 0 34px 34px;
  box-shadow: var(--shadow-soft);
}

.ghost-btn,
.soft-btn,
.quick-replies button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.ghost-btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  box-shadow: none;
}

.floating-exit {
  position: fixed;
  z-index: 11;
  top: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(58, 104, 151, 0.16);
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-deep);
  box-shadow: 0 14px 30px rgba(48, 89, 132, 0.12);
  backdrop-filter: blur(14px);
  text-align: center;
  line-height: 1;
  white-space: nowrap;
}

.falling-emoji {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 8px 10px rgba(16, 35, 58, 0.14));
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: start;
  gap: 8px;
}

.hero-cheer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: clamp(46px, 5.2vw, 66px);
  font-weight: 750;
  letter-spacing: 0;
}

.hero-cheer:hover {
  transform: translateY(-2px);
}

.hero-greeting,
.hero-subtitle {
  margin: 0;
}

.hero-greeting {
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
}

.hero-subtitle {
  color: #344b66;
  font-size: 15px;
}

.eyebrow,
.panel-head p {
  margin: 0 0 8px;
  color: var(--accent-deep);
  font-size: 13px;
}

.dashboard {
  position: relative;
  z-index: 3;
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  margin: -26px 0 0;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-column: 1 / -1;
  gap: 14px;
}

.overview-strip article {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 116px;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  text-align: left;
}

.overview-strip span,
.weekly-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.overview-strip strong {
  display: block;
  margin-top: 0;
  font-size: 30px;
  line-height: 1;
}

.overview-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.overview-icon {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  place-items: center;
  border-radius: 50%;
  font-size: 25px;
}

.overview-icon-blue {
  background: rgba(63, 124, 255, 0.12);
}

.overview-icon-red {
  background: rgba(255, 105, 126, 0.12);
}

.overview-icon-purple {
  background: rgba(124, 108, 255, 0.12);
}

.overview-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}

.overview-foot i {
  display: block;
  width: 128px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(63, 124, 255, 0.12);
}

.overview-foot i::before {
  content: "";
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.overview-foot b {
  color: #49b894;
  font-weight: 650;
}

.week-hours-card {
  overflow: hidden;
}

.streak-card {
  overflow: hidden;
}

.countdown-card {
  overflow: hidden;
}

.week-hours-card:hover .overview-icon,
.streak-card:hover .overview-icon,
.countdown-card:hover .overview-icon {
  animation: thumbs-up-cheer 620ms ease both;
}

@keyframes thumbs-up-cheer {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }

  35% {
    transform: translateY(-5px) rotate(-14deg) scale(1.12);
  }

  70% {
    transform: translateY(-2px) rotate(8deg) scale(1.06);
  }

  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes streak-sparkle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.78;
  }

  50% {
    transform: scale(1.12) rotate(8deg);
    opacity: 1;
  }
}

@keyframes streak-cheer {
  0% {
    transform: translateY(0) scale(1) rotate(0deg);
  }

  40% {
    transform: translateY(-5px) scale(1.18) rotate(-10deg);
  }

  100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes countdown-worry {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  35% {
    transform: translateY(-2px) rotate(-6deg);
  }

  70% {
    transform: translateY(1px) rotate(6deg);
  }
}

@keyframes countdown-alert {
  0% {
    transform: scale(1) rotate(0deg);
  }

  40% {
    transform: scale(1.14) rotate(-10deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

.main-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  align-items: start;
  gap: 14px;
  margin-top: 0;
}

.main-column {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.left-column {
  grid-column: 1;
  order: 1;
}

.right-column {
  grid-column: 2;
  order: 2;
}

.main-column > .panel {
  grid-column: auto;
  grid-row: auto;
}

.share-status-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.cloud-banner,
.group-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 96px;
  margin-top: 0;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}

.cloud-banner p,
.group-banner p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.cloud-banner strong,
.group-banner strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cloud-banner span,
.group-banner span {
  color: var(--muted);
}

.cloud-banner > div,
.group-banner > div {
  display: grid;
  gap: 6px;
}

.cloud-actions,
.group-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.panel {
  position: relative;
  padding: 20px;
  background: var(--paper);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.spot-art {
  position: absolute;
  pointer-events: none;
  object-fit: contain;
}

.spot-mountain {
  top: 10px;
  right: 16px;
  width: 92px;
  opacity: 0.55;
}

.calendar-spot-scene {
  height: 70px;
  opacity: 0.68;
  overflow: hidden;
}

.calendar-spot-scene img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.scene-base {
  z-index: 1;
}

.scene-tree {
  z-index: 2;
  transform-origin: bottom center;
}

.scene-tree-left {
  clip-path: polygon(0 30%, 26% 30%, 32% 100%, 0 100%);
  animation: tree-sway-left 3.4s ease-in-out infinite;
}

.scene-tree-right {
  clip-path: polygon(78% 28%, 100% 28%, 100% 100%, 72% 100%);
  animation: tree-sway-right 3.1s ease-in-out infinite;
}

.scene-snow {
  position: absolute;
  z-index: 3;
  top: -8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  animation: snow-fall 2.8s linear infinite;
}

.scene-snow-one {
  left: 26%;
}

.scene-snow-two {
  left: 52%;
  animation-delay: -0.9s;
  animation-duration: 3.3s;
}

.scene-snow-three {
  left: 74%;
  animation-delay: -1.7s;
  animation-duration: 2.5s;
}

.checkin-panel .panel-head,
.calendar-panel .panel-head,
.companion-panel .panel-head {
  padding-right: 92px;
}

@keyframes tree-sway-left {
  0%,
  100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(-3deg);
  }
}

@keyframes tree-sway-right {
  0%,
  100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(3deg);
  }
}

@keyframes snow-fall {
  0% {
    opacity: 0;
    transform: translateY(-6px) translateX(0);
  }

  15% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(66px) translateX(8px);
  }
}

.checkin-panel {
  grid-column: 2;
  grid-row: span 1;
  overflow: hidden;
  padding: 22px;
  border-color: rgba(58, 104, 151, 0.1);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 54px rgba(48, 89, 132, 0.14);
}

.checkin-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: 44%;
  height: 150px;
  background:
    radial-gradient(circle at 66% 28%, rgba(114, 172, 238, 0.14), transparent 34%),
    linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(239, 247, 255, 0.8));
  opacity: 0.95;
  pointer-events: none;
}

.checkin-hero-art {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 18px;
  width: 138px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 16px 22px rgba(48, 89, 132, 0.12));
}

.checkin-panel .panel-head {
  position: relative;
  z-index: 2;
  min-height: 110px;
  align-items: flex-start;
  padding: 4px 148px 10px 2px;
  margin-bottom: 8px;
}

.checkin-panel .panel-head h2 {
  max-width: 360px;
  margin-top: 7px;
  color: #132a42;
  font-size: 26px;
  line-height: 1.18;
}

.checkin-panel .panel-head p {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.calendar-panel {
  grid-column: 1;
  grid-row: 1;
}

.progress-panel,
.history-panel {
  grid-column: 1;
}

.weekly-panel,
.companion-panel {
  grid-column: 2;
}

.progress-panel {
  padding: 18px;
}

.history-panel {
  padding: 18px;
}

.companion-panel {
  grid-column: 1 / -1;
  order: 3;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 20px;
}

.panel-tools {
  display: flex;
  gap: 8px;
}

.status-pill {
  min-width: 72px;
  padding: 8px 12px;
  color: var(--accent-deep);
  background: rgba(95, 146, 198, 0.14);
  border-radius: 999px;
  text-align: center;
  font-size: 13px;
}

.checkin-panel .status-pill {
  position: relative;
  z-index: 1;
  min-width: 78px;
  padding: 7px 12px;
  border: 1px solid rgba(63, 124, 255, 0.14);
  background: rgba(63, 124, 255, 0.1);
  color: var(--accent);
  font-weight: 800;
}

form {
  display: grid;
  gap: 12px;
}

.checkin-panel form {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.checkin-panel .field-row {
  grid-column: 1 / -1;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.checkin-panel .field-row label {
  position: relative;
  min-height: 92px;
  padding: 16px 18px 16px 76px;
  overflow: hidden;
  border: 1px solid rgba(58, 104, 151, 0.11);
  border-radius: 18px;
  background: linear-gradient(180deg, #f7fbff, #edf6fc);
  box-shadow: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.checkin-panel .field-row label::before {
  content: "\25f7";
  position: absolute;
  left: 18px;
  top: 50%;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--soft-blue), var(--soft-blue-2));
  box-shadow: 0 12px 22px rgba(95, 146, 198, 0.16);
  transform: translateY(-50%);
  font-size: 21px;
}

.checkin-panel .field-row label:nth-child(2)::before {
  content: "\231b";
}

.checkin-panel .field-row label::after {
  content: "\5c0f\65f6";
  position: absolute;
  left: 126px;
  bottom: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.checkin-panel .field-row .time-field::after {
  left: 218px;
}

.time-stepper {
  display: inline-grid;
  width: fit-content;
  grid-template-columns: 30px minmax(54px, auto) 30px;
  align-items: center;
  gap: 6px;
}

.time-step-btn {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(63, 124, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.time-step-btn:active {
  transform: translateY(1px);
}

.modal-time-stepper {
  width: 100%;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 8px;
}

.modal-time-stepper .time-step-btn {
  width: 34px;
  height: 34px;
}

.checkin-panel .field-row input {
  width: 70px;
  min-height: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.checkin-panel .field-row .time-stepper input {
  width: 58px;
  text-align: center;
}

.modal-time-stepper input {
  text-align: center;
}

.time-stepper input::-webkit-outer-spin-button,
.time-stepper input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.checkin-panel .field-row input:focus {
  box-shadow: none;
}

.checkin-panel .field-row input[readonly] {
  background: transparent;
  color: var(--ink);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: rgba(146, 123, 130, 0.58);
}

.image-upload-field {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.image-upload-field input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px dashed rgba(63, 127, 189, 0.34);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248, 251, 254, 0.96), rgba(241, 247, 252, 0.94));
  color: var(--muted);
}

.image-upload-field input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(63, 127, 189, 0.12);
  color: var(--accent-deep);
  cursor: pointer;
}

.image-upload-field input[type="file"]:hover {
  border-color: rgba(63, 127, 189, 0.56);
  background: linear-gradient(180deg, rgba(246, 250, 253, 1), rgba(235, 244, 250, 0.98));
}

.subject-image-preview,
.history-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.ai-status {
  color: var(--muted);
  font-size: 13px;
}

.subject-image-thumb,
.history-image-thumb {
  position: relative;
  width: 78px;
  height: 78px;
  overflow: hidden;
  border: 2px solid rgba(114, 80, 92, 0.14);
  border-radius: 16px;
  background: #fff;
}

.subject-image-thumb img,
.history-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-image-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(84, 59, 68, 0.72);
  font-size: 14px;
}

textarea {
  resize: vertical;
}

.chip-group,
.segmented,
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkin-panel .form-card {
  padding: 14px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 18px;
  background: #f7fbff;
  box-shadow: none;
}

.checkin-panel form > label {
  min-width: 0;
}

.checkin-panel form > label:first-of-type {
  grid-column: 1 / -1;
}

.checkin-panel .mood-picker {
  grid-column: 1 / -1;
}

.checkin-panel .chip-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.checkin-panel .segmented {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.subject-detail-section {
  display: grid;
  gap: 10px;
}

.checkin-panel .subject-detail-section {
  grid-column: 1 / -1;
  min-height: 0;
  max-height: 196px;
  overflow: hidden;
}

.section-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.subject-detail-list {
  display: grid;
  gap: 12px;
}

.checkin-panel .subject-detail-list {
  max-height: 140px;
  overflow: auto;
  padding-right: 4px;
}

.subject-detail-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f2f7fb;
}

.subject-summary-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbfe, #f1f6fb);
  box-shadow: var(--shadow-soft);
}

.checkin-panel .subject-summary-card {
  border-color: rgba(58, 104, 151, 0.1);
  background: rgba(255, 255, 255, 0.86);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 12px;
  box-shadow: none;
}

.checkin-panel .subject-summary-card strong,
.checkin-panel .subject-summary-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-summary-card button {
  justify-self: start;
}

.checkin-panel .subject-summary-card button {
  grid-row: 1 / span 2;
  grid-column: 2;
  justify-self: end;
  min-height: 32px;
  padding: 0 10px;
}

.subject-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
}

.custom-field-list {
  display: grid;
  gap: 10px;
}

.custom-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.add-field-btn {
  justify-self: start;
}

.chip-group button,
.segmented button,
.quick-replies button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
}

.chip-group button,
.segmented button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.checkin-panel .chip-group button,
.checkin-panel .segmented button {
  min-height: 40px;
  border-radius: 12px;
  background: #fff;
  color: #445b73;
  font-weight: 700;
}

.chip-group button.active,
.segmented button.active {
  color: #fff;
  border-color: rgba(95, 146, 198, 0.42);
  background: linear-gradient(135deg, var(--soft-blue), var(--soft-blue-2));
  box-shadow: 0 10px 20px rgba(95, 146, 198, 0.16);
}

.form-actions {
  display: flex;
  gap: 10px;
}

.checkin-panel .form-actions {
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
  border-radius: 0;
  background: transparent;
}

.checkin-panel .save-notice {
  grid-column: 1 / -1;
}

.primary-btn,
.soft-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
}

.primary-btn {
  color: #fff;
  border: 1px solid rgba(95, 146, 198, 0.5);
  background: linear-gradient(135deg, var(--soft-blue), #8fb6d8);
  box-shadow: 0 10px 22px rgba(95, 146, 198, 0.18);
}

.soft-btn {
  color: var(--teal);
}

.checkin-panel .primary-btn,
.checkin-panel .soft-btn {
  min-width: 136px;
  min-height: 42px;
  font-weight: 800;
}

.checkin-panel .soft-btn {
  border-color: rgba(63, 124, 255, 0.16);
  background: #f4f9ff;
  color: var(--accent-deep);
}

.leave-day-btn[hidden] {
  display: none;
}

.leave-day-btn.is-revealed {
  border-color: rgba(95, 146, 198, 0.28);
  background: linear-gradient(135deg, #f7fbff, #e7f2fd);
  animation: reveal-leave-day 0.28s ease-out both;
}

.save-notice {
  min-height: 20px;
  margin: -6px 0 0;
  color: var(--accent-deep);
  font-size: 13px;
}

@keyframes reveal-leave-day {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.subject-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.subject-progress-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 250, 254, 0.9)),
    radial-gradient(circle at 96% 4%, rgba(117, 174, 230, 0.16), transparent 32%);
  box-shadow: 0 12px 26px rgba(48, 89, 132, 0.06);
}

.subject-progress-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.subject-progress-top div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.subject-progress-top strong {
  color: var(--ink);
  font-size: 20px;
}

.subject-progress-top span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.subject-progress-top b {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--accent-deep);
  background: rgba(117, 174, 230, 0.15);
  font-size: 14px;
}

.progress-track {
  height: 8px;
  background: #e9f1f7;
  border-radius: 14px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--lavender));
}

.subject-progress-track {
  height: 9px;
}

.subject-stage-list {
  display: grid;
  gap: 8px;
}

.subject-stage-row {
  display: grid;
  gap: 6px;
}

.subject-stage-row div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.subject-stage-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.subject-stage-row strong {
  color: var(--ink);
  font-size: 12px;
}

.subject-stage-row i {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(223, 234, 244, 0.74);
}

.subject-stage-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--soft-blue), var(--soft-blue-2));
}

.subject-next-task {
  display: grid;
  gap: 5px;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid rgba(58, 104, 151, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.subject-next-task span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.subject-next-task strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.weekly-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.weekly-summary div {
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff, #f2f7fb);
}

.calendar-head {
  align-items: center;
}

.calendar-streak {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.calendar-actions {
  display: flex;
  gap: 6px;
}

.calendar-actions button {
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-radius: 14px 18px 16px 20px;
  background: #fffaf8;
  color: var(--ink);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px 5px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.calendar-day {
  position: relative;
  display: flex;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: transparent;
}

.calendar-day.outside {
  opacity: 0.28;
}

.calendar-day.has-checkin {
  color: var(--accent-deep);
  justify-content: flex-start;
}

.calendar-day.intensity-zero {
  background: rgba(235, 241, 247, 0.72);
}

.calendar-day.intensity-light {
  background: rgba(222, 242, 255, 0.82);
}

.calendar-day.intensity-medium {
  background: rgba(178, 218, 247, 0.74);
}

.calendar-day.intensity-deep {
  background: rgba(118, 177, 220, 0.78);
  color: #0c2a47;
}

.calendar-date {
  line-height: 1;
  font-size: 13px;
}

.calendar-emoji {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  font-size: 23px;
  line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(16, 35, 58, 0.14));
  animation: calendar-bob 2.4s ease-in-out infinite;
}

.calendar-day.has-checkin:nth-child(3n) .calendar-emoji {
  animation-delay: -0.8s;
}

.calendar-day.has-checkin:nth-child(4n) .calendar-emoji {
  animation-delay: -1.4s;
}

.calendar-hours {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.calendar-day.selected {
  background: rgba(122, 168, 201, 0.14);
}

.calendar-detail {
  min-height: 0;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbfe, #f2f7fb);
  line-height: 1.6;
}

.calendar-summary-card {
  display: grid;
  gap: 6px;
}

@keyframes calendar-bob {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  35% {
    transform: translateY(-4px) rotate(-4deg);
  }

  70% {
    transform: translateY(-1px) rotate(4deg);
  }
}

.calendar-summary-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.calendar-summary-meta {
  color: var(--muted);
}

.calendar-review-lines {
  display: none;
  gap: 8px;
  padding-top: 4px;
}

.calendar-summary-card.expanded .calendar-review-lines {
  display: grid;
}

.calendar-review-lines div {
  display: grid;
  gap: 2px;
}

.calendar-review-lines span {
  color: var(--muted);
  font-size: 12px;
}

.calendar-review-lines strong {
  font-size: 14px;
}

.calendar-detail-body {
  display: none;
  gap: 10px;
  padding-top: 6px;
}

.calendar-summary-card.expanded .calendar-detail-body {
  display: grid;
}

.calendar-detail-modal-card {
  width: min(760px, 100%);
  max-height: min(82vh, 720px);
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 255, 0.96));
}

.modal-title-row {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 24px 28px 18px;
  border-bottom: 1px solid rgba(58, 104, 151, 0.1);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.modal-title-row p {
  margin: 0 0 4px;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 800;
}

.modal-title-row h2 {
  margin: 0;
  font-size: 28px;
}

.calendar-modal-body {
  display: grid;
  gap: 16px;
  max-height: calc(min(82vh, 720px) - 98px);
  padding: 20px 30px 28px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: rgba(95, 146, 198, 0.38) rgba(234, 244, 252, 0.84);
  scrollbar-width: thin;
}

.calendar-modal-body::-webkit-scrollbar {
  width: 10px;
}

.calendar-modal-body::-webkit-scrollbar-track {
  margin: 14px 0 18px;
  border-radius: 999px;
  background: rgba(234, 244, 252, 0.84);
}

.calendar-modal-body::-webkit-scrollbar-thumb {
  border: 3px solid rgba(234, 244, 252, 0.84);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(117, 174, 230, 0.72), rgba(168, 207, 238, 0.78));
}

.calendar-modal-summary {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(245, 250, 254, 0.98), rgba(236, 246, 253, 0.92)),
    radial-gradient(circle at 92% 12%, rgba(117, 174, 230, 0.16), transparent 32%);
}

.calendar-modal-summary span,
.calendar-modal-summary strong {
  display: block;
}

.calendar-modal-summary span {
  color: var(--muted);
  font-size: 13px;
}

.modal-review-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-review-card {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.modal-review-card span,
.modal-subject-section span {
  color: var(--muted);
  font-size: 13px;
}

.modal-review-card strong {
  line-height: 1.55;
}

.modal-subject-section {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 2px;
}

.modal-detail-body {
  display: grid;
  gap: 12px;
}

.calendar-subject-row {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 251, 255, 0.88)),
    radial-gradient(circle at 92% 0%, rgba(117, 174, 230, 0.16), transparent 34%);
  border-radius: 20px;
  box-shadow: 0 14px 30px rgba(48, 89, 132, 0.07);
}

.calendar-subject-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.calendar-subject-head div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.calendar-subject-head strong {
  color: var(--ink);
  font-size: 18px;
}

.calendar-subject-head small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.calendar-subject-head span {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--accent-deep);
  background: rgba(117, 174, 230, 0.14);
  font-size: 13px;
  font-weight: 800;
}

.calendar-subject-row p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

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

.calendar-field-line {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(58, 104, 151, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.calendar-field-line span {
  color: var(--muted);
  font-size: 12px;
}

.calendar-field-line strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.calendar-pinned-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.calendar-pinned-image {
  position: relative;
  margin: 0;
  min-width: 0;
  padding: 9px 8px 8px;
  border: 1px solid rgba(58, 104, 151, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 16px rgba(48, 89, 132, 0.09);
  transform: rotate(-0.8deg);
}

.calendar-pinned-image:nth-child(even) {
  transform: rotate(0.9deg);
}

.calendar-pinned-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  object-fit: cover;
  cursor: zoom-in;
}

.calendar-pinned-image figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-dot {
  position: absolute;
  top: -8px;
  left: 50%;
  z-index: 1;
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: linear-gradient(180deg, #6eaee6, #357cc0);
  box-shadow: 0 5px 12px rgba(48, 89, 132, 0.22);
  transform: translateX(-50%);
}

@media (max-width: 560px) {
  .calendar-pinned-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.calendar-field-line {
  color: var(--muted);
  font-size: 13px;
}

.calendar-detail strong {
  display: block;
  margin-bottom: 4px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #f8fbfe, #f2f7fb);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.history-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.history-topline strong {
  font-size: 15px;
}

.history-topline span,
.history-meta {
  color: var(--muted);
  font-size: 13px;
}

.history-note {
  color: var(--ink);
  line-height: 1.6;
}

.history-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.history-subject-detail {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  background: #fffdf8;
}

.history-subject-detail strong {
  font-size: 14px;
}

.history-field-list {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.weekly-summary strong {
  display: block;
  margin-top: 4px;
}

.companion-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(340px, 1.12fr);
  gap: 16px;
  align-items: stretch;
  overflow: hidden;
  padding: 18px;
}

.companion-panel .spot-mountain {
  top: 16px;
  right: 20px;
  width: 98px;
  opacity: 0.5;
}

.companion-compose,
.companion-display {
  position: relative;
  z-index: 1;
  min-width: 0;
  border-radius: 18px;
}

.companion-compose {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 2px 0 0;
}

.companion-compose .panel-head {
  margin-bottom: 0;
  padding-right: 0;
}

.companion-display {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 292px;
  padding: 20px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  background:
    linear-gradient(135deg, rgba(246, 250, 255, 0.94), rgba(231, 242, 253, 0.76)),
    radial-gradient(circle at 92% 18%, rgba(63, 124, 255, 0.16), transparent 28%);
}

.companion-display p {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.companion-display h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 22px;
}

.message-card {
  position: relative;
  min-height: 220px;
  padding: 18px;
  overflow: hidden;
  color: var(--ink);
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 32px rgba(48, 89, 132, 0.08);
}

.message-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92), transparent 16%, transparent 84%, rgba(255, 255, 255, 0.9));
}

.danmaku-empty {
  position: relative;
  z-index: 2;
  color: var(--muted);
}

.danmaku-item {
  position: absolute;
  z-index: 2;
  left: 100%;
  max-width: 72%;
  padding: 8px 14px;
  border: 1px solid rgba(58, 104, 151, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 22px rgba(48, 89, 132, 0.08);
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
  animation: danmaku-scroll var(--duration) linear infinite;
  animation-delay: var(--delay);
  animation-fill-mode: backwards;
  transform: translateX(96px);
}

.danmaku-priority {
  z-index: 3;
  border-color: rgba(72, 135, 198, 0.22);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 26px rgba(48, 89, 132, 0.13);
  animation-name: danmaku-priority-scroll;
}

.danmaku-lane-0 {
  top: 18px;
}

.danmaku-lane-1 {
  top: 52px;
}

.danmaku-lane-2 {
  top: 86px;
}

.danmaku-lane-3 {
  top: 120px;
}

.danmaku-lane-4 {
  top: 154px;
}

@keyframes danmaku-scroll {
  from {
    transform: translateX(96px);
  }

  to {
    transform: translateX(calc(-100vw - 100% - 160px));
  }
}

@keyframes danmaku-priority-scroll {
  from {
    transform: translateX(calc(-100% - 18px));
  }

  to {
    transform: translateX(calc(-100vw - 100% - 160px));
  }
}

.message-admin {
  display: none;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.message-admin-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

body.companion-mode .message-admin {
  display: flex;
}

.message-admin span,
.message-admin-row span {
  color: var(--muted);
  font-size: 13px;
}

.message-admin strong {
  display: block;
}

.message-admin-list {
  display: none;
}

body.companion-mode .message-admin-list {
  display: none;
}

.message-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
}

.message-admin-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-card.message-arrive {
  animation: message-arrive 680ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes message-arrive {
  0% {
    opacity: 0;
    transform: translateX(-46px) scale(0.98);
  }

  70% {
    opacity: 1;
    transform: translateX(6px) scale(1);
  }

  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.companion-only {
  display: none;
}

body.companion-mode .companion-only {
  display: inline-flex;
}

body.companion-mode .role-chip {
  color: #fff;
  background: var(--accent);
}

.secret-entry {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 8;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  opacity: 0.22;
}

.secret-entry::before {
  content: "✿";
  color: var(--accent-deep);
  font-size: 20px;
}

body.companion-mode .secret-entry {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 35, 58, 0.22);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(360px, 100%);
  padding: 22px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(16, 35, 58, 0.1);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(16, 35, 58, 0.22);
  max-height: min(88vh, 760px);
  overflow-y: auto;
}

.compact-title-row {
  padding: 22px 24px 16px;
}

.message-manager-card {
  width: min(640px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
}

.message-manager-list {
  display: grid;
  gap: 12px;
  max-height: min(62vh, 520px);
  padding: 18px 24px 24px;
  overflow-y: auto;
  scrollbar-color: rgba(95, 146, 198, 0.38) rgba(234, 244, 252, 0.84);
  scrollbar-width: thin;
}

.message-manager-list::-webkit-scrollbar {
  width: 10px;
}

.message-manager-list::-webkit-scrollbar-track {
  margin: 12px 0;
  border-radius: 999px;
  background: rgba(234, 244, 252, 0.84);
}

.message-manager-list::-webkit-scrollbar-thumb {
  border: 3px solid rgba(234, 244, 252, 0.84);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(117, 174, 230, 0.72), rgba(168, 207, 238, 0.78));
}

.message-manager-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbfe, #f2f7fb);
}

.message-manager-row div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.message-manager-row span,
.message-manager-row small {
  color: var(--muted);
  font-size: 12px;
}

.message-manager-row strong {
  color: var(--ink);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.message-manager-empty {
  padding: 18px;
  color: var(--muted);
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbfe, #f2f7fb);
}

.confirm-card {
  width: min(430px, calc(100vw - 32px));
}

.confirm-card > p {
  margin: 0 0 6px;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 800;
}

.confirm-card h2 {
  margin: 0 0 14px;
  font-size: 24px;
}

.confirm-body {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.confirm-body p {
  margin: 0;
}

.confirm-preview {
  padding: 14px 16px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(180deg, #f8fbfe, #f2f7fb);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.danger-btn {
  background: linear-gradient(135deg, #ef7f8f, #d95c72);
  box-shadow: 0 14px 30px rgba(217, 92, 114, 0.2);
}

#calendarDetailModal {
  padding: 18px;
  overflow: hidden;
}

#calendarDetailModal .calendar-detail-modal-card {
  width: min(820px, calc(100vw - 36px));
  max-height: min(88vh, 780px);
  padding: 0;
  overflow: hidden;
}

#calendarDetailModal .calendar-modal-body {
  max-height: calc(min(88vh, 780px) - 104px);
}

.progress-modal-card {
  width: min(520px, 100%);
}

.checkin-edit-card {
  width: min(760px, calc(100vw - 36px));
  max-height: min(88vh, 780px);
  padding: 0;
  overflow: hidden;
}

.checkin-edit-body {
  display: grid;
  gap: 14px;
  max-height: calc(min(88vh, 780px) - 148px);
  padding: 18px 24px 22px;
  overflow-y: auto;
  scrollbar-color: rgba(95, 146, 198, 0.34) rgba(234, 244, 252, 0.72);
  scrollbar-width: thin;
}

.checkin-edit-section,
.checkin-edit-subject-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 251, 254, 0.96), rgba(241, 247, 252, 0.9));
}

.checkin-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkin-edit-toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  align-self: end;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 700;
}

.checkin-edit-toggle input {
  width: auto;
}

.checkin-edit-subject-picker,
.checkin-edit-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkin-edit-subject-picker .active {
  border-color: rgba(63, 124, 255, 0.35);
  background: rgba(63, 124, 255, 0.12);
  color: var(--accent);
}

.checkin-edit-subjects {
  display: grid;
  gap: 14px;
}

.checkin-edit-subject-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.checkin-edit-fields {
  display: grid;
  gap: 10px;
}

.checkin-edit-upload {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(63, 127, 189, 0.34);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.checkin-edit-upload input {
  display: none;
}

.image-preview-backdrop {
  z-index: 20;
  padding: 24px;
  background: rgba(16, 35, 58, 0.38);
}

.image-preview-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(980px, 100%);
  max-height: 90vh;
}

.image-preview-card img {
  max-width: 100%;
  max-height: 86vh;
  border: 10px solid rgba(255, 255, 255, 0.94);
  border-radius: 22px;
  object-fit: contain;
  box-shadow: 0 28px 80px rgba(16, 35, 58, 0.28);
}

.image-preview-close {
  position: absolute;
  z-index: 1;
  top: 14px;
  right: 14px;
}

#subjectModal {
  overflow: hidden;
}

#subjectModal .subject-record-card {
  width: min(680px, calc(100vw - 40px));
  max-height: min(86vh, 720px);
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 254, 0.96));
}

.subject-modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 26px 16px;
  border-bottom: 1px solid rgba(58, 104, 151, 0.1);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.subject-modal-head p {
  margin: 0 0 4px;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 800;
}

.subject-modal-head h2 {
  margin: 0;
  font-size: 28px;
}

.subject-close-btn {
  min-width: 70px;
}

.subject-modal-body {
  display: grid;
  gap: 14px;
  max-height: calc(min(86vh, 720px) - 150px);
  padding: 18px 26px 20px;
  overflow-y: auto;
  scrollbar-color: rgba(95, 146, 198, 0.34) rgba(234, 244, 252, 0.72);
  scrollbar-width: thin;
}

.subject-modal-body::-webkit-scrollbar {
  width: 10px;
}

.subject-modal-body::-webkit-scrollbar-track {
  margin: 12px 0;
  border-radius: 999px;
  background: rgba(234, 244, 252, 0.72);
}

.subject-modal-body::-webkit-scrollbar-thumb {
  border: 3px solid rgba(234, 244, 252, 0.72);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(117, 174, 230, 0.7), rgba(168, 207, 238, 0.78));
}

.subject-modal-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
}

#subjectModal .modal-detail-grid {
  margin: 0;
  grid-template-columns: 150px 1fr;
}

#subjectModal .custom-field-row {
  grid-template-columns: minmax(120px, 0.95fr) minmax(160px, 1.15fr) auto;
}

.subject-modal-actions {
  position: sticky;
  bottom: 0;
  padding: 14px 26px 20px;
  border-top: 1px solid rgba(58, 104, 151, 0.1);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.template-modal-card {
  width: min(720px, 100%);
}

.group-modal-card {
  width: min(620px, 100%);
}

.modal-card p {
  margin-top: 0;
}

.modal-card h2 {
  margin: 0 0 16px;
}

.modal-error {
  min-height: 20px;
  color: var(--accent-deep);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-actions {
  display: none;
  gap: 8px;
}

body.companion-mode .admin-actions {
  display: flex;
}

.mini-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
}

.progress-editor {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  max-height: min(62vh, 620px);
  overflow: auto;
}

.progress-editor-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(58, 104, 151, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
}

.progress-editor-head {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.progress-editor-head strong {
  font-size: 14px;
}

.progress-editor-items {
  display: grid;
  gap: 8px;
}

.progress-editor-item {
  display: grid;
  grid-template-columns: minmax(92px, 1.4fr) minmax(58px, 0.8fr) minmax(58px, 0.8fr) minmax(46px, 0.6fr) minmax(58px, 0.7fr);
  gap: 8px;
}

.progress-editor-item input {
  min-width: 0;
  padding: 10px 11px;
}

.template-editor {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  max-height: min(58vh, 560px);
  overflow: auto;
}

.template-subject-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f2f7fb;
}

.group-setup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 16px 0;
}

.group-setup-grid section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f2f7fb;
}

.group-setup-grid h3 {
  margin: 0;
  font-size: 16px;
}

.invite-card {
  display: grid;
  gap: 4px;
  margin: 8px 0 14px;
  padding: 14px;
  border: 1px solid rgba(63, 127, 189, 0.18);
  border-radius: 18px;
  background: rgba(63, 127, 189, 0.08);
}

.invite-card span {
  color: var(--muted);
  font-size: 13px;
}

.invite-card strong {
  font-size: 24px;
  letter-spacing: 0.08em;
}

.template-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 8px;
}

.modal-detail-grid {
  margin: 14px 0;
}

.companion-panel form {
  margin-top: 0;
}

.companion-panel .quick-replies {
  gap: 8px;
}

.companion-panel .quick-replies button {
  background: #fff;
}

.companion-tools.companion-only {
  display: none;
}

body.companion-mode .companion-tools.companion-only {
  display: grid;
  gap: 8px;
}

.companion-panel textarea {
  min-height: 92px;
}

.companion-panel .primary-btn {
  justify-self: stretch;
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
    padding: 0;
  }

  .sidebar {
    position: static;
    height: auto;
    display: block;
    padding: 14px 16px;
  }

  .side-brand {
    margin-bottom: 12px;
  }

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .side-nav a {
    flex: 0 0 auto;
  }

  .side-note {
    display: none;
  }

  .hero {
    min-height: 210px;
    margin: 0;
    padding-bottom: 34px;
    background:
      linear-gradient(180deg, rgba(238, 247, 255, 0.96), rgba(238, 247, 255, 0.82)),
      url("assets/mountain-banner.jpg") center bottom / 100% auto no-repeat;
    border-radius: 0;
  }

  .hero-copy {
    width: 100%;
    justify-items: center;
    text-align: center;
  }

  .hero-cheer {
    font-size: 46px;
  }

  .overview-strip,
  .dashboard,
  .main-grid,
  .companion-panel,
  .weekly-summary,
  .share-status-panel {
    grid-template-columns: 1fr;
  }

  .left-column,
  .right-column,
  .companion-panel {
    grid-column: auto;
  }

  .share-status-panel {
    gap: 12px;
  }

  .cloud-banner,
  .group-banner {
    min-height: 96px;
  }

  .dashboard {
    width: min(100% - 24px, 720px);
    margin: -20px auto 24px;
  }

  .overview-strip {
    gap: 12px;
  }

  .checkin-panel {
    order: 2;
  }

  .main-column {
    display: contents;
  }

  .calendar-panel {
    order: 1;
  }

  .progress-panel {
    order: 3;
  }

  .history-panel {
    order: 4;
  }

  .weekly-panel {
    order: 5;
  }

  .companion-panel {
    order: 6;
  }

  .checkin-panel form {
    grid-template-columns: 1fr;
  }

  .calendar-panel,
  .checkin-panel,
  .progress-panel,
  .history-panel,
  .weekly-panel,
  .companion-panel {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .hero {
    padding-inline: 18px;
    min-height: 196px;
  }

  .dashboard {
    width: calc(100% - 20px);
    margin-top: -16px;
  }

  .overview-strip article {
    min-height: 104px;
    justify-content: center;
    text-align: center;
  }

  .overview-main,
  .overview-foot {
    justify-content: center;
    justify-items: center;
  }

  .overview-foot {
    flex-wrap: wrap;
  }

  .panel {
    padding: 16px;
  }

  .field-row,
  .form-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .checkin-panel .panel-head {
    min-height: 104px;
    padding-right: 104px;
  }

  .checkin-panel::before {
    width: 64%;
    height: 122px;
  }

  .checkin-hero-art {
    top: 20px;
    right: 12px;
    width: 96px;
  }

  .checkin-panel .panel-head h2 {
    max-width: 220px;
    font-size: 23px;
  }

  .calendar-detail-modal-card {
    max-height: 88vh;
  }

  .modal-title-row {
    padding: 20px;
  }

  .calendar-modal-body {
    max-height: calc(88vh - 90px);
    padding: 16px 20px 22px;
  }

  .modal-review-lines {
    grid-template-columns: 1fr;
  }

  .subject-list {
    grid-template-columns: 1fr;
  }

  .calendar-field-list,
  .calendar-pinned-images {
    grid-template-columns: 1fr;
  }

  #subjectModal .subject-record-card {
    width: min(100%, calc(100vw - 24px));
    max-height: 88vh;
  }

  .subject-modal-head {
    padding: 18px 20px 14px;
  }

  .subject-modal-body {
    max-height: calc(88vh - 146px);
    padding: 14px 20px 18px;
  }

  #subjectModal .modal-detail-grid,
  #subjectModal .custom-field-row,
  .progress-editor-head,
  .progress-editor-item,
  .checkin-edit-grid,
  .checkin-edit-card .custom-field-row {
    grid-template-columns: 1fr;
  }

  .subject-modal-actions {
    padding: 12px 20px 18px;
  }

  .checkin-panel .chip-group,
  .checkin-panel .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .checkin-panel .subject-detail-section {
    max-height: none;
  }

  .checkin-panel .subject-detail-list {
    max-height: 260px;
  }

  .detail-grid,
  .custom-field-row,
  .group-setup-grid {
    grid-template-columns: 1fr;
  }

  .spot-mountain {
    width: 72px;
  }

  .floating-exit {
    top: 12px;
    right: 12px;
    min-width: 118px;
    min-height: 40px;
    padding: 0 14px;
    font-size: 14px;
  }

  .message-admin {
    align-items: stretch;
    flex-direction: column;
  }

  .message-admin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
