.contract-total {
  border: 1px solid #cbdcf7;
  border-radius: 10px;
  padding: 12px;
  background: #f7faff;
}

.required-field {
  position: relative;
}

.required-field::after {
  content: "必填";
  position: absolute;
  top: 0;
  right: 0;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff0f1;
  color: #d43c4c;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
}

.payment-row {
  grid-template-columns: 62px 1fr 48px 1.2fr 1fr;
}

.pay-percent {
  padding: 7px 4px;
  border-radius: 7px;
  background: #edf3ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.payment-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-radius: 10px;
  padding: 12px;
  background: #f5f6f8;
  font-size: 13px;
}

.payment-summary strong {
  grid-column: 1 / -1;
}

.payment-summary .ok {
  color: #16834a;
}

.payment-summary .warn {
  color: #c24c35;
}

.contract-display {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.order-actions {
  display: flex;
  gap: 9px;
  margin-top: 18px;
}

.order-actions button {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
}

aside.contract-drawer {
  width: min(920px, 94vw);
}

.contract-template-text {
  min-height: 220px;
  line-height: 1.65;
}

.template-version-note {
  border-radius: 9px;
  padding: 10px 12px;
  background: #f5f6f8;
  color: #777;
  font-size: 12px;
}

.contract-history {
  display: grid;
  gap: 9px;
}

.contract-history article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
}

.contract-history article div {
  display: grid;
  gap: 4px;
}

.contract-history small {
  color: #777;
}

.contract-history button,
.add-contract-item {
  flex: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #edf3ff;
  color: var(--blue);
  font-weight: 700;
}

.contract-history-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.contract-history-actions button:first-child {
  background: #f3f4f6;
  color: #555;
}

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

.contract-item-head,
.contract-item-row {
  display: grid;
  grid-template-columns: .75fr 1fr 1.8fr 70px 100px 90px 34px;
  gap: 6px;
  align-items: center;
}

.contract-item-head {
  padding: 0 3px 6px;
  color: #777;
  font-size: 11px;
}

.contract-item-row {
  margin-bottom: 7px;
}

.contract-item-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.contract-item-row [data-subtotal] {
  text-align: right;
}

.remove-contract-item {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #fff0f0;
  color: #bd3535;
}

.contract-total-check {
  margin: 10px 0 18px;
  border-radius: 9px;
  padding: 10px 12px;
  background: #f5f6f8;
  text-align: right;
  font-size: 13px;
}

.contract-total-check .ok {
  color: #16834a;
}

.contract-total-check .warn {
  color: #c24c35;
}

.contract-pay-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.contract-pay-grid label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  align-items: center;
  color: #666;
  font-size: 12px;
}

.contract-pay-grid input {
  grid-column: 1;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.contract-pay-grid span {
  grid-column: 2;
  grid-row: 2;
}

.contract-image-upload {
  border: 1px dashed #aac6ee;
  border-radius: 11px;
  padding: 14px;
  background: #f7faff;
}

.contract-image-upload input {
  margin: 8px 0;
}

.contract-image-upload small {
  display: block;
  color: #777;
}

#contractImageList {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#contractImageList span {
  border-radius: 7px;
  padding: 5px 8px;
  background: #edf3ff;
  color: #4b6d9f;
  font-size: 11px;
}

.venue-new {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.venue-new input,
.venue-item input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.venue-item {
  display: grid;
  gap: 9px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
}

.venue-item label {
  display: grid;
  gap: 5px;
  color: #666;
  font-size: 12px;
}

.venue-item > div {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.venue-item button {
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
}

.save-venue {
  background: var(--blue);
  color: #fff;
}

.delete-venue {
  background: #fff0f0;
  color: #b93434;
}

.event {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  white-space: nowrap;
}

.event > span {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mid-payment {
  flex: none;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
}

.mid-payment.pending {
  background: rgba(207, 118, 0, 0.12);
  color: #ad6200;
}

.mid-payment.received {
  background: rgba(20, 135, 76, 0.12);
  color: #117344;
}

.payment-reminder {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 27, 40, 0.52);
  backdrop-filter: blur(5px);
}

.payment-reminder section {
  position: relative;
  width: min(460px, 100%);
  border-radius: 20px;
  padding: 28px;
  background: #fff;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.28);
}

.reminder-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f0f1f3;
  font-size: 20px;
}

.reminder-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: #fff0d9;
  color: #dc7a00;
  font-size: 26px;
  font-weight: 900;
}

.payment-reminder h2 {
  margin: 14px 0 6px;
}

.payment-reminder p {
  color: #666;
  line-height: 1.6;
}

.reminder-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.reminder-list button {
  display: grid;
  gap: 4px;
  border: 1px solid #f0d3a6;
  border-radius: 10px;
  padding: 11px;
  background: #fffaf2;
  text-align: left;
}

.reminder-list span,
.payment-reminder section > small {
  color: #888;
  font-size: 12px;
}

nav .nav-active {
  background: #e9f1ff;
  color: var(--blue);
  font-weight: 700;
}

.new-schedule {
  width: auto !important;
  border-radius: 9px !important;
  padding: 0 12px;
  background: var(--blue);
  color: #fff;
}

.schedule-legend {
  display: flex;
  gap: 18px;
  padding: 9px 15px;
  background: #fafbfc;
  color: #777;
  font-size: 11px;
}

.mine-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.announcement-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: #d97706;
}

.schedule-event {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  margin-top: 4px;
  border: 0;
  border-radius: 5px;
  padding: 5px;
  background: #eceef2;
  color: #50545c;
  text-align: left;
  font-size: 11px;
}

.schedule-event > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-event > small {
  flex: none;
  color: #888;
  font-size: 9px;
}

.schedule-event.own-schedule {
  box-shadow: inset 4px 0 var(--blue);
  background: #e7f0ff;
  color: #205cae;
  font-weight: 700;
}

.schedule-event.announcement-event {
  box-shadow: inset 4px 0 #d97706;
  background: #fff4dc;
  color: #8a4b00;
  font-weight: 800;
}

.schedule-event.completed,
.schedule-card.completed {
  opacity: 0.52;
  text-decoration: line-through;
}

.schedule-owner,
.private-label,
.reminder-label,
.done-label,
.announcement-label,
.unread-label {
  display: inline-block;
  margin-right: 6px;
  border-radius: 6px;
  padding: 4px 8px;
  background: #e7f0ff;
  color: #2868bf;
  font-size: 11px;
}

.private-label {
  background: #f0e8fa;
  color: #7a42a8;
}

.reminder-label {
  background: #fff1dc;
  color: #ad6200;
}

.done-label {
  background: #e5f5ec;
  color: #187646;
}

.announcement-label {
  background: #fff0d0;
  color: #9a5600;
}

.unread-label {
  background: #ffe5e5;
  color: #b42323;
}

.schedule-card.announcement-card {
  border-color: #efc879;
  background: #fffaf0;
}

.schedule-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.schedule-actions button {
  flex: 1;
  border: 0;
  border-radius: 9px;
  padding: 11px;
}

.delete-schedule {
  background: #fff0f0;
  color: #b93434;
}

.switch-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.switch-row span {
  display: grid;
  gap: 3px;
}

.switch-row small {
  color: #888;
}

.switch-row input {
  width: 22px;
  height: 22px;
}

.announcement-switch {
  border-color: #efc879;
  background: #fffaf0;
}

.switch-disabled {
  opacity: .48;
}

.confirm-announcement-read {
  width: 100%;
  margin-top: 18px;
}

.announcement-reminder section {
  width: min(560px, 100%);
}

.announcement-bell {
  background: #fff0d0;
  color: #9a5600;
}

.announcement-reminder-list {
  display: grid;
  gap: 10px;
  max-height: 55vh;
  margin-top: 16px;
  overflow-y: auto;
}

.announcement-reminder-list article {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid #efc879;
  border-radius: 12px;
  padding: 13px;
  background: #fffaf0;
}

.announcement-reminder-list article > div {
  display: grid;
  gap: 5px;
}

.announcement-reminder-list small {
  color: #98631d;
}

.announcement-reminder-list p {
  margin: 0;
  color: #555;
  white-space: pre-wrap;
}

.announcement-reminder-list button {
  border: 0;
  border-radius: 9px;
  padding: 10px 13px;
  background: #d97706;
  color: #fff;
  font-weight: 800;
}

.schedule-reminder-list {
  display: grid;
  gap: 9px;
  margin-top: 15px;
}

.schedule-reminder-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #bad3f8;
  border-radius: 11px;
  padding: 12px;
  background: #f6f9ff;
}

.schedule-reminder-list p {
  margin: 4px 0 0;
  font-size: 12px;
}

.schedule-reminder-list button {
  flex: none;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  background: #16834a;
  color: #fff;
  font-weight: 700;
}

.schedule-bell {
  background: #e5f5ec;
  color: #16834a;
}

.password-reset {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.password-reset input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.password-reset button {
  border: 0;
  border-radius: 8px;
  padding: 8px 11px;
  background: #7a42a8;
  color: #fff;
}

.row-msg {
  grid-column: 1 / -1;
  color: #b14a39 !important;
}

.month-scroll,
.month-canvas {
  width: 100%;
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
  }

  header {
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 11px 12px;
  }

  header > div:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
  }

  header h1 {
    font-size: 19px;
  }

  nav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    padding-bottom: 3px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  nav a,
  nav b,
  nav button {
    display: block;
    flex: none;
    padding: 8px 11px;
    font-size: 12px;
    white-space: nowrap;
  }

  .calendar {
    width: 100%;
    min-height: calc(100vh - 116px);
  }

  .cal-toolbar {
    position: sticky;
    z-index: 4;
    top: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 10px;
    background: #fff;
  }

  .view-switch {
    position: static;
    align-self: center;
    transform: none;
  }

  .view-switch button {
    min-width: 55px;
    padding: 7px 13px;
  }

  .calhead {
    display: grid;
    grid-template-columns: 34px minmax(135px, 1fr) 34px auto;
    width: 100%;
    padding: 0;
  }

  .calhead h2 {
    min-width: 0;
    font-size: 17px;
  }

  .calhead #today {
    padding: 0 10px;
  }

  .calhead .new-schedule {
    grid-column: 1 / -1;
    width: 100% !important;
    min-height: 38px;
  }

  .month-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .month-canvas {
    min-width: 770px;
  }

  .week {
    position: sticky;
    z-index: 2;
    top: 0;
    background: #fff;
  }

  .week span {
    padding: 8px 4px;
    font-size: 11px;
  }

  .grid > div {
    min-height: 112px;
    padding: 5px;
  }

  .grid strong {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .event {
    min-height: 24px;
    height: 24px;
    padding: 4px 5px;
  }

  .event > span {
    font-size: 10px;
  }

  .mid-payment {
    display: none;
  }

  .event > span {
    flex: 1 1 100%;
  }

  .year-grid {
    gap: 9px;
  }

  .year-card {
    min-height: 98px;
    padding: 13px;
  }

  .day-orders {
    grid-template-columns: 1fr;
  }

  .day-card {
    padding: 14px;
  }

  aside {
    padding: 18px 15px calc(24px + env(safe-area-inset-bottom));
  }

  aside h2 {
    font-size: 20px;
  }

  dl {
    grid-template-columns: 76px 1fr;
    gap: 10px;
    font-size: 14px;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0 -15px -10px;
    padding: 10px 15px;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(10px);
  }

  .form-actions button {
    flex: 1;
    min-height: 44px;
  }

  .payment-row {
    grid-template-columns: 1fr 1fr;
  }

  .payment-row b {
    grid-column: 1 / -1;
  }

  .pay-percent {
    grid-column: 2;
  }

  .payment-summary {
    grid-template-columns: 1fr;
  }

  .event {
    min-height: 24px;
    height: 24px;
    padding: 4px 5px;
  }

  .event > span {
    display: block !important;
    color: inherit !important;
    font-size: 10px !important;
    line-height: 16px;
    opacity: 1 !important;
  }

  .mid-payment {
    display: none !important;
  }

  .schedule-legend {
    flex-direction: column;
    gap: 3px;
  }

  .schedule-event {
    min-height: 18px;
    height: 18px;
    padding: 2px 4px;
    font-size: 9px;
  }

  .schedule-event > small {
    display: none;
  }

  .schedule-month-scroll .month-canvas {
    min-width: 560px;
  }

  .schedule-grid > div {
    min-height: 82px;
    padding: 4px;
  }

  .schedule-grid .schedule-event > span {
    font-size: 9px;
  }

  .payment-reminder section {
    max-height: calc(100vh - 36px);
    padding: 22px 18px;
    overflow-y: auto;
  }

  .password-reset {
    grid-template-columns: 1fr;
  }

  aside.contract-drawer {
    width: 100vw;
  }

  .contract-item-head {
    display: none;
  }

  .contract-item-row {
    grid-template-columns: 1fr 1fr 72px 78px 30px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .contract-item-row [data-field="category"],
  .contract-item-row [data-field="name"],
  .contract-item-row [data-field="specification"] {
    grid-column: 1 / -1;
  }

  .contract-item-row [data-field="quantity"] {
    grid-column: 1;
  }

  .contract-item-row [data-field="unitPrice"] {
    grid-column: 2;
  }

  .contract-item-row [data-subtotal] {
    grid-column: 3;
  }

  .contract-pay-grid {
    grid-template-columns: 1fr;
  }

  .contract-history article {
    align-items: flex-start;
  }
}
