html:has(body.utility-body) {
  height: 100%;
}

.utility-body {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.utility-body .site-header,
.utility-body .site-footer {
  flex: 0 0 auto;
}

.utility-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.utility-sidebar {
  background: linear-gradient(180deg, #ff7a26 0%, var(--orange) 45%, var(--orange-dark) 100%);
  color: var(--white);
  padding: 0.9rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 4px 0 24px rgba(217, 87, 0, 0.18);
  min-height: 0;
  overflow: auto;
}

.utility-sidebar-brand .utility-kicker {
  display: block;
  font-size: 0.75rem;
  opacity: 0.9;
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.utility-sidebar-brand strong {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.utility-menu {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.utility-menu a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--white);
  font-weight: 600;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: transparent;
  transition: background 0.15s ease, transform 0.15s ease;
}

.utility-menu a:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
}

.utility-menu a.is-active {
  background: var(--white);
  color: var(--orange-dark);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.utility-menu-icon {
  font-size: 1.1rem;
}

.utility-menu-soon {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  opacity: 0.85;
  padding: 0 0.85rem;
}

.utility-back {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 600;
  font-size: 0.9rem;
}

.utility-back:hover {
  color: var(--white);
}

.utility-main {
  padding: 0.85rem 1.1rem 1rem;
  width: min(1180px, 100%);
  min-height: 0;
  overflow: auto;
  align-self: stretch;
}

.utility-hero h1 {
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  margin-bottom: 0.15rem;
}

.utility-hero p {
  color: var(--text-muted);
  margin: 0 0 0.65rem;
  max-width: 60ch;
  font-size: 0.92rem;
}

.utility-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.9rem;
}

.utility-dropzone {
  border: 1.5px dashed rgba(255, 102, 0, 0.4);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf6, #fff);
  padding: 0.85rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.utility-dropzone.is-dragover {
  border-color: var(--orange);
  background: var(--orange-light);
}

.utility-dropzone strong {
  display: block;
  margin-bottom: 0.25rem;
}

.utility-dropzone span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.utility-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem;
  align-items: end;
  margin-top: 1rem;
}

.utility-controls label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.utility-controls select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--white);
}

.utility-file-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  max-height: 220px;
  overflow: auto;
}

.utility-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.utility-file-list .meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.utility-progress-wrap {
  margin-top: 1rem;
  display: none;
}

.utility-progress-wrap.is-visible {
  display: block;
}

.utility-progress {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.utility-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--orange), #ff944d);
  transition: width 0.2s ease;
}

.utility-progress-label {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.utility-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.resize-workspace {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
  margin-top: 0.75rem;
  align-items: start;
}

.resize-workspace.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.resize-preview-wrap {
  background: #f3f3f3;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.65rem;
  text-align: center;
  min-height: 180px;
  max-height: min(42vh, 360px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  overflow: auto;
}

.resize-preview-wrap canvas {
  max-width: 100%;
  height: auto;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #eee 25%, transparent 25%) 0 8px / 16px 16px,
    linear-gradient(45deg, transparent 75%, #eee 75%) 8px -8px / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #eee 75%) -8px 0 / 16px 16px,
    #fff;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.resize-controls label,
.resize-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.resize-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.resize-controls input[type="number"] {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.resize-check {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  margin: 0.85rem 0;
  font-weight: 600;
  cursor: pointer;
}

.resize-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
}

.scale-presets {
  margin: 0.85rem 0 0.25rem;
}

.scale-presets .resize-label {
  margin-bottom: 0.45rem;
}

.scale-btn.is-active,
.rotate-btn.is-active {
  border-color: var(--orange);
  background: var(--orange-light);
  color: var(--orange-dark);
}

.rotate-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.rotate-custom {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

.resize-file-list li.is-active {
  background: var(--orange-light);
  border-radius: 10px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.resize-pick {
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  flex: 1;
  padding: 0.25rem 0;
  font: inherit;
  color: inherit;
}

.resize-pick strong {
  display: block;
}

@media (max-width: 860px) {
  html:has(body.utility-body),
  .utility-body {
    height: auto;
    max-height: none;
    overflow: visible;
    min-height: 100dvh;
  }

  .utility-shell {
    grid-template-columns: 1fr;
    overflow: visible;
    flex: 1 0 auto;
  }

  .utility-sidebar {
    box-shadow: none;
    min-height: auto;
    overflow: visible;
  }

  .utility-menu {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .utility-controls {
    grid-template-columns: 1fr;
  }

  .utility-main {
    width: 100%;
    overflow: visible;
  }

  .resize-workspace {
    grid-template-columns: 1fr;
  }

  .resize-grid {
    grid-template-columns: 1fr;
  }

  .resize-preview-wrap {
    max-height: none;
  }
}

.utility-body .site-footer {
  padding: 0.75rem 1.25rem;
}
.utility-body .site-header {
  padding: 0.65rem 1.25rem;
}
.utility-body .site-logo img {
  height: 40px;
}
