:root {
  color-scheme: light;
  --bg: #f6f8f2;
  --panel: #ffffff;
  --panel-soft: #eef5e8;
  --text: #243128;
  --muted: #6f7d72;
  --line: #d9e4d2;
  --accent: #5f8f68;
  --accent-dark: #42694a;
  --warn: #b54b4b;
  --note: #fff5bd;
  --shadow: 0 10px 26px rgba(62, 92, 70, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(238, 247, 231, 0.88), rgba(248, 250, 244, 0.94)),
    radial-gradient(circle at 20% 20%, rgba(143, 184, 134, 0.18), transparent 28%),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand-subtitle {
  margin: 10px 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-weight: 700;
  color: #314237;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
}

.field input.field-invalid,
.field select.field-invalid,
.field textarea.field-invalid {
  border-color: #d94d4d;
  box-shadow: 0 0 0 2px rgba(217, 77, 77, 0.14);
}

.field textarea {
  min-height: 108px;
  resize: vertical;
}

.primary-button,
.secondary-button,
.danger-button,
.warning-button,
.enable-button,
.export-button,
.import-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

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

.secondary-button,
.icon-button {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.danger-button {
  background: #d94d4d;
  color: #fff;
}

.warning-button {
  background: #b7791f;
  color: #fff;
}

.enable-button {
  background: #4b8a68;
  color: #fff;
}

.export-button {
  background: #4c6f96;
  color: #fff;
}

.import-button {
  background: #8a6b3d;
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.compact-button {
  min-height: 34px;
  padding: 0 12px;
}

.text-button {
  background: transparent;
  color: var(--accent-dark);
  font-weight: 700;
  padding: 8px 0;
}

.error {
  color: var(--warn);
  min-height: 22px;
}

.client-error {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 50;
  width: min(520px, calc(100% - 24px));
  transform: translateX(-50%);
  border: 1px solid #efb3b3;
  border-radius: 8px;
  background: #fff4f4;
  color: var(--warn);
  font-weight: 800;
  padding: 10px 14px;
  box-shadow: 0 14px 36px rgba(62, 24, 24, 0.16);
}

.admin-success {
  border: 1px solid #b8d9b7;
  border-radius: 8px;
  background: #edf8ec;
  color: #35683b;
  font-weight: 800;
  margin: 0 0 14px;
  padding: 12px 16px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.mobile-shell {
  max-width: 480px;
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  background: #fbfcf8;
  position: relative;
  padding-bottom: 78px;
  box-shadow: 0 0 0 1px rgba(72, 105, 76, 0.08);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(251, 252, 248, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 18px 18px 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.content {
  padding: 18px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  transform: translateX(-50%);
  height: 64px;
  background: #ffffff;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 10;
}

.nav-item {
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  align-content: center;
  font-size: 16px;
  position: relative;
  font-weight: 800;
}

.nav-item.active {
  color: var(--accent-dark);
  font-weight: 800;
}

.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #d94f4f;
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.nav-item .badge {
  position: absolute;
  top: 8px;
  right: 22px;
}

.clickable-card {
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.clickable-card:hover,
.clickable-card:focus {
  border-color: #aac7a4;
  box-shadow: 0 8px 18px rgba(62, 92, 70, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.detail-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
}

.discussion-card .row-title span:first-child,
.practice-card .row-title span:first-child {
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 900;
}

.detail-hint {
  margin-bottom: 0;
  color: var(--accent-dark);
  font-weight: 700;
}

.section-title {
  margin: 20px 0 12px;
  font-size: 22px;
  line-height: 1.3;
}

.wide-button {
  width: 100%;
  margin-top: 12px;
}

.card,
.row,
.notice-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card {
  padding: 16px;
  margin-bottom: 14px;
}

.row,
.notice-card {
  padding: 14px;
  margin-bottom: 12px;
}

.row-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-weight: 800;
}

.meta,
.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.body-text {
  line-height: 1.75;
  white-space: pre-wrap;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: #f4f8f1;
}

.admin-sidebar {
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 22px 16px;
}

.admin-brand {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 20px;
}

.admin-menu {
  display: grid;
  gap: 8px;
}

.admin-menu button {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: #44564a;
  text-align: left;
  font-weight: 700;
}

.admin-menu button.active {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.admin-main {
  min-width: 0;
}

.admin-header {
  min-height: 72px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.admin-content {
  padding: 24px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.table th,
.table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  vertical-align: top;
}

.table th {
  background: #eef5e8;
  color: #314237;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -2px 0 16px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

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

.full-span {
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 36, 28, 0.36);
}

.modal-panel {
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(22, 42, 28, 0.22);
}

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

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

.drop-zone {
  min-height: 150px;
  border: 2px dashed #b8cdb2;
  border-radius: 8px;
  background: #f7faf4;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--accent-dark);
  font-weight: 800;
  text-align: center;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: #edf6e8;
}

.drop-zone input {
  display: none;
}

.modal-error {
  border: 1px solid #efb3b3;
  border-radius: 8px;
  background: #fff4f4;
  color: var(--warn);
  margin-top: 14px;
  padding: 12px 14px;
}

.modal-error strong {
  display: block;
  margin-bottom: 6px;
}

.modal-error ul {
  margin: 0;
  padding-left: 20px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.pagination-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-controls select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 8px;
}

@media (max-width: 760px) {
  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px;
  }

  .admin-menu {
    grid-template-columns: repeat(3, 1fr);
  }

  .admin-menu button {
    text-align: center;
    font-size: 13px;
  }

  .admin-header {
    padding: 12px 16px;
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
  }

  .admin-content {
    padding: 16px;
  }

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