/* Scoped styles: preserve all other duty cards and their log status badges. */
#shiftMemberGrid .shift-member-card.has-to-night-power { position: relative; }
#shiftMemberGrid .to-night-power-button {
  position: absolute; top: 10px; right: 10px; z-index: 2; margin: 0;
  min-height: 25px; padding: 4px 8px; border: 1px solid #9bc9f0; border-radius: 4px;
  background: #eaf4ff; color: #1767b4; font: 700 11px/1.3 system-ui, sans-serif; font-family: inherit;
  font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
#shiftMemberGrid .to-night-power-button[hidden] { display: none !important; }
#shiftMemberGrid .to-night-power-button:hover:not(:disabled) { border-color: #79b7e9; background: #dceeff; color: #0e5fa9; }
#shiftMemberGrid .to-night-power-button.is-complete { border-color: #9fd6b4; background: #eaf8ef; color: #187047; }
#shiftMemberGrid .to-night-power-button.is-complete:hover:not(:disabled) { border-color: #79c397; background: #ddf3e5; color: #12623c; }
#shiftMemberGrid .to-night-power-button.is-checking { border-color: #ccd6e0; background: #f1f4f7; color: #667789; cursor: progress; }
#shiftMemberGrid .to-night-power-button:disabled { opacity: 1; }
#shiftMemberGrid .to-night-power-button:focus-visible { outline: 2px solid #bfddff; outline-offset: 3px; }

/*
  Keep the power-entry feature visually inside the existing GS Shift Log system.
  Only the TO power dialog is themed here; data, authorization and sync logic are untouched.
*/
.to-night-power-dialog {
  box-sizing: border-box;
  width: min(500px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid #d5e0eb;
  border-radius: 12px;
  background: #ffffff;
  color: #172f4b;
  font: 14px/1.55 system-ui, sans-serif;
  font-family: inherit;
  box-shadow: 0 24px 70px rgba(23, 47, 75, .24);
}
.to-night-power-dialog::backdrop { background: rgba(30, 47, 66, .52); }
.to-night-power-dialog *,
.to-night-power-dialog *::before,
.to-night-power-dialog *::after { box-sizing: border-box; }

.to-night-power-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.to-night-power-dialog h2 {
  margin: 7px 0 0;
  color: #102b4b;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -.02em;
}
.to-night-power-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #eaf4ff;
  color: #1767b4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.to-night-power-dialog button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #c8d6e5;
  border-radius: 8px;
  background: #ffffff;
  color: #294663;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.to-night-power-dialog button:hover:not(:disabled) {
  border-color: #adc3d9;
  background: #f7faff;
}
.to-night-power-dialog button:focus-visible {
  outline: 2px solid #5fa9ef;
  outline-offset: 2px;
}
.to-night-power-dialog button:disabled { opacity: .52; cursor: wait; }
.to-night-power-dialog .to-night-power-close {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #f2f5f8;
  color: #52657a;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}
.to-night-power-dialog .to-night-power-close:hover:not(:disabled) { background: #e9eef4; }

.to-night-power-date {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #d6e2ee;
  border-radius: 8px;
  background: #f6f9fc;
  color: #334f6b;
}
.to-night-power-date span { font-weight: 650; }
.to-night-power-date strong {
  color: #172f4b;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.to-night-power-help {
  margin: 8px 0 20px;
  color: #6b8198;
  font-size: 12px;
}

.to-night-power-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}
.to-night-power-fields label {
  min-width: 0;
  color: #213d5a;
  font-size: 13px;
  font-weight: 700;
}
.to-night-power-input {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
}
.to-night-power-input input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid #c4d3e2;
  border-radius: 7px;
  background: #ffffff;
  color: #203b57;
  font: 700 17px/1.3 system-ui, sans-serif;
  font-family: inherit;
  text-align: right;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 1px rgba(19, 49, 79, .02);
}
.to-night-power-input input::placeholder { color: #8a9aab; opacity: 1; }
.to-night-power-input input:hover { border-color: #a9bfd5; }
.to-night-power-input input:focus {
  border-color: #2e88dc;
  outline: 2px solid rgba(46, 136, 220, .22);
  outline-offset: 1px;
}
.to-night-power-input input[aria-invalid="true"] {
  border-color: #d95b57;
  outline-color: rgba(217, 91, 87, .18);
}
.to-night-power-input > span {
  flex: 0 0 auto;
  color: #71869c;
  font-size: 11px;
  font-weight: 500;
}

.to-night-power-message {
  min-height: 44px;
  margin: 16px 0 10px;
  color: #637d98;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.to-night-power-message.is-error { color: #c64540; }

.to-night-power-dialog footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px -22px -22px;
  padding: 16px 22px 18px;
  border-top: 1px solid #e2e9f0;
  background: #fbfcfe;
}
.to-night-power-dialog footer > div {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.to-night-power-dialog #toNightPowerReload {
  min-height: 34px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #607b96;
  font-size: 11px;
  font-weight: 600;
}
.to-night-power-dialog #toNightPowerReload:hover:not(:disabled) {
  border: 0;
  background: transparent;
  color: #276da9;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.to-night-power-dialog #toNightPowerSave {
  min-width: 62px;
  border-color: #2f83cc;
  background: #337fc2;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 2px 5px rgba(43, 112, 174, .14);
}
.to-night-power-dialog #toNightPowerSave:hover:not(:disabled) {
  border-color: #2877bc;
  background: #2b74b5;
}

@media (max-width: 520px) {
  .to-night-power-dialog {
    width: min(460px, calc(100vw - 20px));
    padding: 17px;
    border-radius: 10px;
  }
  .to-night-power-dialog h2 { font-size: 20px; }
  .to-night-power-fields { grid-template-columns: 1fr; gap: 13px; }
  .to-night-power-dialog footer {
    margin: 14px -17px -17px;
    padding: 14px 17px 16px;
  }
}

@media (max-width: 360px) {
  .to-night-power-dialog footer { align-items: stretch; }
  .to-night-power-dialog #toNightPowerReload { width: 100%; text-align: left; }
  .to-night-power-dialog footer > div { width: 100%; margin-left: 0; }
  .to-night-power-dialog footer > div button { flex: 1 1 0; }
}

/* TO_NIGHT_POWER_EXCEL_ORDER_V1_R3
   Mirror the Excel source top-to-bottom so the operator can read and key values without jumping around.
   Visual order: 태양광 발전량 -> 발전량 -> 수전량 -> 송전량.
*/
.to-night-power-fields {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}
.to-night-power-fields > label {
  display: grid !important;
  grid-template-columns: minmax(118px, 138px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.to-night-power-fields .to-night-power-input {
  margin-top: 0 !important;
}
@media (max-width: 460px) {
  .to-night-power-fields > label {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
