:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6f8;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(26, 94, 82, 0.12), rgba(244, 246, 248, 0) 260px),
    #f4f6f8;
}

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

.shell {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 32px) 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #236357;
  font-size: 14px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 7vw, 46px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.status-pill {
  min-width: 54px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #dcefe9;
  color: #165447;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

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

.summary > div {
  padding: 15px;
  border: 1px solid #dfe6ea;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.summary span {
  display: block;
  margin-bottom: 6px;
  color: #66727c;
  font-size: 13px;
}

.summary strong {
  display: block;
  font-size: 15px;
}

.form {
  display: grid;
  gap: 14px;
}

.band {
  padding: clamp(16px, 4vw, 22px);
  border: 1px solid #dfe6ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(29, 43, 54, 0.06);
}

.band h2 {
  margin-bottom: 16px;
}

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

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

label:last-child {
  margin-bottom: 0;
}

label > span {
  color: #3d4a54;
  font-size: 14px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c9d4da;
  border-radius: 6px;
  background: #fbfcfd;
  color: #17202a;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 110px;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #247366;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(36, 115, 102, 0.16);
}

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

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.chip span {
  display: block;
  padding: 9px 12px;
  border: 1px solid #cbd7dd;
  border-radius: 999px;
  background: #f8fafb;
  color: #32404a;
  font-size: 14px;
  font-weight: 650;
}

.chip input:checked + span {
  border-color: #247366;
  background: #e4f3ef;
  color: #114b40;
}

.upload {
  place-items: center;
  min-height: 118px;
  border: 1px dashed #8fa2ad;
  border-radius: 8px;
  background: #f7fafb;
  color: #33434d;
  text-align: center;
  cursor: pointer;
}

.upload input {
  display: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #247366;
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
}

.preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.preview figure {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid #d6e0e5;
  background: #edf2f4;
}

.preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(23, 32, 42, 0.82);
  color: #ffffff;
}

.submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: #247366;
  color: #ffffff;
  box-shadow: 0 16px 32px rgba(16, 82, 71, 0.26);
}

.submit:disabled {
  cursor: progress;
  background: #8ba8a2;
}

.submit span {
  font-size: 18px;
  font-weight: 800;
}

.submit strong {
  font-size: 13px;
  opacity: 0.9;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  width: min(520px, calc(100% - 28px));
  transform: translateX(-50%);
  padding: 14px 16px;
  border-radius: 8px;
  background: #17202a;
  color: #ffffff;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

.toast.success {
  background: #1f6a40;
}

.toast.error {
  background: #9d2f2f;
}

@media (max-width: 680px) {
  .summary,
  .grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .status-pill {
    margin-top: 3px;
  }

  .band {
    padding: 15px;
  }

}

.admin-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 34px) 44px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 18px;
}

.admin-header h1 {
  font-size: clamp(28px, 4vw, 44px);
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.nav-link,
.view-tabs button,
.pager button,
.status-form button {
  min-height: 40px;
  border: 1px solid #cbd7dd;
  border-radius: 6px;
  background: #ffffff;
  color: #25323b;
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
}

.nav-link.active,
.view-tabs button.active {
  border-color: #1f6a5f;
  background: #1f6a5f;
  color: #ffffff;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric {
  min-height: 92px;
  padding: 14px;
  border: 1px solid #dde5e9;
  border-radius: 8px;
  background: #ffffff;
}

.metric span,
.metric em {
  display: block;
  color: #6b7882;
  font-size: 13px;
  font-style: normal;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: #17202a;
  font-size: 30px;
  line-height: 1;
}

.metric.warn {
  border-color: #efd6a4;
  background: #fff8ea;
}

.metric.hot {
  border-color: #f0b8b8;
  background: #fff0f0;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) minmax(230px, 1.5fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #dde5e9;
  border-radius: 8px;
  background: #ffffff;
}

.admin-toolbar.compact {
  grid-template-columns: repeat(3, minmax(170px, 240px));
}

.admin-toolbar label {
  margin: 0;
}

.admin-toolbar input,
.admin-toolbar select {
  min-height: 40px;
}

.view-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.view-tabs button {
  flex: 0 0 auto;
  padding: 0 14px;
}

.admin-section,
.rank-panel {
  display: none;
  border: 1px solid #dde5e9;
  border-radius: 8px;
  background: #ffffff;
}

.admin-section.active,
.rank-panel {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid #e5ecef;
}

.section-head h2,
.kanban-column h3,
.topic-item h3 {
  margin: 0;
  font-size: 17px;
}

.section-head span {
  color: #6b7882;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e7edf0;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #53616b;
  font-size: 13px;
  background: #f8fafb;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: #f6faf9;
}

.line-main {
  display: -webkit-box;
  max-width: 520px;
  overflow: hidden;
  color: #1e2932;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.line-sub,
.muted,
.empty {
  color: #6d7981;
  font-size: 13px;
}

.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.soft {
  background: #e9f2f0;
  color: #1e5f54;
}

.tag.warn {
  background: #fff1d5;
  color: #835400;
}

.tag.hot,
.status.todo {
  background: #ffe1e1;
  color: #8a2d2d;
}

.status.doing {
  background: #dfeeff;
  color: #285c92;
}

.status.review {
  background: #efe6ff;
  color: #604199;
}

.status.closed {
  background: #e7ecef;
  color: #52616a;
}

.overdue-text {
  color: #a33232;
  font-weight: 800;
}

.mobile-list {
  display: none;
  padding: 12px;
}

.mobile-list.dense {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.issue-card,
.topic-item {
  border: 1px solid #dce5e9;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.issue-card {
  padding: 12px;
}

.issue-card p {
  display: -webkit-box;
  min-height: 44px;
  margin: 10px 0;
  overflow: hidden;
  color: #22313a;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-top,
.card-bottom,
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-top,
.card-bottom {
  justify-content: space-between;
}

.card-meta {
  flex-wrap: wrap;
  color: #6d7981;
  font-size: 13px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
}

.pager button {
  padding: 0 14px;
}

.pager button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  padding: 12px;
  overflow-x: auto;
}

.kanban-column {
  min-width: 240px;
  border: 1px solid #e0e8eb;
  border-radius: 8px;
  background: #f8fafb;
}

.kanban-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid #e0e8eb;
}

.kanban-column header span {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #dce8e5;
  color: #1f5e54;
  font-weight: 800;
}

.kanban-stack {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.topic-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.topic-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 14px;
  cursor: default;
}

.topic-item p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.topic-item dl,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 10px;
  margin: 0;
}

.topic-item dt,
.detail-grid dt {
  color: #71808a;
  font-size: 12px;
}

.topic-item dd,
.detail-grid dd {
  margin: 3px 0 0;
  font-weight: 800;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  justify-content: flex-end;
  background: rgba(20, 29, 36, 0.42);
}

.detail-drawer.open {
  display: flex;
}

.drawer-panel {
  width: min(560px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 18px;
  background: #ffffff;
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.18);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e4ecef;
}

.drawer-head span {
  color: #63717a;
  font-weight: 800;
}

.drawer-head h2 {
  margin-top: 4px;
  font-size: 22px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid #cbd7dd;
  border-radius: 50%;
  background: #ffffff;
  color: #26333b;
  font-size: 24px;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px 0;
  border-bottom: 1px solid #e8eef1;
}

.drawer-block {
  padding: 14px 0;
  border-bottom: 1px solid #e8eef1;
}

.drawer-block h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.drawer-block p {
  margin: 0;
  color: #26323b;
  line-height: 1.6;
}

.status-form {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.status-form button {
  border-color: #1f6a5f;
  background: #1f6a5f;
  color: #ffffff;
}

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

.wide-rank {
  grid-column: 1 / -1;
}

.chart-grid {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.month-row,
.rank-row {
  display: grid;
  align-items: center;
  gap: 10px;
}

.month-row {
  grid-template-columns: 82px minmax(120px, 1fr) 50px 90px;
}

.stack-bar,
.rank-bar {
  position: relative;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f4;
}

.stack-bar span {
  display: inline-block;
  height: 100%;
}

.bar-new {
  background: #3a8f7f;
}

.bar-repeat {
  background: #e4a938;
}

.bar-continuous {
  background: #d45656;
}

.rank-row {
  grid-template-columns: 30px minmax(120px, 1fr) minmax(110px, 1.2fr) 48px 120px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f4;
}

.rank-row span,
.rank-row em,
.rank-row small,
.month-row small {
  color: #66727c;
  font-size: 13px;
  font-style: normal;
}

.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #3a8f7f;
}

@media (max-width: 1040px) {
  .metric-row {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .admin-toolbar,
  .admin-toolbar.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .kanban {
    grid-template-columns: repeat(4, minmax(260px, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-nav {
    justify-content: flex-start;
    width: 100%;
  }

  .metric-row,
  .admin-toolbar,
  .admin-toolbar.compact,
  .rank-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    display: none;
  }

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

  .topic-item,
  .topic-item dl,
  .month-row,
  .rank-row {
    grid-template-columns: 1fr;
  }

  .topic-item dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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