:root {
  --bg: #08111f;
  --panel: #111c2d;
  --panel-soft: #142235;
  --line: rgba(148, 163, 184, 0.18);
  --text: #e5edf7;
  --muted: #8ea0b8;
  --muted-strong: #b8c4d6;
  --brand: #18c2b0;
  --brand-dark: #0d8f83;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #64748b;
  --muted-strong: #334155;
  --brand: #0faca0;
  --brand-dark: #0f766e;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 16px 50px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(24, 194, 176, 0.12), transparent 26rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 10% 0%, rgba(24, 194, 176, 0.12), transparent 26rem),
    linear-gradient(180deg, #08111f 0%, #0b1320 100%);
}

[data-theme="light"] body {
  background:
    radial-gradient(circle at 8% 0%, rgba(15, 172, 160, 0.12), transparent 26rem),
    linear-gradient(180deg, #f5f7fb 0%, #eef2f7 100%);
}

button {
  font: inherit;
}

.shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: clamp(12px, 2vw, 20px);
}

.page-head,
.panel,
.stat-card {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 1.55rem);
  line-height: 1.2;
}

h2 {
  font-size: 1.05rem;
}

.summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.checkin-button,
.ghost-button {
  border: 0;
  border-radius: 12px;
  color: #06201d;
  font-weight: 900;
  background: linear-gradient(135deg, var(--brand), #2dd4bf);
  cursor: pointer;
  transition:
    transform 160ms ease,
    opacity 160ms ease,
    filter 160ms ease;
}

.checkin-button {
  min-width: 140px;
  padding: 11px 18px;
  font-size: 0.94rem;
}

.checkin-button:hover:not(:disabled),
.ghost-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.checkin-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.stat-card {
  min-height: 78px;
  padding: 14px 16px;
  border-radius: 14px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 9px;
  overflow: hidden;
  font-size: clamp(1.05rem, 2.8vw, 1.55rem);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 10px;
  margin-top: 10px;
}

.panel {
  border-radius: 16px;
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.month-actions {
  display: flex;
  gap: 8px;
}

.ghost-button {
  padding: 9px 12px;
  color: var(--muted-strong);
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

.week-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.week-row {
  margin-bottom: 6px;
}

.week-row span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
}

.calendar-day {
  min-height: 68px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 58%, transparent);
}

.calendar-day.is-blank {
  visibility: hidden;
}

.calendar-day.is-today {
  border-color: rgba(24, 194, 176, 0.72);
}

.calendar-day.is-checked {
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(24, 194, 176, 0.22), rgba(34, 197, 94, 0.1)),
    color-mix(in srgb, var(--panel) 76%, transparent);
}

.day-number {
  display: flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--muted-strong);
  font-size: 0.84rem;
  font-weight: 900;
}

.is-today .day-number {
  color: #06201d;
  background: var(--brand);
}

.calendar-day strong {
  display: block;
  margin-top: 8px;
  color: var(--brand);
  font-size: 0.88rem;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message,
.hint,
.empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.message {
  font-weight: 900;
}

.message[data-tone="success"] {
  color: var(--brand);
}

.message[data-tone="error"] {
  color: var(--red);
}

.message[data-tone="warning"] {
  color: var(--amber);
}

.message[data-tone="neutral"] {
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 54%, transparent);
}

[data-ui-mode="embedded"] body {
  min-height: auto;
  background: transparent;
}

[data-ui-mode="embedded"] .shell {
  padding: clamp(8px, 1.4vw, 14px);
}

[data-ui-mode="embedded"] .page-head,
[data-ui-mode="embedded"] .panel,
[data-ui-mode="embedded"] .stat-card {
  box-shadow: none;
}

[data-ui-mode="embedded"] .page-head,
[data-ui-mode="embedded"] .panel {
  border-radius: 14px;
}

[data-ui-mode="embedded"] .stat-card {
  min-height: 70px;
}

.history-item strong,
.history-item b {
  color: var(--text);
}

.history-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 1100px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-head,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .checkin-button {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 54px;
    padding: 6px;
  }

  .calendar-day strong {
    margin-top: 6px;
    font-size: 0.74rem;
  }
}
