:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dee3eb;
  --line-strong: #cbd3df;
  --text: #172033;
  --muted: #6b7485;
  --blue: #2f6fed;
  --blue-soft: #edf3ff;
  --green: #2f8f62;
  --green-soft: #eaf7f0;
  --amber: #b7791f;
  --amber-soft: #fff4de;
  --red: #d33f49;
  --red-soft: #fff0f1;
  --purple: #7755c7;
  --shadow: 0 16px 40px rgba(28, 39, 64, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: block;
  border-radius: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.25;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.session {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.current-user {
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  padding: 18px 24px 28px;
}

.section-title-bar {
  min-height: 58px;
  margin: 2px 0 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #172033;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
}

.section-title-bar div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title-bar span {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #bfdbfe;
  font-size: 13px;
  font-weight: 800;
}

.section-title-bar h2 {
  font-size: 20px;
  line-height: 1.2;
}

.section-title-bar strong {
  flex-shrink: 0;
  color: #dbe7ff;
  font-size: 13px;
  font-weight: 700;
}

.section-title-bar.reward-title {
  background: #153326;
}

.section-title-bar.reward-title span {
  color: #bbf7d0;
}

.section-title-bar.reward-title strong {
  color: #d7f8e1;
}

.section-title-bar.task-title {
  background: #302449;
}

.section-title-bar.task-title span {
  color: #e9d5ff;
}

.section-title-bar.task-title strong {
  color: #eee4ff;
}

.holiday-home {
  display: grid;
  grid-template-columns: minmax(240px, 1.1fr) minmax(320px, 1.7fr);
  gap: 12px;
  margin-bottom: 18px;
}

.next-holiday-card,
.holiday-region-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.next-holiday-card:hover,
.holiday-region-card:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 24px rgba(47, 111, 237, 0.1);
}

.next-holiday-card {
  min-height: 110px;
  padding: 16px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.holiday-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.next-holiday-card strong {
  font-size: 24px;
}

.next-holiday-card span:last-child {
  color: var(--muted);
  font-size: 13px;
}

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

.holiday-region-card {
  min-height: 110px;
  padding: 16px;
  display: grid;
  align-content: center;
  gap: 10px;
}

.holiday-region-card span {
  color: var(--muted);
  font-size: 13px;
}

.holiday-region-card strong {
  font-size: 20px;
}

.holiday-region-card.cn strong {
  color: var(--blue);
}

.holiday-region-card.us strong {
  color: var(--green);
}

.next-holiday-card.deadline-expired,
.holiday-region-card.deadline-expired,
.holiday-item.deadline-expired {
  background: #f1f3f5;
  border-color: #d7dde5;
  color: #7b8492;
}

.next-holiday-card.deadline-urgent,
.holiday-region-card.deadline-urgent,
.holiday-item.deadline-urgent {
  background: var(--red-soft);
  border-color: #f1a0a7;
}

.next-holiday-card.deadline-safe,
.holiday-region-card.deadline-safe,
.holiday-item.deadline-safe {
  background: var(--green-soft);
  border-color: #9bd6b7;
}

.next-holiday-card.deadline-expired strong,
.holiday-region-card.deadline-expired strong {
  color: #6f7885;
}

.next-holiday-card.deadline-urgent strong,
.holiday-region-card.deadline-urgent strong {
  color: var(--red);
}

.next-holiday-card.deadline-safe strong,
.holiday-region-card.deadline-safe strong {
  color: var(--green);
}

.holiday-panel {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.holiday-panel-header {
  min-height: 66px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.holiday-panel-header h2 {
  margin-top: 3px;
  font-size: 18px;
}

.holiday-list {
  display: grid;
  gap: 0;
}

.holiday-item {
  min-height: 70px;
  border: 0;
  border-left: 4px solid transparent;
  border-bottom: 1px solid var(--line);
  background: white;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) 110px 130px 130px minmax(140px, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.holiday-item:hover {
  background: #fbfdff;
}

.holiday-item.deadline-expired:hover {
  background: #eceff3;
}

.holiday-item.deadline-urgent:hover {
  background: #ffe8ea;
}

.holiday-item.deadline-safe:hover {
  background: #ddf3e7;
}

.holiday-title {
  display: grid;
  gap: 4px;
}

.holiday-title strong {
  font-size: 15px;
}

.holiday-title span,
.holiday-cell span {
  color: var(--muted);
  font-size: 12px;
}

.holiday-cell {
  display: grid;
  gap: 4px;
}

.holiday-cell strong {
  font-size: 13px;
}

.holiday-item.deadline-expired .holiday-title strong,
.holiday-item.deadline-expired .holiday-cell strong {
  color: #6f7885;
}

.holiday-item.deadline-urgent .holiday-title strong,
.holiday-item.deadline-urgent .holiday-cell strong {
  color: var(--red);
}

.holiday-item.deadline-safe .holiday-title strong,
.holiday-item.deadline-safe .holiday-cell strong {
  color: var(--green);
}

.design-reward-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(420px, 2fr);
  gap: 12px;
  margin-bottom: 18px;
}

.reward-summary,
.ranking-board {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.reward-summary {
  min-height: 150px;
  padding: 16px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.reward-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reward-summary strong {
  color: var(--blue);
  font-size: 26px;
}

.reward-summary > span:not(.reward-eyebrow) {
  color: var(--green);
  font-size: 18px;
  font-weight: 700;
}

.reward-summary small {
  color: var(--muted);
  line-height: 1.5;
}

.ranking-board {
  padding: 14px;
}

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

.ranking-head h2 {
  margin-top: 3px;
  font-size: 18px;
}

.ranking-head select {
  width: 150px;
}

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

.ranking-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
  padding: 10px;
  min-width: 0;
}

.ranking-grid h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.ranking-list {
  display: grid;
  gap: 6px;
}

.ranking-row {
  min-height: 34px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border-radius: 6px;
  background: white;
  padding: 6px 8px;
  font-size: 12px;
}

.ranking-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-row em {
  color: var(--green);
  font-style: normal;
  font-weight: 700;
}

.ranking-index {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.ranking-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  min-height: 72px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.metric:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 24px rgba(47, 111, 237, 0.1);
}

.metric.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 28px;
}

.metric.danger strong {
  color: var(--red);
}

.metric.warn strong {
  color: var(--amber);
}

.metric.active strong {
  color: var(--blue);
}

.metric.doing strong {
  color: var(--purple);
}

.metric.done strong {
  color: var(--green);
}

.toolbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 10px;
}

.search-wrap {
  flex: 1;
  min-width: 220px;
  height: 36px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 6px;
  color: var(--muted);
  font-size: 18px;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
}

input,
select {
  height: 36px;
  padding: 0 10px;
}

textarea {
  padding: 9px 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.search-wrap input {
  padding-left: 36px;
}

.button {
  height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  color: white;
  background: var(--blue);
}

.button.secondary {
  background: white;
  border-color: var(--line-strong);
  color: var(--text);
}

.button.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #fac7cc;
}

.sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-wrap {
  min-height: 420px;
  overflow: auto;
  position: relative;
}

table {
  width: 100%;
  min-width: 1520px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.w-image {
  width: 92px;
}

.w-name {
  width: 190px;
}

.w-category {
  width: 90px;
}

.w-person {
  width: 110px;
}

.w-reference {
  width: 320px;
}

.w-date {
  width: 110px;
}

.w-countdown,
.w-priority,
.w-status {
  width: 96px;
}

.w-note {
  width: 300px;
}

.w-actions {
  width: 160px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 40px;
  background: #f9fafc;
  color: #4b5567;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0 10px;
}

tbody td {
  height: 66px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: middle;
  background: white;
}

tbody tr:hover td {
  background: #fbfdff;
}

.col-image {
  width: 92px;
}

.col-actions {
  width: 160px;
}

.thumb {
  width: 58px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #eef1f5;
  display: block;
}

.thumb-placeholder {
  width: 58px;
  height: 46px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.cell-title {
  font-weight: 700;
  max-width: 170px;
}

.cell-note,
.cell-ref {
  max-width: 280px;
  color: #3f4858;
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag,
.countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.countdown.late,
.tag.priority-high {
  color: var(--red);
  background: var(--red-soft);
}

.countdown.today,
.tag.priority-medium {
  color: var(--amber);
  background: var(--amber-soft);
}

.countdown.soon {
  color: var(--blue);
  background: var(--blue-soft);
}

.countdown.normal,
.tag.priority-low {
  color: var(--green);
  background: var(--green-soft);
}

.countdown.done {
  color: #4f5b6d;
  background: #eef1f5;
}

.status {
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
  font-size: 12px;
}

.status.todo {
  color: #5e6a7b;
  background: #eef1f5;
}

.status.doing {
  color: var(--blue);
  background: var(--blue-soft);
}

.status.output {
  color: var(--purple);
  background: #f3efff;
}

.status.sample {
  color: var(--green);
  background: var(--green-soft);
}

.status.paused {
  color: var(--amber);
  background: var(--amber-soft);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  padding: 6px 4px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.complete-button {
  height: 28px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  color: white;
  background: var(--blue);
  cursor: pointer;
  padding: 0 10px;
  white-space: nowrap;
}

.empty-state {
  min-height: 360px;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.modal {
  width: min(420px, calc(100vw - 30px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.28);
}

.task-modal {
  width: min(880px, calc(100vw - 30px));
}

.holiday-modal {
  width: min(720px, calc(100vw - 30px));
}

.device-modal {
  width: min(760px, calc(100vw - 30px));
}

.approval-modal,
.log-modal {
  width: min(860px, calc(100vw - 30px));
}

.my-info-modal {
  width: min(860px, calc(100vw - 30px));
}

.modal::backdrop {
  background: rgba(18, 25, 38, 0.35);
}

.modal form {
  padding: 22px;
}

.modal h2 {
  font-size: 18px;
  margin-bottom: 18px;
}

.modal-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-title h2 {
  margin-bottom: 0;
}

.modal-title span {
  color: var(--muted);
  font-size: 13px;
}

#formHint {
  color: var(--muted);
  font-size: 13px;
}

#deviceHint {
  color: var(--muted);
  font-size: 13px;
}

.login-message {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-message.warn {
  color: var(--amber);
}

.login-message.danger {
  color: var(--red);
}

.login-reward {
  margin-top: 10px;
  border: 1px solid var(--green-soft);
  border-radius: 8px;
  background: var(--green-soft);
  padding: 12px;
  display: grid;
  gap: 5px;
}

.login-reward span,
.login-reward small {
  color: var(--muted);
  font-size: 12px;
}

.login-reward strong {
  color: var(--green);
  font-size: 22px;
}

.approval-list,
.log-list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.approval-item,
.log-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.approval-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.approval-title,
.log-title {
  font-weight: 700;
}

.approval-meta,
.log-meta,
.log-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.my-info-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.my-info-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
  padding: 12px;
  display: grid;
  gap: 5px;
}

.my-info-summary span,
.my-info-item span,
.my-info-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.my-info-summary strong {
  color: var(--blue);
  font-size: 22px;
}

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

.my-info-grid section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.my-info-grid h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.my-info-list {
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.my-info-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.my-info-item div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.my-info-item strong,
.my-info-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.approval-department {
  width: 130px;
  min-width: 130px;
  gap: 5px;
  font-size: 12px;
}

.empty-panel {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.empty-panel.compact {
  padding: 18px;
}

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

.device-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fafc;
  display: grid;
  gap: 4px;
}

.device-summary span,
.device-meta,
.device-note {
  color: var(--muted);
  font-size: 12px;
}

.device-list {
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.device-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
}

.device-name {
  font-weight: 700;
}

.device-badge {
  align-self: start;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.device-meta {
  grid-column: 1 / -1;
  line-height: 1.7;
}

.device-note {
  margin-top: 12px;
  line-height: 1.6;
}

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

.holiday-detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fafc;
  display: grid;
  gap: 5px;
}

.holiday-detail-grid span {
  color: var(--muted);
  font-size: 12px;
}

.holiday-detail-grid strong {
  font-size: 14px;
}

.holiday-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

label {
  display: grid;
  gap: 7px;
  color: #445064;
  font-size: 13px;
  font-weight: 600;
}

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

.image-field input {
  padding-top: 6px;
}

.file-name {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.modal-spacer {
  flex: 1;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    align-items: flex-start;
    padding: 14px;
    flex-direction: column;
  }

  .workspace {
    padding: 12px;
  }

  .section-title-bar {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .section-title-bar h2 {
    font-size: 18px;
  }

  .section-title-bar strong {
    font-size: 12px;
  }

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

  .holiday-home,
  .holiday-region-actions,
  .design-reward-panel,
  .ranking-grid,
  .holiday-item,
  .holiday-detail-grid,
  .my-info-summary,
  .my-info-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    height: auto;
    flex-wrap: wrap;
  }

  .search-wrap {
    min-width: 100%;
  }

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

  .device-summary,
  .device-item,
  .approval-item {
    grid-template-columns: 1fr;
  }

  .approval-actions {
    justify-content: flex-start;
  }
}
