.tools-hub,
.image-tool {
  color: var(--ink, #172033);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tools-hero,
.image-tool-hero {
  border-bottom: 1px solid var(--line, #dfe4ea);
  margin-bottom: 20px;
  padding-bottom: 16px;
}

.tools-hero > span,
.image-tool-hero > span {
  color: var(--accent-2, #0f766e);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.tools-hero h1,
.image-tool-hero h1 {
  font-size: 27px;
  letter-spacing: 0;
  margin: 0 0 7px;
}

.tools-hero p,
.image-tool-hero p {
  color: var(--muted, #667085);
  margin: 0;
  max-width: 720px;
}

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

.tool-card {
  align-items: start;
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(20, 30, 50, 0.045);
  color: inherit;
  display: grid;
  gap: 14px;
  grid-template-columns: 54px minmax(0, 1fr);
  padding: 18px;
  text-decoration: none;
}

.tool-card:hover {
  border-color: rgba(49, 92, 150, 0.38);
  box-shadow: 0 10px 26px rgba(20, 30, 50, 0.08);
  text-decoration: none;
  transform: translateY(-1px);
}

.tool-mark {
  align-items: center;
  border-radius: 7px;
  display: flex;
  font-size: 11px;
  font-weight: 850;
  height: 48px;
  justify-content: center;
  width: 54px;
}

.tool-mark-pdf {
  background: var(--soft-amber, #fff7e8);
  color: var(--accent-3, #b45309);
}

.tool-mark-image {
  background: var(--soft-green, #edf8f5);
  color: var(--accent-2, #0f766e);
}

.tool-mark-formula {
  background: #f3effb;
  color: #6b4aa1;
  font-size: 9px;
}

.tool-mark-registry {
  background: #eaf3fb;
  color: #245f8f;
}

.tool-mark-word {
  background: #e8f1fb;
  color: #245f8f;
  font-size: 9px;
}

.tool-card h2 {
  color: var(--ink, #172033);
  font-size: 17px;
  margin: 0 0 5px;
}

.tool-card p {
  color: var(--muted, #667085);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0 0 12px;
}

.tool-link {
  color: var(--accent, #315c96);
  font-size: 12.5px;
  font-weight: 750;
}

.image-upload {
  align-items: center;
  background: var(--soft-green, #edf8f5);
  border: 1px dashed rgba(15, 118, 110, 0.32);
  border-radius: 8px;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  float: none;
  gap: 18px;
  justify-content: space-between;
  padding: 18px 20px;
  width: 100%;
}

.image-upload > span {
  flex: 1 1 auto;
  min-width: 0;
}

.image-upload strong,
.image-upload span {
  display: block;
}

.image-upload strong {
  font-size: 16px;
  margin-bottom: 3px;
}

.image-upload span span {
  color: var(--muted, #667085);
  font-size: 13px;
}

.image-upload input {
  flex: 0 1 260px;
  max-width: 260px;
}

.image-editor[hidden] {
  display: none;
}

.image-editor {
  margin-top: 16px;
}

.image-resize-panel {
  align-items: end;
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 8px;
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(85px, 1fr) auto minmax(85px, 1fr) auto minmax(145px, 1.4fr) auto;
  padding: 13px;
}

.image-resize-heading {
  grid-column: 1 / -1;
}

.image-resize-heading strong,
.image-resize-heading span {
  display: block;
}

.image-resize-heading strong {
  font-size: 14px;
}

.image-resize-heading span {
  color: var(--muted, #667085);
  font-size: 11px;
  margin-top: 2px;
}

.image-dimension-field label {
  color: var(--muted, #667085);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 5px;
}

.image-dimension-field div {
  align-items: center;
  display: flex;
}

.image-dimension-field input {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 6px 0 0 6px;
  box-sizing: border-box;
  color: var(--ink, #172033);
  font: inherit;
  height: 38px;
  min-width: 0;
  padding: 7px;
  width: 100%;
}

.image-dimension-field div span {
  align-items: center;
  background: #f3f5f7;
  border: 1px solid var(--line, #dfe4ea);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  color: var(--muted, #667085);
  display: flex;
  font-size: 11px;
  height: 36px;
  padding: 0 6px;
}

.image-dimension-times {
  align-self: center;
  color: var(--muted, #667085);
  padding-top: 16px;
}

.image-ratio-lock {
  align-items: center;
  display: flex;
  float: none;
  font-size: 12px;
  height: 38px;
  white-space: nowrap;
  width: auto;
}

.image-presets {
  align-items: center;
  background: var(--soft-amber, #fff7e8);
  border: 1px solid rgba(180, 83, 9, 0.18);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 13px;
}

.image-presets label {
  float: none;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  width: auto;
}

.image-presets > span {
  color: var(--muted, #667085);
  font-size: 11px;
}

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

.image-tool-panel,
.image-watermark-panel {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 8px;
  padding: 12px 13px;
}

.image-panel-title {
  margin-bottom: 10px;
}

.image-panel-title strong,
.image-panel-title span {
  display: block;
}

.image-panel-title strong {
  font-size: 13px;
}

.image-panel-title span {
  color: var(--muted, #667085);
  font-size: 11px;
  margin-top: 2px;
}

.image-tool-panel .image-control + .image-control {
  margin-top: 10px;
}

.image-inline-check {
  align-items: center;
  display: flex;
  float: none;
  font-size: 12px;
  margin-bottom: 10px;
  width: auto;
}

.image-bg-options {
  align-items: center;
  display: grid;
  gap: 7px;
  grid-template-columns: auto 42px auto minmax(70px, 1fr) 28px;
}

.image-bg-options label {
  float: none;
  font-size: 11px;
  width: auto;
}

.image-bg-options input[type="color"] {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 5px;
  height: 32px;
  padding: 3px;
  width: 42px;
}

.image-bg-options input[type="range"] {
  accent-color: var(--accent-2, #0f766e);
  min-width: 0;
  width: 100%;
}

.image-bg-options output {
  color: var(--accent-2, #0f766e);
  font-size: 11px;
  text-align: right;
}

.image-toolbar {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 14px;
}

.image-watermark-panel {
  align-items: end;
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(110px, 1fr) 42px minmax(130px, 1fr) 116px;
  margin-top: 10px;
}

.image-watermark-panel .image-panel-title {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

#image-watermark-text {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--ink, #172033);
  font: inherit;
  height: 38px;
  min-width: 0;
  padding: 7px 9px;
  width: 100%;
}

#image-watermark-color {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 6px;
  height: 38px;
  padding: 4px;
  width: 42px;
}

.image-watermark-opacity label {
  color: var(--muted, #667085);
  display: flex;
  font-size: 11px;
  justify-content: space-between;
}

.image-watermark-opacity input {
  accent-color: var(--accent, #315c96);
  width: 100%;
}

.image-control label {
  align-items: center;
  color: var(--muted, #667085);
  display: flex;
  font-size: 12px;
  font-weight: 720;
  justify-content: space-between;
  margin-bottom: 7px;
}

.image-control output {
  color: var(--accent, #315c96);
  font-variant-numeric: tabular-nums;
}

.image-control input[type="range"] {
  accent-color: var(--accent, #315c96);
  width: 100%;
}

.image-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: space-between;
  margin: 10px 0;
}

.image-action-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.image-button,
.image-select {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 6px;
  color: var(--ink, #172033);
  font-family: inherit;
  font-size: 13px;
  height: 38px;
}

.image-button {
  cursor: pointer;
  font-weight: 700;
  padding: 0 12px;
}

.image-button:hover:not(:disabled) {
  border-color: var(--accent, #315c96);
  color: var(--accent, #315c96);
}

.image-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.image-button-primary {
  background: var(--accent, #315c96);
  border-color: var(--accent, #315c96);
  color: #fff;
}

.image-button-primary:hover:not(:disabled) {
  color: #fff;
  filter: brightness(0.94);
}

.image-select {
  padding: 0 9px;
}

.image-target-size {
  align-items: center;
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 6px;
  display: flex;
  float: none;
  font-size: 11px;
  height: 36px;
  padding-left: 9px;
  width: auto;
}

.image-target-size input {
  background: transparent;
  border: 0;
  color: var(--ink, #172033);
  font: inherit;
  margin-left: 6px;
  outline: 0;
  width: 52px;
}

.image-target-size span {
  color: var(--muted, #667085);
  padding-right: 7px;
}

.image-zoom-label {
  color: var(--muted, #667085);
  font-size: 12px;
  min-width: 48px;
  text-align: center;
}

.image-workspace {
  align-items: center;
  background: #e8ebef;
  border: 1px solid var(--line, #dfe4ea);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 500px;
  overflow: auto;
  padding: 24px;
}

.image-stage {
  background-image: linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eee 75%), linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  box-shadow: 0 8px 28px rgba(20, 30, 50, 0.16);
  line-height: 0;
}

#image-canvas {
  display: block;
  height: auto;
  max-width: none;
  padding: 0;
}

.image-meta {
  align-items: center;
  color: var(--muted, #667085);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 12px;
  justify-content: space-between;
  margin-top: 10px;
}

.image-local {
  color: var(--accent-2, #0f766e);
}

@media screen and (max-width: 760px) {
  .tools-grid,
  .image-toolbar,
  .image-advanced-grid {
    grid-template-columns: 1fr;
  }

  .image-resize-panel {
    align-items: end;
    grid-template-columns: 1fr auto 1fr;
  }

  .image-resize-heading,
  .image-ratio-lock,
  .image-resize-panel > .image-select,
  .image-resize-panel > .image-button {
    grid-column: 1 / -1;
  }

  .image-presets {
    align-items: stretch;
    flex-direction: column;
  }

  .image-watermark-panel {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .image-watermark-opacity,
  .image-watermark-panel > .image-select {
    grid-column: 1 / -1;
  }

  .image-upload {
    align-items: stretch;
    flex-direction: column;
  }

  .image-upload input {
    flex: 0 0 auto;
    max-width: 100%;
  }

  .image-workspace {
    min-height: 360px;
    padding: 12px;
  }
}

@media (prefers-color-scheme: dark) {
  .image-workspace {
    background: #151c28;
  }
}
