.watermark-hero {
  padding-top: 28px;
  background: linear-gradient(140deg, #f1f4fb 0%, #e8edf8 38%, #edf2f9 100%);
}

.watermark-hero-content {
  max-width: 1340px;
}

.watermark-hero .badge,
.watermark-hero h1,
.watermark-hero .subtitle {
  display: none;
}

.watermark-layout {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 0;
  border: 1px solid #cfd7e6;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.08);
  min-height: 760px;
}

.watermark-layout.panel-locked {
  grid-template-columns: minmax(0, 1fr);
}

.watermark-preview-pane {
  background: #f3f5fa;
  padding: 20px;
}

.watermark-control-pane {
  background: #f8f9fc;
  border-left: 1px solid #cfd7e6;
  position: sticky;
  top: 78px;
  height: calc(100dvh - 96px);
  overflow: auto;
}

.watermark-control-head {
  padding: 14px 18px;
  border-bottom: 1px solid #d8deeb;
  background: #ffffff;
}

.watermark-control-head h2 {
  margin: 0;
  text-align: center;
  font-size: 38px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.1;
}

.watermark-upload-top {
  margin-bottom: 12px;
}

.watermark-upload-box {
  min-height: 130px;
  border-radius: 16px;
  border: 1px dashed #9db7f6;
  background: #f6f8ff;
}

.watermark-upload-progress {
  margin-top: 8px;
  border: 1px solid #dbe3f3;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 13px;
}

.watermark-upload-progress.hidden {
  display: none !important;
}

.watermark-upload-progress .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e1;
  border-top-color: #0b5fff;
  border-radius: 999px;
  animation: wmSpin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes wmSpin {
  to {
    transform: rotate(360deg);
  }
}

.watermark-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 2px 0 10px;
}

.wm-file-select,
.wm-add-btn {
  height: 42px;
  border-radius: 10px;
  border: 1px solid #cfd7e6;
  background: #ffffff;
  color: #1f2937;
  font-size: 14px;
}

.wm-file-select {
  width: 100%;
  padding: 0 10px;
}

.wm-file-select:focus,
.wm-add-btn:focus,
.wm-page-cell input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.wm-add-btn {
  padding: 0 14px;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.watermark-queue-section {
  margin-top: 6px;
}

.watermark-queue-section.hidden,
.watermark-preview-wrap.hidden {
  display: none !important;
}

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

.watermark-head-row h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  color: #0f172a;
}

.watermark-head-row p {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

.watermark-queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 12px;
}

.watermark-item {
  border: 1px solid #d4daea;
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
  display: grid;
  gap: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.watermark-item.active {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.wm-item-thumb {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(145deg, #fbfdff, #f3f6fb);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.wm-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wm-item-thumb::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
}

.wm-item-top {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.wm-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #334155;
}

.wm-kind {
  font-size: 10px;
  color: #1e3a8a;
  background: #eaf1ff;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  padding: 2px 7px;
}

.wm-item-meta {
  font-size: 11px;
  color: #64748b;
}

.wm-item-actions {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 6px;
  align-items: center;
}

.wm-select-btn {
  border: 1px solid #dbe3f3;
  background: #ffffff;
  color: #334155;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.wm-select-btn.active {
  background: #fff1f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.wm-item-actions .reorder-btn {
  padding: 6px 8px;
  font-size: 11px;
  min-width: 0;
}

.wm-item-actions .remove-img-btn {
  margin: 0;
}

.watermark-preview-empty {
  margin-top: 12px;
  min-height: 320px;
  border: 1px dashed #c9d5ea;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #64748b;
  background: #f8fbff;
  font-size: 15px;
}

.watermark-preview-wrap {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.watermark-canvas-wrap {
  border: 1px solid #d5dced;
  border-radius: 16px;
  background: #ffffff;
  padding: 12px;
  min-height: 330px;
  display: grid;
  place-items: center;
}

#watermarkCanvas {
  width: 100%;
  max-height: 620px;
  height: auto;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #dbe3f3;
}

.watermark-controls {
  padding: 0 0 16px;
  display: grid;
  gap: 10px;
}

.wm-mode-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid #d8deeb;
  background: #f4f6fa;
}

.mode-chip {
  border: 0;
  border-right: 1px solid #d8deeb;
  border-radius: 0;
  padding: 12px 8px;
  background: transparent;
  color: #7c889d;
  font-size: 14px;
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 5px;
}

.mode-chip:last-child {
  border-right: 0;
}

.mode-chip svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.mode-chip.active {
  color: #111827;
  background: #ffffff;
}

.wm-pane {
  display: none;
  gap: 8px;
  padding: 12px 18px 2px;
}

.wm-pane.active {
  display: grid;
}

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

#wmPosition,
#wmTextInput {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 14px;
  background: #ffffff;
}

#wmTextInput:focus,
#wmLogoInput:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.field-label {
  font-family: "Montserrat", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.field-note {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

#wmLogoInput {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  padding: 9px 10px;
  font-size: 13px;
}

.wm-section-card {
  border: 1px solid #dde3ef;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  margin: 0 18px;
  display: grid;
  gap: 8px;
}

.wm-position-grid {
  display: grid;
  grid-template-columns: repeat(3, 26px);
  grid-template-rows: repeat(3, 26px);
  gap: 2px;
  width: fit-content;
  padding: 4px;
  border: 1px solid #cad4e3;
  border-radius: 8px;
  background: #f8fbff;
}

.wm-pos-btn {
  border: 1px solid #dbe3f3;
  background: #ffffff;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.wm-pos-btn.active {
  background: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.16);
}

.wm-hidden-select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.range-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 18px;
}

.range-inline input[type="range"] {
  flex: 1;
}

.range-inline span {
  min-width: 44px;
  text-align: right;
  font-size: 13px;
  color: #475569;
}

#wmTextColor {
  width: 100%;
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  padding: 4px;
}

.wm-pages-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wm-mini-chip {
  border: 1px solid #dbe3f3;
  border-radius: 9px;
  background: #f8fafc;
  color: #64748b;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: "Montserrat", sans-serif;
  cursor: pointer;
}

.wm-mini-chip.active {
  border-color: #ef4444;
  background: #fff1f2;
  color: #dc2626;
}

.wm-page-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wm-page-range.hidden {
  display: none !important;
}

.wm-page-cell {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #64748b;
}

.wm-page-cell input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  height: 36px;
  padding: 0 8px;
  font-size: 13px;
}

.wm-layer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wm-layer-btn {
  border: 1px solid #dbe3f3;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  min-height: 72px;
  padding: 8px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 2px;
  cursor: pointer;
}

.wm-layer-btn strong {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.wm-layer-btn small {
  font-size: 11px;
}

.wm-layer-btn.active {
  border-color: #ef4444;
  background: #fff1f2;
}

.watermark-stats-inline {
  padding: 6px 18px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #334155;
}

.watermark-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.watermark-metric strong {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.watermark-metric:not(:last-child)::after {
  content: "|";
  color: #94a3b8;
  margin-left: 4px;
}

#watermarkStatus {
  padding: 2px 18px;
  min-height: 24px;
}

#watermarkProgressWrap {
  margin: 0 18px;
}

.watermark-action-row {
  display: grid;
  gap: 10px;
  padding: 8px 18px 0;
}

.watermark-action-row .primary-btn,
.watermark-action-row .secondary-btn {
  border-radius: 12px;
  min-height: 54px;
  font-weight: 600;
  font-size: 18px;
}

.watermark-action-row .primary-btn {
  background: #ef2f2f;
}

.watermark-action-row .secondary-btn {
  background: #8f96a3;
}

@media (max-width: 1180px) {
  .watermark-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .watermark-control-pane {
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid #cfd7e6;
  }
}

@media (max-width: 760px) {
  .watermark-hero {
    padding-top: 16px;
  }

  .watermark-layout {
    border-radius: 16px;
  }

  .watermark-preview-pane,
  .watermark-control-pane {
    border-radius: 0;
  }

  .watermark-toolbar {
    grid-template-columns: 1fr;
  }

  .watermark-head-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .watermark-queue {
    grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  }

  .wm-item-actions {
    grid-template-columns: 1fr 1fr;
  }

  .wm-item-actions .remove-img-btn {
    justify-self: end;
  }

  .wm-grid-2,
  .wm-page-range,
  .wm-layer-row {
    grid-template-columns: 1fr;
  }

  .mode-chip svg {
    width: 30px;
    height: 30px;
  }

  .watermark-action-row .primary-btn,
  .watermark-action-row .secondary-btn {
    min-height: 50px;
    font-size: 17px;
  }
}
