@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@600;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --bg: #f3efe8;
  --bg-2: #ebe3d6;
  --card: rgba(255,255,255,0.9);
  --text: #2f2419;
  --muted: #7d6b59;
  --line: rgba(87, 63, 39, 0.12);
  --gold: #a67c42;
  --gold-dark: #7b5a2d;
  --navy: #14233a;
  --navy-2: #223b5e;
  --danger: #8b3a2f;
  --shadow: 0 18px 48px rgba(53, 35, 14, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
}

body {
  font-family: "Nunito", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255,240,215,.8), transparent 36%),
    linear-gradient(180deg, #f7f3ec 0%, var(--bg) 38%, var(--bg-2) 100%);
}

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

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px 22px 48px;
}

.hero {
  position: relative;
  min-height: 320px;
  border-radius: 34px;
  overflow: hidden;
  background: url('/banner.png') center/cover no-repeat;
  box-shadow: var(--shadow);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16,18,27,0.04) 0%, rgba(16,18,27,0.16) 100%);
}

.hero-actions {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.hero-cta-row {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.lang-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 10px 20px rgba(34,22,13,.10);
}

.lang-btn,
.primary-btn,
.secondary-btn,
.icon-btn,
.action-btn {
  border: 0;
  transition: .18s ease;
}

.lang-btn {
  width: 82px;
  min-width: 82px;
  height: 52px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--navy);
  font-weight: 800;
  font-size: 1rem;
}

.lang-btn.active {
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff;
  box-shadow: 0 8px 18px rgba(20,35,58,.24);
}

.primary-btn,
.secondary-btn,
.action-btn {
  height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
  font-size: 1rem;
}

.hero-create-btn {
  min-width: 340px;
  width: 340px;
  min-height: 66px;
  padding: 0 32px;
  justify-content: center;
  font-size: 1.05rem;
  letter-spacing: .02em;
  background: linear-gradient(180deg, #D3A45A 0%, #B88A44 52%, #8F6730 100%);
  color: #FFF8EE;
  border: 1px solid rgba(255, 248, 231, 0.55);
  box-shadow:
    0 18px 30px rgba(89, 58, 18, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.24);
}

.hero-create-btn:hover {
  background: linear-gradient(180deg, #DEB066 0%, #C3954E 52%, #9B7236 100%);
  transform: translateY(-2px) scale(1.01);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff;
  box-shadow: 0 12px 22px rgba(20,35,58,.22);
}

.primary-btn:hover,
.lang-btn:hover,
.action-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  background: #f4ecde;
  color: var(--text);
  border: 1px solid var(--line);
}

.action-btn {
  background: rgba(20,35,58,.08);
  color: var(--navy);
}

.action-btn.danger {
  background: #f3dfd8;
  color: var(--danger);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 18px;
  margin-top: 22px;
}

.stat-card,
.panel,
.run-card,
.modal-card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 22px;
  border-radius: var(--radius-xl);
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 1.18rem;
}

.stat-card strong {
  font-size: 2.7rem;
  line-height: 1;
  color: var(--navy);
  font-weight: 800;
}

.panel {
  margin-top: 22px;
  padding: 22px;
  border-radius: 32px;
}

.panel-header h2,
.modal-header h3,
.subpanel h4 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  letter-spacing: .02em;
}

.panel-header h2 {
  font-size: 2.2rem;
}

.panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1.2rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}

.field,
.search-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span,
.field label,
.field-label {
  color: var(--muted);
  font-size: 1.12rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  color: var(--text);
  outline: none;
  font-size: 1rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(166,124,66,.55);
  box-shadow: 0 0 0 4px rgba(166,124,66,.12);
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.chip-btn {
  position: relative;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(166,124,66,.22);
  background: linear-gradient(180deg, rgba(255,250,243,.95), rgba(244,233,214,.95));
  color: var(--gold-dark);
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 8px 18px rgba(104,72,32,.08);
}

.chip-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.65);
}

.chip-btn.active {
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(20,35,58,.20);
}

.chip-btn.active::before {
  border-color: rgba(255,255,255,.12);
}

.board-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 18px;
}

.loading,
.empty-state {
  padding: 38px 18px;
  border-radius: 24px;
  border: 1px dashed rgba(87,63,39,.2);
  background: rgba(255,255,255,.5);
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
}

.run-card {
  padding: 20px;
  border-radius: 26px;
}

.run-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.run-head h3 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 1.8rem;
  color: var(--navy);
}

.run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: .96rem;
  font-weight: 800;
  background: #f7efe0;
  color: var(--gold-dark);
  border: 1px solid rgba(166,124,66,.22);
}

.badge.primary {
  background: rgba(20,35,58,.08);
  color: var(--navy);
  border-color: rgba(20,35,58,.12);
}

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

.info-box {
  padding: 14px;
  border-radius: 18px;
  background: rgba(248,244,238,.92);
  border: 1px solid rgba(87,63,39,.08);
  font-size: 1rem;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.member-list > strong {
  color: var(--navy);
  font-size: 1.16rem;
}

.member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(87,63,39,.08);
}

.member-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 1rem;
}

.run-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20,18,16,.42);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 999;
}

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

.modal-card {
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(249,244,237,.96));
}

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

.modal-header h3 {
  font-size: 1.9rem;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #f3ede4;
  color: var(--text);
  font-size: 1rem;
}

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

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

.hidden {
  display: none !important;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
}

.check-item,
.checkbox-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
}

.check-item input,
.checkbox-item input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--navy);
}

.check-item span,
.checkbox-item span {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold-dark);
  line-height: 1.2;
}

.subpanel {
  padding: 16px;
  border-radius: 22px;
  background: rgba(250,246,240,.9);
  border: 1px solid rgba(87,63,39,.08);
}

.subpanel h4 {
  font-size: 1.4rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.secondary-btn-small {
  height: 42px;
  padding: 0 14px;
  font-size: 0.96rem;
}

.run-grid-3 {
  grid-template-columns: repeat(3, minmax(0,1fr));
}

.info-label {
  display: block;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 6px;
}

.notes-box {
  margin-top: 12px;
}

.member-section {
  margin-top: 18px;
}

.member-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.member-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(87,63,39,.08);
  border-radius: 20px;
  background: rgba(255,255,255,.72);
}

.member-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.member-table thead th {
  text-align: left;
  padding: 14px 16px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(244,236,222,.72);
  border-bottom: 1px solid rgba(87,63,39,.08);
}

.member-table thead th:last-child,
.member-table tbody td:last-child {
  text-align: center;
}

.member-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(87,63,39,.06);
  vertical-align: middle;
  font-size: 1rem;
}

.member-table tbody tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.mini-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(20,35,58,.12);
  background: rgba(20,35,58,.08);
  color: var(--navy);
  font-weight: 800;
  font-size: 0.96rem;
}

.mini-btn.danger {
  background: #f3dfd8;
  color: var(--danger);
  border-color: rgba(139,58,47,.14);
}

.danger-badge {
  background: #f3dfd8;
  color: var(--danger);
  border-color: rgba(139,58,47,.14);
}

@media (max-width: 1100px) {
  .stats-grid,
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 768px) {
  .app-shell {
    max-width: 100%;
    padding: 12px;
  }

  .hero {
    min-height: 180px;
    border-radius: 22px;
  }

  .hero-actions {
    top: 12px;
    right: 12px;
    left: auto;
    align-items: flex-end;
    gap: 8px;
  }

  .lang-toggle {
    transform: scale(0.92);
    transform-origin: top right;
  }

  .hero-cta-row {
    margin-top: 12px;
  }

  .hero-create-btn {
    width: 100%;
    max-width: 280px;
    min-width: 0;
    min-height: 52px;
    font-size: 1rem;
    padding: 0 18px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .panel {
    padding: 16px;
    border-radius: 22px;
  }

  .panel-header h2 {
    font-size: 1.8rem;
    line-height: 1.2;
  }

  .panel-header p {
    font-size: 1rem;
  }

  .filters-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .chips-row {
    gap: 10px;
  }

  .chip-btn {
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.95rem;
  }

  .board-list {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .run-card {
    padding: 14px;
    border-radius: 20px;
  }

  .run-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .run-head h3 {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  .run-meta {
    gap: 6px;
  }

  .badge {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.85rem;
  }

  .run-grid,
  .run-grid-3,
  .form-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .info-box {
    padding: 12px;
    font-size: 0.95rem;
  }

  .member-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .member-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .member-table {
    min-width: 720px;
  }

  .member-table thead th,
  .member-table tbody td {
    font-size: 0.92rem;
    padding: 10px 12px;
    white-space: nowrap;
  }

  .table-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .mini-btn {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.88rem;
  }

  .run-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .run-footer .primary-btn,
  .run-footer .secondary-btn,
  .run-footer .action-btn {
    flex: 1 1 auto;
    min-width: 88px;
    justify-content: center;
  }

  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    padding: 16px;
  }

  .modal-header h3 {
    font-size: 1.5rem;
  }

  .check-item,
  .checkbox-item {
    min-height: 46px;
    padding: 8px 10px;
  }

  .check-item span,
  .checkbox-item span {
    font-size: 0.92rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .primary-btn,
  .form-actions .secondary-btn,
  .form-actions .action-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hero {
    min-height: 150px;
  }

  .hero-actions {
    top: 10px;
    right: 10px;
  }

  .lang-btn {
    width: 72px;
    min-width: 72px;
    height: 46px;
  }

  .hero-create-btn {
    max-width: 240px;
    min-height: 48px;
    font-size: 0.95rem;
  }

  .stat-card {
    padding: 18px;
  }

  .stat-card span {
    font-size: 1rem;
  }

  .stat-card strong {
    font-size: 2.2rem;
  }

  .panel-header h2 {
    font-size: 1.6rem;
  }
}


/* ===== Additional mobile overflow fixes ===== */
.board-list,
.run-card,
.member-section,
.member-table-wrap,
.panel,
.filters-grid,
.stats-grid {
  min-width: 0;
  max-width: 100%;
}

.run-card {
  overflow: hidden;
}

.member-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.member-table {
  width: 100%;
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
  }

  .app-shell,
  .panel,
  .board-list,
  .run-card,
  .member-section,
  .member-table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .member-table {
    min-width: 640px;
  }

  .run-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .run-footer .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .run-footer .primary-btn,
  .run-footer .secondary-btn,
  .run-footer .action-btn {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .member-table {
    min-width: 560px;
  }

  .run-footer {
    grid-template-columns: 1fr;
  }
}
