/* Category composer: clear hierarchy, contained controls and optional image. */
.mv7-category-smart-card,
.mv7-category-summary,
.mv7-category-inline-new {
  display: none;
}

.mv7-category-dialog {
  width: min(560px, calc(100% - 28px));
}

.mv7-category-dialog form {
  box-sizing: border-box;
  padding: 24px;
}

.mv7-category-dialog header {
  align-items: flex-start;
  margin-bottom: 18px;
}

.mv7-category-dialog header > div {
  min-width: 0;
}

.mv7-category-dialog header h2 {
  font-size: 21px;
  font-weight: 620;
}

.mv7-category-dialog header p {
  max-width: 42ch;
  margin: 6px 0 0;
  color: var(--v2-muted);
  font-size: var(--v2-text-xs);
  line-height: 1.5;
}

.mv7-category-photo-field {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
  padding: 13px;
  border: 1px solid var(--v2-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.mv7-category-photo-preview {
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.mv7-category-photo-preview > span {
  display: grid;
  width: 64px;
  height: 64px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18);
}

.mv7-category-photo-preview img,
.mv7-category-chip-dot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mv7-category-photo-preview > i {
  position: absolute;
  right: 1px;
  bottom: 1px;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 2px solid #111512;
  border-radius: 7px;
  background: #232925;
  color: #fff;
  pointer-events: none;
}

.mv7-category-photo-preview > i svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.mv7-category-photo-preview:focus-visible {
  outline: 2px solid var(--v2-green-bright);
  outline-offset: 2px;
}

.mv7-category-photo-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.mv7-category-photo-copy strong {
  font-size: var(--v2-text-sm);
  font-weight: 620;
}

.mv7-category-photo-copy small {
  color: var(--v2-muted);
  font-size: var(--v2-text-xs);
  line-height: 1.4;
}

.mv7-category-photo-copy > div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 3px;
}

.mv7-category-photo-copy .mv7-text-action {
  min-height: 25px;
  padding: 0;
  font-size: var(--v2-text-xs);
}

.mv7-category-photo-copy #category-photo-remove {
  color: #ff8179;
}

.mv7-category-form-section {
  min-width: 0;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.mv7-category-form-section legend,
.mv7-category-dialog .mv7-field > span {
  margin-bottom: 8px;
  color: var(--v2-muted);
  font-size: var(--v2-text-xs);
}

.mv7-category-dialog .mv7-type-switch {
  margin: 0;
}

.mv7-category-dialog .mv7-type-switch label {
  min-width: 0;
}

.mv7-category-dialog .mv7-type-switch input:focus-visible + span {
  outline: 2px solid var(--v2-green-bright);
  outline-offset: -2px;
}

.mv7-category-dialog .mv7-type-switch input:disabled + span {
  opacity: 0.45;
  cursor: not-allowed;
}

.mv7-category-type-hint {
  display: block;
  margin-top: 7px;
  color: var(--v2-dim);
  font-size: var(--v2-text-micro);
  line-height: 1.4;
}

.mv7-category-dialog .mv7-field {
  margin-bottom: 16px;
}

.mv7-category-dialog .mv7-field input {
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  cursor: text;
  font-size: var(--v2-text-sm);
}

.mv7-category-dialog .mv7-field input[aria-invalid='true'] {
  border-color: rgba(255, 98, 89, 0.62);
  box-shadow: 0 0 0 3px rgba(255, 98, 89, 0.08);
}

.mv7-category-form-error {
  grid-column: 1 / -1;
  margin: 0;
  color: #ff8179;
  font-size: var(--v2-text-xs);
  line-height: 1.4;
}

.mv7-category-form-error[hidden] {
  display: none;
}

.mv7-category-dialog .mv7-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.mv7-category-dialog .mv7-color-swatch {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 2px solid transparent;
  border-radius: 50%;
}

.mv7-category-dialog .mv7-color-swatch::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  content: '✓';
  font-size: 15px;
  font-weight: 800;
  opacity: 0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.mv7-category-dialog .mv7-color-swatch.is-selected {
  border-color: var(--v2-text);
  box-shadow: 0 0 0 2px #0b0e0c, 0 0 0 3px var(--swatch-color);
}

.mv7-category-dialog .mv7-color-swatch.is-selected::after {
  opacity: 1;
}

.mv7-category-dialog-actions {
  justify-content: space-between !important;
  margin-top: 4px;
  padding-top: 18px !important;
  border-top: 1px solid var(--v2-line);
}

.mv7-category-dialog-actions > div {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.mv7-category-dialog-actions button {
  min-height: 40px;
}

.mv7-category-dialog-actions button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.mv7-category-list-table .mv7-category-chip-dot {
  overflow: hidden;
}

.mv7-category-list-table .mv7-category-chip-dot svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.mv7-category-list-table .mv7-category-row-arrow {
  width: 18px;
  height: 18px;
  justify-self: end;
  fill: none;
  stroke: var(--v2-muted);
  stroke-width: 1.8;
  pointer-events: none;
}

@media (min-width: 769px) {
  [data-settings-panel='categories'] .mv7-category-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 32%);
  }

  /* Bug real (2026-09-17): "Usos" mostraba "0 movimie..." cortado en TODAS
     las filas — 72px no alcanza para "N movimientos" con el tipo de letra
     de la tabla. Se ensancha esa columna y se achica un poco "Categoría"
     (que sobraba espacio de más) para compensar. */
  [data-settings-panel='categories'] .mv7-category-table-head {
    grid-template-columns: minmax(0, 1.35fr) minmax(112px, 0.8fr) minmax(64px, 0.48fr) 18px;
    gap: 10px;
  }

  [data-settings-panel='categories'] .mv7-category-list-table .mv7-category-chip {
    grid-template-columns: 38px minmax(0, 1.35fr) minmax(112px, 0.8fr) minmax(64px, 0.48fr) 18px;
    gap: 10px;
    padding-inline: 12px;
  }

  [data-settings-panel='categories'] :is(.mv7-category-row-name, .mv7-category-row-uses) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

:root[data-resolved-theme='light'] .mv7-category-photo-field {
  background: #f8fafc;
}

:root[data-resolved-theme='light'] .mv7-category-photo-preview > i {
  border-color: #fff;
  background: #27332e;
}

@media (max-width: 560px) {
  .mv7-category-dialog form {
    padding: 18px;
  }

  .mv7-category-dialog header {
    margin-bottom: 16px;
  }

  .mv7-category-dialog-actions {
    align-items: stretch !important;
    flex-direction: column-reverse;
  }

  .mv7-category-dialog-actions > div {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
    margin: 0;
  }

  .mv7-category-dialog-actions > #category-delete {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .mv7-category-photo-field {
    grid-template-columns: 58px minmax(0, 1fr);
    padding: 11px;
  }

  .mv7-category-photo-preview {
    width: 58px;
    height: 58px;
  }

  .mv7-category-photo-preview > span {
    width: 54px;
    height: 54px;
  }
}
