:root {
  --bg: #f3f6f4;
  --bg-accent: #e7efe9;
  --panel: #ffffff;
  --text: #1c2b24;
  --muted: #5d6f66;
  --border: #d5e0da;
  --primary: #1f6b4a;
  --primary-press: #18553b;
  --danger-bg: #fdecea;
  --danger-text: #8a1f1b;
  --ok-bg: #e8f6ee;
  --ok-text: #1b5e3b;
  --shadow: 0 8px 24px rgba(28, 43, 36, 0.06);
  --radius: 14px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, #dceee3 0%, transparent 42%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
  min-height: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background: rgba(243, 246, 244, 0.9);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.2rem 1.5rem;
}

.brand-hero {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  line-height: 1.25;
}

h2.section-title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.1rem;
}

.subtitle {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 1rem;
}

.ready {
  font-size: 1.1rem;
  margin: 1rem 0 0.5rem;
}

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.field input {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  min-height: 48px;
}

.field input:focus {
  outline: 2px solid rgba(31, 107, 74, 0.25);
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-press);
}

.btn-secondary {
  background: #edf4ef;
  color: var(--primary);
  border-color: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  min-height: 40px;
  padding: 0.45rem 0.8rem;
  font-size: 0.95rem;
}

.btn-small {
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  background: #edf4ef;
  color: var(--primary);
  border-color: var(--border);
}

.inline-form {
  display: inline;
  margin: 0;
}

.alert {
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  margin: 0 0 1rem;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.alert-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}

.summary-grid > div {
  background: #f7faf8;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
}

.summary-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #f7faf8;
  color: var(--muted);
  font-weight: 600;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.kv {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.55rem 0.75rem;
  margin: 1rem 0;
}

.kv dt {
  color: var(--muted);
  margin: 0;
}

.kv dd {
  margin: 0;
}

.recovery-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  border: 1px dashed color-mix(in srgb, var(--text) 28%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 80%, #fff);
  user-select: all;
}

.panel-inset {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ok, #1a7f4b) 8%, transparent);
}

.admin-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-right: 0.5rem;
}

.admin-nav a {
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.admin-nav a:hover {
  color: var(--primary);
}

.student-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-right: 0.5rem;
}

.student-nav a {
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.student-nav a:hover,
.student-nav a[aria-current="page"] {
  color: var(--primary);
}

.history-duration-summary {
  margin: 0.5rem 0 1rem;
  font-size: 1.05rem;
}

.history-duration {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.history-completed-at {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}

.history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0;
}

.history-chip {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-chip.is-active,
.history-chip:hover {
  color: var(--primary);
  border-color: var(--primary);
}

a.task-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

a.task-card-link:hover .task-card {
  border-color: var(--primary);
}

.task-source-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.task-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.timer-current-label {
  margin: 1rem 0 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.timer-current {
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.timer-cumulative {
  margin: 0.35rem 0 0;
}

.manage-links {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.manage-card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}

.manage-card strong {
  display: block;
  margin-bottom: 0.25rem;
}

.manage-card:hover {
  border-color: var(--primary);
}

.info-image-wrap {
  margin: 0.5rem 0 1.25rem;
}

.info-image-wrap img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 6px;
}

.info-subnav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.info-subnav-link {
  flex: 0 0 auto;
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.info-subnav-link.is-active,
.info-subnav-link[aria-current="page"],
.info-subnav-link:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.info-notice-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.info-notice-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border, #eee);
  border-radius: 8px;
  background: var(--panel-bg, #fff);
}

.info-notice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.info-tag {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  color: var(--muted);
}

.info-tag-pinned {
  color: var(--primary);
  border-color: var(--primary);
}

.info-notice-card .post-title {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.info-notice-card .post-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.45rem;
}

.info-notice-card .post-body {
  margin: 0;
  white-space: pre-wrap;
}

.info-post-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.info-post-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border, #eee);
}

.info-post-list .post-title {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.info-post-list .post-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.info-post-list .post-body {
  margin: 0;
  white-space: pre-wrap;
}

.date-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.date-picker-form {
  margin-bottom: 0.75rem;
}

.date-picker-form input[type="date"] {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 48px;
  width: 100%;
  max-width: 220px;
}

.status-line {
  margin: 0 0 1rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.badge-draft {
  background: #eef1ef;
  color: var(--muted);
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 1rem 0 1.25rem;
}

.task-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f7faf8;
  padding: 1rem 1rem 1.05rem;
}

.task-subject {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  color: var(--primary);
}

.task-content {
  font-size: 1.12rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-task-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-danger-lite {
  background: #fdecea;
  color: var(--danger-text);
  border-color: #f0c7c3;
}

.publish-bar {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.empty-state {
  padding: 1.25rem 0;
  font-size: 1.1rem;
}

.student-home .hello {
  margin: 0 0 0.35rem;
  color: var(--muted);
}

.student-toolbar {
  margin: 0.75rem 0 1rem;
}

.section-empty {
  margin: 0 0 1rem;
}

.task-meta-links {
  margin: 0.55rem 0 0;
  font-size: 0.95rem;
}

.task-meta-links .linkish,
button.linkish {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.master-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.master-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.55rem;
  background: #f7faf8;
}

.master-item.is-inactive {
  opacity: 0.65;
}

.inline-edit {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.inline-edit input {
  flex: 1;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.readonly-block {
  margin-bottom: 1rem;
  line-height: 1.55;
}


.today-progress {
  margin: 0.85rem 0 1rem;
}

.progress-label {
  margin: 0 0 0.45rem;
  font-weight: 600;
  font-size: 1.05rem;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e2ebe6;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.all-done-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--ok-bg);
  color: var(--ok-text);
  font-size: 1.12rem;
  font-weight: 700;
}

.task-card-student {
  scroll-margin-top: 5rem;
}

.task-status-label {
  margin: 0.65rem 0 0.35rem;
  font-weight: 600;
  font-size: 1rem;
}

.task-status-label.status-in-progress {
  color: var(--primary);
}

.task-status-label.status-paused {
  color: #8a6a1b;
}

.task-status-label.status-completed {
  color: var(--ok-text);
}

.task-timer {
  margin: 0.65rem 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.task-duration-done {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.task-day-label {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
}

.carry-title {
  margin-top: 0.5rem;
}

.task-exec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.task-exec-actions form {
  flex: 1 1 40%;
  min-width: 7.5rem;
}

.btn-exec {
  width: 100%;
  min-height: 52px;
  font-size: 1.12rem;
  font-weight: 600;
}

.btn-complete {
  background: #e8f1ff;
  color: #1a4a8a;
  border-color: #c5d7f5;
}

.btn-complete:hover {
  background: #d9e8ff;
}

.task-card-student.status-completed {
  background: #f0faf4;
  border-color: #cfe8d9;
}

.task-type {
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.task-remark {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.task-meta {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.target-fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
}

.target-fieldset legend {
  padding: 0 0.35rem;
  color: var(--muted);
}

.radio-row,
.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  font-size: 1.02rem;
}

.student-picker {
  margin-top: 0.75rem;
}

.student-checklist {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.35rem 0.7rem;
  background: #f7faf8;
}

.field textarea {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 72px;
  resize: vertical;
}

.master-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.master-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: #f7faf8;
}

.master-edit-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.master-edit-row input {
  flex: 1;
  font: inherit;
  font-size: 1.02rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 44px;
}

.type-row {
  margin: 0.75rem 0;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

.entry-panel {
  background: #f7faf8;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1rem 1.1rem;
  margin: 1rem 0 1.35rem;
}

.selected-count {
  margin: 0 0 0.55rem;
  font-weight: 600;
  color: var(--primary);
}

.task-actions-quiet .btn-ghost {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.task-actions-quiet .btn-danger-lite {
  color: var(--danger-text);
  background: transparent;
}

.admin-task-card .task-content {
  font-size: 1.18rem;
  font-weight: 600;
}

.admin-task-card .task-subject {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.admin-task-card .task-type {
  font-weight: 500;
  color: var(--text);
}

.master-card > .master-edit-row:first-child input {
  font-weight: 700;
}

@media (max-width: 719px) {
  .admin-nav {
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.9rem;
  }

  .task-actions {
    width: 100%;
  }
}



.field select {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  min-height: 48px;
}

@media (min-width: 720px) {
  .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .panel {
    padding: 1.6rem 1.5rem 1.75rem;
  }

  .admin-task-card {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .task-card-main {
    flex: 1;
    min-width: 0;
  }
}
