:root {
  --bg: #f2ede3;
  --panel: rgba(255, 252, 245, 0.94);
  --line: #d8ccb9;
  --text: #221c14;
  --muted: #6f655a;
  --accent: #155e75;
  --accent-2: #b45309;
  --danger: #b42318;
  --shadow: 0 20px 40px rgba(33, 26, 18, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(21, 94, 117, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(180, 83, 9, 0.12), transparent 24%),
    linear-gradient(180deg, #faf6ef 0%, var(--bg) 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button.compact {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ghost {
  background: #e9e0d2;
  color: var(--text);
}

.danger {
  background: #f4d9d5;
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
}

.user-access-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.user-access-card {
  width: min(560px, 92vw);
  background: var(--panel);
  border: 1px solid rgba(216, 204, 185, 0.75);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 22px;
}

.user-access-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.user-access-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  padding: 12px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  text-align: left;
}

.user-access-avatar {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #d7ecf1;
  color: #155e75;
  border: 1px solid #93c5d2;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  overflow: hidden;
}

.user-access-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-access-name {
  font-weight: 800;
  font-size: 18px;
}

.user-greeting {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin: -4px 0 2px;
}

.user-topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px 0 4px;
}

.user-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-mobile-menu-toggle {
  display: none;
  font-size: 20px;
  line-height: 1;
}

.user-mobile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.16);
  padding: 10px;
  display: grid;
  gap: 8px;
  z-index: 120;
}

.user-mobile-menu button {
  width: 100%;
  justify-self: stretch;
}

.user-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 17px;
}

.user-icon-btn.user-mobile-menu-toggle {
  display: none;
}

.notify-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #dc2626;
  border: 1px solid #fff;
}

.user-profile-btn {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #93c5d2;
  background: #d7ecf1;
  color: #155e75;
  display: grid;
  place-items: center;
}

.user-profile-avatar {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #155e75;
}

.user-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-profile-gear {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(21, 94, 117, 0.62);
  color: #fff;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.user-profile-btn:hover .user-profile-gear {
  opacity: 1;
}

.settings-user-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.settings-user-meta {
  display: grid;
  gap: 2px;
}

.settings-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #d7ecf1;
  color: #155e75;
  border: 1px solid #93c5d2;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  overflow: hidden;
}

.settings-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-profile-preview {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  border: 1px solid #93c5d2;
  background: #d7ecf1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #155e75;
  font-size: 30px;
  font-weight: 800;
  margin: 0 auto;
}

.user-profile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-profile-head-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 12px;
}

.user-profile-actions-col {
  display: grid;
  gap: 8px;
}

.user-profile-name-wrap {
  padding: 0;
  border: 0;
  background: transparent;
}

.user-profile-name-text {
  font-size: 18px;
  line-height: 1.2;
}

.user-profile-name-row {
  justify-content: flex-start;
}

.user-profile-edit-row {
  justify-content: flex-end;
}

.user-profile-close-row {
  justify-content: flex-end;
}

#userProfileCloseButton {
  margin-left: auto;
}

.sidebar,
.content {
  padding: 24px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid rgba(216, 204, 185, 0.8);
}

.sidebar-bottom {
  margin-top: auto;
}

.logout-btn {
  background: #b42318;
  color: #fff;
}

.content {
  display: grid;
  min-width: 0;
  overflow-x: hidden;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(216, 204, 185, 0.75);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 18px;
  min-width: 0;
  overflow-x: hidden;
}

.inset {
  box-shadow: none;
  background: #fffaf2;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 36px;
  line-height: 1;
}

.brand h1 {
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.05;
  white-space: nowrap;
}

h2 {
  font-size: 23px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--accent);
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
}

.section-head,
.inline-row,
.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.nav-row {
  margin-top: 18px;
}

.nav-row.nav-top {
  margin-top: 0;
  margin-bottom: 14px;
}

.nav-row.nav-right {
  justify-content: flex-end;
}

.adjust-status-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

#autoCropStatus {
  margin: 0;
}

#openAdjustDetails {
  padding: 6px 10px;
  min-height: 28px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

#adjustXField,
#adjustYField {
  display: none !important;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span,
.check span {
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
}

.slider input {
  padding: 0;
}

.slider {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
}

.slider > span {
  grid-column: 1;
  grid-row: 1;
}

.slider > output {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  min-width: 32px;
  text-align: right;
}

.slider > input {
  grid-column: 1 / -1;
  grid-row: 2;
}

.slider output {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f0e6;
}

.photo-step-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: stretch;
}

.photo-step-preview {
  display: grid;
  gap: 8px;
}

.photo-library-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffaf2;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(50vh, 520px);
  overflow: hidden;
}

.photo-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.photo-library-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-library-head select {
  min-width: 220px;
}

.photo-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: auto;
  padding-right: 2px;
}

.photo-library-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  text-align: left;
  position: relative;
}

.photo-library-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
}

.photo-library-item span {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-library-item-preview {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #bdd8df;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.photo-library-viewer-card {
  width: min(1200px, 98vw);
  height: calc(100vh - 56px);
  max-height: 920px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.photo-library-viewer-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.photo-library-viewer-image-wrap {
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-library-viewer-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: contain !important;
  position: static !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  border-radius: 12px;
}

.photo-library-nav {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 999px;
  font-size: 18px;
}

.photo-library-viewer-actions {
  flex-shrink: 0;
}

.photo-step-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-remove {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0;
  background: #f4d9d5;
  color: var(--danger);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.remove-photo-button {
  justify-self: start;
}

.photo-dropzone {
  border: 2px dashed rgba(21, 94, 117, 0.4);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(217, 238, 243, 0.55) 0%, rgba(255, 250, 242, 0.9) 100%);
  padding: 20px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  height: 100%;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.photo-dropzone.drag-over {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(188, 228, 237, 0.95) 0%, rgba(255, 250, 242, 1) 100%);
  transform: translateY(-1px);
}

.drop-title {
  font-weight: 800;
  font-size: 16px;
  text-align: center;
}

.drop-hint {
  font-size: 12px;
}

.upload input {
  display: none;
}

.upload span {
  display: block;
  text-align: center;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.step-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.step-item {
  padding: 10px 12px;
  border-radius: 14px;
  color: #8a8076;
  border: 1px solid transparent;
  cursor: default;
}

.step-item.available {
  cursor: pointer;
}

.step-item.active {
  background: #d9eef3;
  color: var(--accent);
  border-color: rgba(21, 94, 117, 0.2);
  font-weight: 800;
}

.step-item.done {
  color: var(--text);
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: #d9eef3;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.warning {
  background: #ffedd5;
  color: var(--accent-2);
}

.success {
  background: #dcfce7;
  color: #166534;
}

.error {
  background: #fee2e2;
  color: #b91c1c;
}

.history-list,
.settings-list {
  display: grid;
  gap: 10px;
}

.history-item,
.settings-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8f2e8;
  display: grid;
  gap: 6px;
}

.prompt-item {
  position: relative;
  cursor: default;
  user-select: none;
  padding-right: 48px;
  padding-bottom: 36px;
}

.prompt-item.dragging {
  opacity: 0.6;
}

.prompt-favorite-btn {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  color: #b68f00;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
}

.prompt-drag-btn {
  position: absolute;
  right: 10px;
  bottom: 8px;
  border: 0;
  background: transparent;
  color: #7a6e62;
  font-size: 24px;
  line-height: 1;
  padding: 2px 4px;
  cursor: grab;
}

.prompt-drag-btn:active {
  cursor: grabbing;
}

.history-item {
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 12px;
}

.history-thumb {
  width: 72px;
  height: 90px;
  border-radius: 10px;
  border: 1px solid rgba(17, 17, 17, 0.15);
  object-fit: cover;
  background: #f3f4f6;
}

.history-meta,
.settings-item span {
  font-size: 12px;
  color: var(--muted);
}

.format-grid,
.control-grid,
.settings-grid {
  display: grid;
  gap: 14px;
}

.format-preview-bottom {
  margin-top: 14px;
}

.format-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.control-grid {
  margin-top: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
  gap: 20px;
}

.settings-grid .section-head {
  margin-bottom: 10px;
}

.settings-shell {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.settings-nav {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffaf2;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.settings-nav-item {
  width: 100%;
  text-align: left;
  border-radius: 14px;
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
}

.settings-nav-item.active {
  background: #d9eef3;
  color: var(--accent);
  font-weight: 800;
}

.settings-content {
  min-width: 0;
}

.print-map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.print-map-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.settings-transfer-bar {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.double-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.note-box,
.pill {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
  color: var(--muted);
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.pill {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.biometric-metrics {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  line-height: 1.35;
}

#biometricMetrics {
  display: none !important;
}

.metric-row {
  font-size: 13px;
}

.biometric-metrics.ok {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}

.biometric-metrics.warn {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.preview-pair {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.adjust-layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.retouch-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.retouch-controls {
  display: grid;
  gap: 12px;
}

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

.retouch-action-picker {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf2;
  padding: 10px;
}

.retouch-action-picker .check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
}

.retouch-action-picker .check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  margin: 0;
}

.retouch-action-picker .check span {
  margin: 0;
  font-size: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.retouch-action-picker .action-check {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  cursor: pointer;
}

.retouch-action-picker .action-checkmark {
  display: none;
  margin-left: 8px;
  font-size: 14px;
  color: #136a3a;
}

.retouch-action-picker .action-check.selected {
  background: #e8f8ee;
  border-color: #94d3ae;
}

.retouch-action-picker .action-check.selected .action-checkmark {
  display: inline-block;
}

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

.retouch-viewer[hidden],
.retouch-preview-grid[hidden] {
  display: none !important;
}

.retouch-compare-wrap {
  position: relative;
  display: grid;
  gap: 10px;
}

.manual-retouch-trigger {
  position: absolute;
  top: 28px;
  right: 10px;
  z-index: 4;
  width: 44px;
  height: 44px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  background: #1d6f87;
  color: #fff;
  transition: width 0.2s ease;
}

.manual-retouch-trigger .icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.manual-retouch-trigger .text {
  opacity: 0;
  font-size: 13px;
  font-weight: 800;
  transition: opacity 0.15s ease;
}

.manual-retouch-trigger:hover {
  width: 170px;
}

.manual-retouch-trigger:hover .text {
  opacity: 1;
}

.retouch-viewer {
  position: relative;
  width: 100%;
  min-height: clamp(300px, 52vh, 620px);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

.retouch-viewer-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f3f4f6;
}

.retouch-split {
  --split-x: 50%;
}

.retouch-split-result {
  clip-path: inset(0 0 0 var(--split-x));
}

.retouch-split-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split-x);
  width: 2px;
  background: rgba(14, 114, 143, 0.95);
  transform: translateX(-1px);
  cursor: ew-resize;
  z-index: 2;
}

.retouch-split-divider::before {
  content: none;
}

.retouch-compare-controls {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
}

.retouch-mode-btn {
  min-width: 56px;
  font-size: 14px;
  font-weight: 800;
}

.retouch-mode-btn.active {
  background: #d9eef3;
  color: var(--accent);
  border-color: #9ecedf;
}

.retouch-magnifier {
  position: fixed;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  border: 2px solid #0b6f8f;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  background-repeat: no-repeat;
  background-color: #fff;
  pointer-events: none;
  z-index: 12000;
}

.retouch-actions-row {
  gap: 8px;
  flex-wrap: wrap;
}

.retouch-download-button {
  margin-left: auto;
}

.manual-retouch-card {
  width: min(1200px, 94vw);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;
}

.manual-retouch-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.manual-retouch-tools {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffaf2;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.manual-tool-btn.active {
  background: #d9eef3;
  color: var(--accent);
  border-color: #9ecedf;
}

.manual-tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#manualZoomOut,
#manualZoomIn {
  min-width: 42px;
  padding: 8px 12px;
}

.manual-retouch-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f2f4f8;
  overflow: hidden;
  height: min(68vh, 760px);
  max-height: min(68vh, 760px);
  padding: 10px;
}

.manual-retouch-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding-right: 2px;
}

#manualRetouchCanvas {
  display: block;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  background: #fff;
  touch-action: none;
  cursor: crosshair;
  max-width: none;
}

.manual-brush-cursor {
  position: fixed;
  border: 1.5px solid rgba(21, 94, 117, 0.95);
  border-radius: 999px;
  background: rgba(21, 94, 117, 0.08);
  pointer-events: none;
  z-index: 5;
  transform: translate(-50%, -50%);
}

.manual-pan-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 6;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  background: #9ca3af;
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.manual-pan-toggle.active {
  background: #1d6f87;
}

.manual-pan-toggle:disabled {
  opacity: 1;
  background: #9ca3af;
  color: #eef2f7;
  cursor: not-allowed;
}

.manual-retouch-footer {
  justify-content: flex-end;
  gap: 8px;
}

.manual-retouch-tools .field input[type="range"] {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  width: 100%;
}

.adjust-preview {
  display: grid;
  gap: 10px;
  min-width: 0;
  position: relative;
  overflow: visible;
}

.suggestion-shell {
  --face-top: 30%;
  --face-bottom: 70%;
  --bleed-x: 0px;
  --bleed-y: 0px;
  --oval-side-inset: 0px;
  position: relative;
  width: fit-content;
  margin: 0 auto;
  /* Padding simétrico igual al bleed: así los divs de sangrado siempre
     quedan exactamente fuera del frame sin offsets fijos que se desalinean
     al redimensionar la ventana. */
  padding: var(--bleed-y) var(--bleed-x);
}

#suggestionFrame {
  overflow: visible;
  border-radius: 0;
}

#suggestionFrame .photo-stage {
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

#suggestionFrame .photo-stage canvas {
  position: absolute;
}

#suggestionFrame.render-pending .photo-stage,
#suggestionFrame.render-pending .frame-guide {
  opacity: 0;
}

.suggestion-dim-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ── Guía horizontal 25mm ──────────────────────────────────────────── */
.suggestion-dim-top {
  position: absolute;
  /* Línea en el borde SUPERIOR del bleed = fuera de la foto */
  top: 0;
  left: var(--bleed-x);
  right: var(--bleed-x);
  height: 0;
  border-top: 2px solid rgba(143, 135, 26, 0.9);
  pointer-events: none;
}

/* Ticks verticales en los extremos */
.suggestion-dim-top::before,
.suggestion-dim-top::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 2px;
  height: 10px;
  background: rgba(143, 135, 26, 0.9);
}

.suggestion-dim-top::before { left: 0; }
.suggestion-dim-top::after  { right: 0; }

/* Label 25mm: justo dentro del frame, en la parte superior (debajo de la línea) */
.suggestion-dim-top-label {
  position: absolute;
  /* bleed-y = borde superior del frame; +8px para entrar un poco dentro */
  top: calc(var(--bleed-y) + 8px);
  left: var(--bleed-x);
  right: var(--bleed-x);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: rgba(124, 117, 21, 0.95);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(143, 135, 26, 0.25);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  width: fit-content;
  margin: 0 auto;
  pointer-events: none;
}

.suggestion-dim-right {
  position: absolute;
  top: var(--bleed-y);
  /* Dentro del bleed derecho: pegada al borde derecho del frame */
  right: 0;
  bottom: var(--bleed-y);
  width: var(--bleed-x);
  /* Sin border-right: la línea va en el borde izquierdo del bleed derecho = borde derecho del frame */
  border-left: 2px solid rgba(143, 135, 26, 0.9);
  pointer-events: none;
}

.suggestion-dim-right::before,
.suggestion-dim-right::after {
  content: "";
  position: absolute;
  left: -5px;
  width: 8px;
  height: 2px;
  background: rgba(143, 135, 26, 0.9);
}

.suggestion-dim-right::before { top: 0; }
.suggestion-dim-right::after  { bottom: 0; }

.suggestion-dim-right > span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  font-size: 11px;
  font-weight: 800;
  color: rgba(124, 117, 21, 0.95);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.82);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(143, 135, 26, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#suggestionHeightLabel {
  top: 50%;
}

#suggestionFaceLabel {
  top: calc((var(--face-top) + var(--face-bottom)) / 2);
  color: rgba(20, 111, 77, 0.95);
}

.suggestion-face-guide {
  position: absolute;
  left: var(--bleed-x);
  right: var(--bleed-x);
  border-top: 1px solid rgba(20, 111, 77, 0.6);
}

#suggestionFaceLabel,
.suggestion-face-guide {
  display: none !important;
}

.suggestion-face-top {
  top: calc(var(--bleed-y) + var(--face-top));
}

.suggestion-face-bottom {
  top: calc(var(--bleed-y) + var(--face-bottom));
}

.suggestion-protect {
  position: absolute;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(21, 94, 117, 0.18) 0 8px,
      rgba(21, 94, 117, 0.05) 8px 16px
    );
  border: 1px dashed rgba(21, 94, 117, 0.25);
  z-index: 2;
}

.suggestion-shell.no-bleed .suggestion-protect {
  display: none;
}

.suggestion-oval-boundary {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(21, 94, 117, 0.48);
  pointer-events: none;
  display: none;
  z-index: 2;
}

.suggestion-oval-boundary-outer {
  left: var(--oval-side-inset);
  right: var(--oval-side-inset);
  top: 0;
  bottom: 0;
}

.suggestion-oval-boundary-inner {
  left: calc(var(--bleed-x) + var(--oval-side-inset));
  right: calc(var(--bleed-x) + var(--oval-side-inset));
  top: var(--bleed-y);
  bottom: var(--bleed-y);
}

.suggestion-oval-bleed {
  position: absolute;
  left: var(--oval-side-inset);
  right: var(--oval-side-inset);
  top: 0;
  bottom: 0;
  border-radius: 50%;
  padding: var(--bleed-y) var(--bleed-x);
  pointer-events: none;
  display: none;
  z-index: 2;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(21, 94, 117, 0.18) 0 8px,
      rgba(21, 94, 117, 0.05) 8px 16px
    );
  border: 1px dashed rgba(21, 94, 117, 0.25);
  box-sizing: border-box;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.suggestion-shell.shape-oval .suggestion-oval-boundary {
  display: block;
}

.suggestion-shell.shape-oval #suggestionFrame {
  border-radius: 50%;
}

.suggestion-shell.shape-oval #suggestionFrame .frame-guide {
  border-radius: 50%;
}

.suggestion-shell.shape-oval .suggestion-protect {
  display: none !important;
}

.suggestion-shell.shape-oval .suggestion-oval-bleed {
  display: block;
}

.suggestion-shell.no-bleed .suggestion-oval-bleed {
  display: none;
}

.suggestion-protect-top {
  left: 0;
  right: 0;
  top: 0;
  height: var(--bleed-y);
}

.suggestion-protect-bottom {
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bleed-y);
}

.suggestion-protect-left {
  left: 0;
  width: var(--bleed-x);
  top: var(--bleed-y);
  bottom: var(--bleed-y);
}

.suggestion-protect-right {
  right: 0;
  width: var(--bleed-x);
  top: var(--bleed-y);
  bottom: var(--bleed-y);
}

.suggestion-protect-corner-tl {
  left: 0;
  top: 0;
  width: var(--bleed-x);
  height: var(--bleed-y);
}

.suggestion-protect-corner-tr {
  right: 0;
  top: 0;
  width: var(--bleed-x);
  height: var(--bleed-y);
}

.suggestion-protect-corner-bl {
  left: 0;
  bottom: 0;
  width: var(--bleed-x);
  height: var(--bleed-y);
}

.suggestion-protect-corner-br {
  right: 0;
  bottom: 0;
  width: var(--bleed-x);
  height: var(--bleed-y);
}

.adjust-compare-bar {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.visualization-controls {
  justify-content: flex-start;
  gap: 8px;
}

.compare-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 64px;
  min-height: 48px;
  font-weight: 800;
  line-height: 1;
}

#adjustCompareEyeIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

#adjustCompareEyeIcon svg {
  width: 24px;
  height: 24px;
}

.guide-mode-btn {
  min-width: 48px;
  width: 48px;
  padding-left: 0;
  padding-right: 0;
}

#adjustGuideModeIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

#adjustGuideModeIcon svg {
  width: 22px;
  height: 22px;
}

.frame-guide {
  opacity: 1;
  transition: opacity 0.28s ease;
}

.frame-guide.guide-fading {
  opacity: 0;
}

.compare-btn.active {
  background: #d9eef3;
  color: var(--accent);
  border: 1px solid rgba(21, 94, 117, 0.2);
}

.adjust-controls .control-grid {
  margin-top: 0;
  grid-template-columns: 1fr;
}

.adjust-controls > .eyebrow {
  font-size: 14px;
  letter-spacing: 0.1em;
}

.adjust-controls .field span,
.adjust-controls .check span {
  font-size: 16px;
}

.background-white-pure-check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: #1f8f57;
}

.background-white-pure-check span {
  font-size: 16px;
  font-weight: 700;
}

.color-toggle-group {
  display: grid;
  gap: 2px;
}

.color-toggle-group .check {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.shape-oval-glyph {
  display: inline-block;
  transform: rotate(90deg);
}

.shape-rect-glyph {
  display: inline-block;
  width: 12px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 2px;
  box-sizing: border-box;
}

.adjust-controls {
  min-width: 0;
}

.shape-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.shape-btn {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 18px;
  line-height: 1;
}

.shape-btn.active {
  background: #d9eef3;
  color: var(--accent);
  border: 1px solid rgba(21, 94, 117, 0.2);
}

.single-preview {
  margin-top: 16px;
  max-width: 320px;
}

.correction-layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
  min-height: 0;
}

.correction-controls {
  display: grid;
  gap: 16px;
  align-content: start;
}

.correction-controls .field span,
.correction-controls .check span {
  font-size: 16px;
}

.correction-controls .slider output {
  font-size: 15px;
}

.correction-controls .field input,
.correction-controls .field select,
.correction-controls .check {
  padding-top: 14px;
  padding-bottom: 14px;
}

.correction-controls .color-toggle-group .check {
  padding-top: 2px;
  padding-bottom: 2px;
}

.correction-controls .slider input {
  padding-top: 0;
  padding-bottom: 0;
}

.levels-widget {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f0e6;
  padding: 10px 12px 12px;
  display: grid;
  gap: 8px;
}

.levels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
}

.levels-auto-button {
  padding: 6px 10px;
  min-height: 28px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.levels-graph {
  --black-pos: 0%;
  --gamma-pos: 50%;
  --white-pos: 100%;
  --black-norm: 0;
  --gamma-norm: 0.5;
  --white-norm: 1;
  --levels-pad-x: 10px;
  position: relative;
  height: 72px;
  border-radius: 10px;
  border: 1px solid rgba(34, 28, 20, 0.12);
  background:
    linear-gradient(to right, rgba(0, 0, 0, 0.25) var(--black-pos), transparent var(--black-pos)),
    linear-gradient(to right, transparent var(--white-pos), rgba(255, 255, 255, 0.42) var(--white-pos)),
    #ece3d5;
  overflow: hidden;
  touch-action: none;
}

.levels-histogram-canvas {
  position: absolute;
  inset: 8px 10px 18px;
  width: calc(100% - 20px);
  height: calc(100% - 26px);
  border-radius: 8px;
  opacity: 0.58;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(21, 94, 117, 0.14), transparent),
    repeating-linear-gradient(
      90deg,
      rgba(34, 28, 20, 0.18) 0 2px,
      rgba(34, 28, 20, 0.04) 2px 8px
    );
}

.levels-marker {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.levels-marker-black {
  left: calc(var(--levels-pad-x) + (100% - (var(--levels-pad-x) * 2)) * var(--black-norm));
  color: #111;
}

.levels-marker-gamma {
  left: calc(var(--levels-pad-x) + (100% - (var(--levels-pad-x) * 2)) * var(--gamma-norm));
  color: #1f8f57;
}

.levels-marker-white {
  left: calc(var(--levels-pad-x) + (100% - (var(--levels-pad-x) * 2)) * var(--white-norm));
  color: #444;
}

.levels-handle {
  position: absolute;
  bottom: 6px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  padding: 0;
  min-height: 14px;
}

.levels-handle-black {
  left: calc(var(--levels-pad-x) + (100% - (var(--levels-pad-x) * 2)) * var(--black-norm));
  background: #111;
}

.levels-handle-gamma {
  left: calc(var(--levels-pad-x) + (100% - (var(--levels-pad-x) * 2)) * var(--gamma-norm));
  background: #1f8f57;
}

.levels-handle-white {
  left: calc(var(--levels-pad-x) + (100% - (var(--levels-pad-x) * 2)) * var(--white-norm));
  background: #f5f5f5;
  border-color: #d8d8d8;
}

.levels-values {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.levels-values output {
  color: var(--text);
}

.levels-hidden-range {
  display: none;
}

.correction-preview {
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.correction-preview .photo-frame {
  width: 100%;
  min-height: clamp(420px, 68vh, 860px);
  margin-top: 0;
}

.photo-frame {
  margin-top: 8px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
  background:
    linear-gradient(45deg, rgba(21, 94, 117, 0.08) 25%, transparent 25%, transparent 75%, rgba(21, 94, 117, 0.08) 75%),
    linear-gradient(45deg, rgba(21, 94, 117, 0.08) 25%, transparent 25%, transparent 75%, rgba(21, 94, 117, 0.08) 75%);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

#suggestionFrame.photo-frame {
  border-radius: 0;
  background: transparent;
  border: none;
  margin-top: 0;
}

.photo-frame.large {
  aspect-ratio: 4 / 5;
}


.photo-frame.portrait {
  aspect-ratio: 35 / 45;
}

.photo-stage {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #e8dfd2;
}

.photo-stage.draggable {
  cursor: grab;
}

.photo-stage.draggable.dragging {
  cursor: grabbing;
}

.photo-stage img,
.layout-card img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center;
}

.frame-guide {
  position: absolute;
  inset: 10%;
  border: 0;
  border-radius: 12px;
  pointer-events: none;
}

.guide-line {
  position: absolute;
  left: 6%;
  right: 6%;
  border-top: 2px dashed;
  transform: translateY(-50%);
}

.guide-eyes {
  border-top-color: rgba(21, 94, 117, 0.95);
}

.guide-face-top,
.guide-face-bottom {
  border-top-color: rgba(20, 135, 92, 0.9);
}

.detection-box {
  position: absolute;
  border-radius: 10px;
  pointer-events: none;
  z-index: 2;
}

.detection-box.selected {
  border: 3px solid #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

.detection-box.other {
  border: 2px dashed #ea580c;
  opacity: 0.9;
}

.empty-state {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 16px;
}

.layout-preview {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  overflow-x: auto;
  overflow-y: auto;
  min-width: 0;
}

/* El preview del paso 5 muestra el papel como flex centrado */
#outputPreview {
  display: flex;
  justify-content: center;
  gap: 0;
}

.layout-card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 0;
  background: transparent;
}

.layout-card.matte {
  background: #f2f3f5;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.28);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 9999;
}

#userWizardModal {
  z-index: 10000;
}

#passwordChangedModal {
  z-index: 12000;
}

.modal-card {
  width: min(1100px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fdf8ef;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.22);
}

.modal-card.small {
  width: min(620px, 100%);
}

.password-ok-card {
  text-align: center;
  display: grid;
  justify-items: center;
}

.password-ok-icon {
  width: 82px;
  height: 82px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 46px;
  font-weight: 900;
  color: #166534;
  background: #dcfce7;
  border: 2px solid #86efac;
  margin-bottom: 10px;
}

.password-ok-icon.error {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fca5a5;
}

.user-wizard-card {
  width: min(420px, 100%);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}

.pin-dots .dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #8c8378;
  background: transparent;
}

.pin-dots .dot.filled {
  background: #2f2a24;
  border-color: #2f2a24;
}

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

.pin-pad button {
  min-height: 50px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 800;
}

#userWizardNameStep[hidden],
#userWizardPinStep[hidden] {
  display: none !important;
}

.modal[hidden] {
  display: none;
}

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.top-gap {
  margin-top: 14px;
}

@media (max-width: 1180px) {
  .app-shell,
  .format-grid,
  .control-grid,
  .retouch-grid,
  .retouch-preview-grid,
  .preview-pair,
  .adjust-layout,
  .settings-shell,
  .settings-grid,
  .double-grid,
  .print-map-controls,
  .correction-layout,
  .photo-step-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    min-width: 0;
    overflow-x: hidden;
  }

  .sidebar,
  .content {
    min-width: 0;
    width: 100%;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(216, 204, 185, 0.8);
  }

  .correction-preview .photo-frame {
    min-height: clamp(320px, 52vh, 520px);
  }

  .manual-retouch-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .manual-retouch-stage {
    height: 46vh;
    max-height: 46vh;
  }

  .photo-library-head {
    flex-wrap: wrap;
  }

  .photo-library-head select {
    min-width: 0;
    width: 100%;
  }

  .suggestion-dim-top,
  .suggestion-dim-right {
    display: none !important;
  }

  .suggestion-shell {
    /* En compacto el shell sigue siendo fit-content (= frame + bleed).
       Solo limitamos el ancho máximo para que no desborde el contenedor.
       NO usar width:100% porque haría que los divs de sangrado (right:0)
       se peguen al borde del contenedor en lugar del borde del frame. */
    max-width: 100%;
    box-sizing: border-box;
    padding: var(--bleed-y) var(--bleed-x);
  }

  #suggestionFrame {
    max-width: 100%;
    /* No forzar width/height aquí: el JS calcula el tamaño correcto con aspect ratio.
       El override anterior (width:100% !important; height:auto !important) rompía
       la proporción del recorte en pantallas angostas. */
  }

  /* Bleed overlay uses 0-based positioning - no override needed */

  .suggestion-protect-top,
  .suggestion-protect-bottom {
    left: 0;
    right: 0;
  }

  .suggestion-protect-right,
  .suggestion-protect-corner-tr,
  .suggestion-protect-corner-br {
    right: 0;
  }

  .suggestion-face-guide {
    right: 0;
  }

  .suggestion-shell.shape-oval .suggestion-oval-boundary-outer {
    right: var(--oval-side-inset);
  }

  .suggestion-shell.shape-oval .suggestion-oval-boundary-inner {
    right: calc(var(--bleed-x) + var(--oval-side-inset));
  }

  .suggestion-shell.shape-oval .suggestion-oval-bleed {
    right: var(--oval-side-inset);
  }

  #stepsPanel,
  #openHistoryModal,
  #openSettings,
  #logoutSession,
  #userProfileButton,
  #userNotificationsButton {
    display: none !important;
  }

  #historyQuickPanel,
  #settingsQuickPanel,
  #logoutQuickPanel {
    display: none !important;
  }

  .user-icon-btn.user-mobile-menu-toggle {
    display: grid;
    place-items: center;
  }

  .user-topbar {
    justify-content: flex-start;
    gap: 8px;
  }

  .user-top-actions {
    order: -1;
    gap: 0;
  }

  .user-mobile-menu {
    left: 0;
    right: auto;
  }

  .retouch-grid {
    gap: 12px;
  }

  .nav-row.nav-top:not(.nav-right) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }

  .nav-row.nav-top:not(.nav-right) > button {
    width: 100%;
    min-width: 0;
  }

  .retouch-controls {
    gap: 10px;
  }

  .retouch-viewer {
    min-height: clamp(240px, 44vh, 460px);
  }

  .manual-retouch-trigger {
    position: static;
    justify-self: end;
    margin-top: -2px;
    margin-bottom: 2px;
  }

  .manual-retouch-trigger:hover {
    width: 150px;
  }

  .retouch-compare-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .retouch-download-button {
    margin-left: 0;
  }

}

@media (max-width: 760px) {
  .retouch-viewer {
    min-height: clamp(210px, 38vh, 340px);
  }

  .retouch-mode-btn,
  .retouch-download-button,
  #retouchRun,
  #retouchUseOriginal,
  #rtActionPickerButton {
    width: 100%;
  }

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

@media (max-width: 1500px) {
  .adjust-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 12px;
  }

  .retouch-grid {
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 12px;
  }

  .adjust-controls > .eyebrow {
    font-size: 13px;
    letter-spacing: 0.08em;
  }

  .adjust-controls .field span,
  .adjust-controls .check span {
    font-size: 14px;
  }

  .adjust-controls .slider output {
    font-size: 12px;
  }

  .levels-widget {
    padding: 8px 10px 10px;
    gap: 6px;
  }

  .levels-header {
    font-size: 14px;
  }

  .levels-graph {
    height: 64px;
  }
}

@media (max-width: 1360px) {
  .adjust-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .adjust-preview {
    order: 1;
  }

  .adjust-controls {
    order: 2;
  }

}

@media (max-width: 1180px) {
  .retouch-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ─── Pantallas muy angostas (≤ 480 px — Chrome móvil extremo) ─── */
@media (max-width: 480px) {

  /* Paso 2: botones de navegación en columna única */
  .nav-row.nav-top:not(.nav-right) {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .nav-row.nav-top:not(.nav-right) > button {
    width: 100%;
    min-width: 0;
  }

  /* Paso 2: campo "Tamaño de Papel" — pill + botón en columna */
  .field > .inline-row {
    flex-direction: column;
    align-items: stretch;
  }

  .field > .inline-row > .pill {
    width: 100%;
  }

  .field > .inline-row > button {
    width: 100%;
  }

  /* Paso 2: reducir padding del panel para ganar espacio */
  .panel {
    padding: 12px;
  }

  /* Paso 5: meta info del output con wrap */
  #outputMeta {
    font-size: 12px;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
  }

  /* Paso 2 y 5: section-head en columna cuando el título es largo */
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* Botones de impresión full width */
  #printButton,
  #formatNext,
  #formatPrev {
    width: 100%;
    min-width: 0;
  }
}

/* ─── Texto largo en muted/meta — siempre con wrap ─── */
#outputMeta {
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  min-width: 0;
}

/* Formato de impresión: campo select no desborde */
#formatSelect,
#paperSelect {
  min-width: 0;
  max-width: 100%;
}

/* Guías de medición ocultas */
.suggestion-dim-top,
.suggestion-dim-right {
  display: none !important;
}

/* ─── Input con selector de unidades inline ─── */
.input-unit-row {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.input-unit-row input {
  flex: 1;
  min-width: 0;
  border-radius: 14px 0 0 14px;
  border-right: none;
}

.unit-select {
  width: auto !important;
  min-width: 58px;
  border-radius: 0 14px 14px 0 !important;
  border-left: 1px solid var(--line) !important;
  background: #f4ece0 !important;
  font-size: 13px;
  font-weight: 700;
  padding: 0 8px !important;
  cursor: pointer;
}
