.v3-publish-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.36);
}

.v3-publish-overlay.open {
  display: flex;
}

.v3-publish-lock {
  overflow: hidden;
}

.v3-publish-panel {
  --v3-card-detail-width: min(360px, calc(100vw - 28px));
  --v3-card-detail-desktop-width: 360px;
  --v3-card-detail-bg: #fff;
  --v3-card-detail-border: 1px solid rgba(255, 255, 255, 0.86);
  --v3-card-detail-radius: 16px;
  --v3-card-detail-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: min(calc(100dvh - 32px), 640px);
  overflow: auto;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  color: #2f2f2f;
}

.v3-publish-panel-menu {
  height: auto;
  min-height: 0;
}

.v3-publish-panel-form {
  --v3-card-detail-width: min(360px, calc(100vw - 28px));
  --v3-card-detail-desktop-width: 360px;
  --v3-card-detail-border: 8px solid #c81623;
  height: auto;
  max-height: min(calc(100dvh - 32px), 640px);
}

.v3-publish-head {
  position: sticky;
  top: -12px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: -12px -4px 8px;
  padding: 10px 28px 7px;
  background: #fff;
  border-bottom: 1px dashed #d1d5db;
}

.v3-publish-head h2 {
  margin: 0;
  color: #c81623;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.v3-publish-close,
.v3-publish-link {
  border: 1px solid #d8e1ee;
  background: #fff;
  color: #1f3659;
}

.v3-publish-close {
  position: absolute;
  top: -3px;
  right: -6px;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  font-size: 22px;
  line-height: 1;
}

.v3-publish-link {
  height: 34px;
  padding: 0 12px;
  margin-bottom: 10px;
  border-radius: 17px;
  font-weight: 650;
}

.v3-publish-note,
.v3-publish-kind-line {
  margin: 0 0 12px;
  color: #53627a;
  font-size: 13px;
  line-height: 1.55;
}

.v3-publish-kind-line {
  color: #1d4ed8;
  font-weight: 650;
}

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

.v3-publish-choice-grid.primary {
  grid-template-columns: 1fr;
}

.v3-publish-choice {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  text-align: left;
  background: #fff;
  border: 1px solid #dce5f1;
  border-radius: 14px;
}

.v3-publish-choice::after {
  content: ">";
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
}

.v3-publish-choice b {
  color: #111827;
  font-size: 16px;
  font-weight: 720;
}

.v3-publish-form {
  display: grid;
  gap: 10px;
}

.v3-publish-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.v3-publish-field {
  display: grid;
  min-width: 0;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 5px 9px;
}

.v3-publish-field span {
  color: #333;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}

.v3-publish-field i {
  margin-left: 2px;
  color: #dc2626;
  font-style: normal;
}

.v3-publish-region-field {
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 5px 9px;
}

.v3-publish-field input,
.v3-publish-field select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: #111827;
  font-size: 16px;
  background: #fff;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  outline: none;
}

.v3-date-period {
  position: relative;
  display: grid;
  gap: 6px;
}

.v3-date-period-current {
  min-height: 44px;
  padding: 9px 38px 9px 11px;
  color: #111827;
  text-align: left;
  font-size: 16px;
  background: #fff url("/assets/v3/icons/select-chevron.svg") right 11px center / 14px 14px no-repeat;
  border: 1px solid #999;
  border-radius: 5px;
}

.v3-date-period-current[hidden] {
  display: none;
}

.v3-date-period-list {
  display: none;
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  z-index: 40;
  overflow: hidden;
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
}

.v3-date-period.open-up .v3-date-period-list {
  top: auto;
  bottom: 48px;
}

.v3-date-period.open .v3-date-period-list {
  display: grid;
}

.v3-date-period-option {
  min-height: 42px;
  padding: 9px 12px;
  color: #111827;
  text-align: left;
  font-size: 14px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
}

.v3-date-period-option:last-child {
  border-bottom: 0;
}

.v3-date-period [data-v3-date-custom][hidden] {
  display: none;
}

.v3-date-custom-single {
  position: relative;
}

.v3-date-custom-single input {
  width: 100%;
  padding-right: 42px;
  color: transparent;
  caret-color: #111827;
  letter-spacing: 0;
}

.v3-date-custom-mask {
  position: absolute;
  top: 50%;
  left: 11px;
  right: 42px;
  overflow: hidden;
  color: #111827;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-50%);
}

.v3-date-custom-menu {
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  min-height: 44px;
  background: #fff url("/assets/v3/icons/select-chevron.svg") center / 14px 14px no-repeat;
  border: 1px solid #999;
  border-radius: 5px;
}

.v3-publish-field .v3-field-library-search {
  padding-right: 36px;
}

.v3-publish-field select {
  appearance: none;
  background-image: url("/assets/v3/icons/select-chevron.svg");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.v3-publish-field input:focus,
.v3-publish-field select:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.v3-publish-field input[aria-invalid="true"],
.v3-publish-field select[aria-invalid="true"] {
  border-color: #dc2626;
}

.v3-publish-success-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.42);
}

.v3-publish-success-card {
  width: min(336px, 100%);
  display: grid;
  gap: 10px;
  padding: 20px 18px 18px;
  color: #172033;
  background: #fff;
  border: 1px solid #dbe7f6;
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.2);
}

.v3-publish-success-card h3 {
  margin: 0;
  color: #0f172a;
  font-size: 19px;
  font-weight: 820;
  letter-spacing: 0;
}

.v3-publish-success-card p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

.v3-publish-success-card small {
  color: #64748b;
  font-size: 12px;
}

.v3-publish-success-ok {
  width: 100%;
  height: 42px;
  margin-top: 2px;
  color: #fff;
  font-size: 15px;
  font-weight: 760;
  background: #1d4ed8;
  border: 1px solid #1d4ed8;
  border-radius: 12px;
}

.v3-role-rank-field {
  grid-column: 1 / -1;
}

.v3-role-rank-picker {
  position: relative;
  display: grid;
  gap: 5px;
}

.v3-role-rank-warning {
  padding: 4px 6px;
  color: #c81623;
  text-align: center;
  font-size: 10px;
  line-height: 1.35;
  background: #fff7f7;
  border: 1px dashed #efb4b8;
  border-radius: 6px;
}

.v3-publish-field small,
.v3-publish-error {
  grid-column: 2;
  color: #8a97aa;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.v3-publish-field small:empty,
.v3-publish-error:empty {
  display: none;
}

.v3-publish-error {
  color: #b91c1c;
}

.v3-publish-status {
  min-height: 28px;
  margin: 0;
  padding: 9px 10px;
  color: #53627a;
  font-size: 13px;
  line-height: 1.45;
  background: #fff;
  border: 1px solid #dfe7f2;
  border-radius: 6px;
}

.v3-publish-status:empty {
  display: none;
}

.v3-publish-status[data-tone="warn"] {
  color: #92400e;
  background: #fffbeb;
  border-color: #f8d37c;
}

.v3-publish-status[data-tone="error"] {
  color: #991b1b;
  background: #fff1f2;
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
  font-weight: 700;
}

.v3-publish-status[data-tone="ok"] {
  color: #166534;
  background: #f0fdf4;
  border-color: #a7f3d0;
}

.v3-publish-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.v3-publish-panel-form .v3-publish-actions {
  position: sticky;
  bottom: calc(-12px - env(safe-area-inset-bottom));
  z-index: 25;
  margin: 2px -4px calc(-12px - env(safe-area-inset-bottom));
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), #fff 24%);
  border-top: 1px solid #e5e7eb;
}

.v3-publish-keyboard-active .v3-publish-panel-form {
  scroll-padding: 96px 0 120px;
}

.v3-publish-keyboard-active .v3-publish-fields {
  padding-bottom: 84px;
}

.v3-publish-actions button {
  min-height: 46px;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 700;
}

.v3-publish-secondary {
  color: #666;
  background: #eee;
  border: 1px solid #ddd;
}

.v3-publish-primary {
  color: #fff;
  background: #c81623;
  border: 1px solid #c81623;
}

.v3-publish-review-dialog {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.58);
}

.v3-publish-review-card {
  box-sizing: border-box;
  width: min(420px, calc(100vw - 28px));
  padding: 18px;
  color: #172033;
  background: #fff;
  border: 3px solid #dc2626;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.32);
}

.v3-publish-review-badge {
  display: inline-flex;
  padding: 5px 9px;
  color: #fff;
  font-size: 12px;
  background: #dc2626;
  border-radius: 4px;
}

.v3-publish-review-card h3 {
  margin: 12px 0 8px;
  font-size: 19px;
  line-height: 1.4;
}

.v3-publish-review-list {
  margin: 0;
  padding: 12px 12px 12px 30px;
  color: #7f1d1d;
  font-size: 14px;
  line-height: 1.6;
  background: #fff1f2;
  border-left: 4px solid #dc2626;
}

.v3-publish-review-note {
  margin: 10px 0 14px;
  color: #64748b;
  font-size: 12px;
}

.v3-publish-review-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
}

.v3-publish-review-actions button {
  min-height: 42px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.v3-publish-review-back {
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.v3-publish-review-confirm {
  color: #fff;
  background: #c81623;
  border: 1px solid #c81623;
}

@media (min-width: 561px) {
  .v3-publish-overlay {
    align-items: center;
    padding: 14px;
  }

  .v3-publish-panel {
    max-height: min(86vh, 640px);
  }

  .v3-publish-panel-form {
    max-height: min(86vh, 640px);
  }

  .v3-publish-head {
    margin-bottom: 8px;
  }

  .v3-publish-head h2 {
    font-size: 14px;
  }

  .v3-publish-note,
  .v3-publish-kind-line {
    margin-bottom: 10px;
  }

  .v3-publish-choice {
    min-height: 42px;
    border-radius: 10px;
  }
}

@media (max-width: 560px) {
  .v3-publish-panel {
    --v3-card-detail-width: min(360px, calc(100vw - 24px));
    max-height: min(calc(100dvh - 32px), 640px);
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    --v3-card-detail-radius: 16px;
  }

  .v3-publish-panel-form {
    --v3-card-detail-width: min(360px, calc(100vw - 24px));
    height: auto;
    max-height: min(calc(100dvh - 32px), 640px);
  }

  .v3-publish-form {
    gap: 6px;
  }

  .v3-publish-fields {
    gap: 6px;
  }

  .v3-publish-field input,
  .v3-publish-field select,
  .v3-field-library-search,
  .v3-date-period-current,
  .v3-date-custom-menu {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 13px;
  }

  .v3-publish-field span {
    font-size: 12px;
    font-weight: 600;
  }

  .v3-date-custom-menu {
    padding-left: 0;
    padding-right: 0;
  }

  .v3-publish-actions button {
    min-height: 40px;
    font-size: 14px;
  }

  .v3-publish-choice-grid {
    grid-template-columns: 1fr;
  }

  .v3-role-rank-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .v3-publish-field {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}
